Skip to content

Commit f1c33bf

Browse files
author
Jan Wilmans
committed
added cpack configuration, but ZIP not working yet
1 parent bff35bf commit f1c33bf

File tree

7 files changed

+57
-16
lines changed

7 files changed

+57
-16
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ bin/
66
packages/
77
bin
88
obj/
9-
Testing/
9+
Testing/
10+
install/

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ cmake_minimum_required(VERSION 3.16)
33
set(CMAKE_CXX_STANDARD 23)
44
set(CMAKE_CXX_EXTENSIONS OFF)
55

6+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
7+
include(CMakeLists.buildnumber)
8+
include(CMakeLists.nuget)
9+
10+
MESSAGE("Building DebugViewpp version: ${DEBUGVIEW_VERSION}")
11+
612
project(
713
debugviewpp
8-
VERSION 0.0.1
14+
VERSION ${DEBUGVIEW_VERSION}
915
DESCRIPTION "DebugView++, collects, views, filters your application logs"
1016
HOMEPAGE_URL "https://github.com/CobaltFusion/DebugViewPP"
1117
LANGUAGES CXX C
@@ -24,9 +30,6 @@ endif()
2430

2531
set(PROJECT_UTILS_DIRECTORY "${PROJECT_SOURCE_DIR}/utils")
2632

27-
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
28-
include(CMakeLists.nuget)
29-
3033
add_library(project_definitions INTERFACE)
3134
add_library(project_compile_features INTERFACE)
3235
add_library(project_compile_options INTERFACE)
@@ -54,9 +57,6 @@ add_subdirectory(application)
5457

5558
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT Debugviewpp)
5659

57-
# this include needs to be after all install() rules
58-
include(CPack)
59-
6060
message("")
6161
message("configuration: ${CMAKE_BUILD_TYPE}")
6262
message("will be built in: ${CMAKE_BINARY_DIR}")

application/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,15 @@ add_subdirectory(DebugViewConsole)
88
add_subdirectory(GDIGraphicsPOC)
99
add_subdirectory(IndexedStorageLib)
1010
add_subdirectory(Win32Lib)
11-
add_subdirectory(Libraries)
11+
add_subdirectory(Libraries EXCLUDE_FROM_ALL)
12+
13+
set(CPACK_PACKAGE_CONTACT "janwilmans@gmail.com")
14+
set(CPACK_PACKAGE_VERSION "${DEBUGVIEW_VERSION}")
15+
set(CPACK_DEBIAN_PACKAGE_RELEASE "December 2022")
16+
set(CPACK_PACKAGING_INSTALL_PREFIX "debugviewpp")
17+
set(CPACK_GENERATOR "ZIP")
18+
set(CPACK_DEB_COMPONENT_INSTALL OFF)
19+
set(CPACK_MONOLITHIC_INSTALL ON)
20+
21+
# this include needs to be after all install() rules
22+
include(CPack)

application/DebugViewConsole/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
project(DebugViewConsole)
22

3-
add_executable(${PROJECT_NAME} DebugViewConsole.cpp)
3+
add_executable(DebugViewConsole DebugViewConsole.cpp)
44

5-
target_link_libraries(${PROJECT_NAME}
5+
target_link_libraries(DebugViewConsole
66
PRIVATE
77
project::definitions
88
project::compile_features
@@ -14,6 +14,13 @@ target_link_libraries(${PROJECT_NAME}
1414
docopt
1515
)
1616

17-
target_include_directories(${PROJECT_NAME} PUBLIC
17+
install(TARGETS DebugViewConsole RUNTIME DESTINATION debugviewpp)
18+
19+
target_include_directories(DebugViewConsole PUBLIC
1820
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
1921
)
22+
23+
get_property(EXE_NAME TARGET DebugViewConsole PROPERTY TARGET_FILE_NAME)
24+
add_custom_command(TARGET DebugViewConsole POST_BUILD COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe --best $<TARGET_FILE:DebugViewConsole>)
25+
26+
# CPACK_ARCHIVE_FILE_NAME

application/DebugViewpp/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project(Debugviewpp)
22

3-
add_executable(${PROJECT_NAME}
3+
add_executable(Debugviewpp
44
AboutDlg.cpp
55
CLogViewTabItem2.cpp
66
DebugView++.cpp
@@ -21,7 +21,7 @@ add_executable(${PROJECT_NAME}
2121
DebugView++.rc
2222
)
2323

24-
target_link_libraries(${PROJECT_NAME}
24+
target_link_libraries(Debugviewpp
2525
PRIVATE
2626
project::definitions
2727
project::compile_features
@@ -38,8 +38,12 @@ target_link_libraries(${PROJECT_NAME}
3838
fmt::fmt
3939
)
4040

41-
target_include_directories(${PROJECT_NAME} PUBLIC
41+
install(TARGETS Debugviewpp RUNTIME DESTINATION debugviewpp)
42+
43+
target_include_directories(Debugviewpp PUBLIC
4244
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
4345
)
4446

45-
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND echo test ${PROJECT_UTILS_DIRECTORY}/upx.exe ${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR})
47+
get_property(EXE_NAME TARGET Debugviewpp PROPERTY TARGET_FILE_NAME)
48+
add_custom_command(TARGET Debugviewpp POST_BUILD COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe --best $<TARGET_FILE:Debugviewpp>)
49+

cmake/CMakeLists.buildnumber.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Set the initial build number
2+
set(BUILD_NUMBER 0)
3+
4+
# Check if the build number file exists
5+
if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/build_number.txt)
6+
# If it exists, read the current build number from the file
7+
file(READ ${CMAKE_SOURCE_DIR}/cmake/build_number.txt BUILD_NUMBER)
8+
endif()
9+
10+
# Increment the build number
11+
math(EXPR BUILD_NUMBER "${BUILD_NUMBER} + 1")
12+
13+
# Write the updated build number to the file
14+
file(WRITE ${CMAKE_SOURCE_DIR}/cmake/build_number.txt ${BUILD_NUMBER})
15+
16+
# Set the build number as a CMake variable
17+
set(DEBUGVIEW_VERSION "1.9.0.${BUILD_NUMBER}" CACHE INTERNAL "")

cmake/build_number.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

0 commit comments

Comments
 (0)