-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
102 lines (80 loc) · 2.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
cmake_minimum_required(VERSION 3.27)
set(PROJECT_NAME Xash)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_WIN32_EXECUTABLE ON)
project(
${PROJECT_NAME}
VERSION 1.0.0
LANGUAGES CXX RC
)
set(ICON_RC ${CMAKE_SOURCE_DIR}/assets/icon.rc)
add_executable(
${PROJECT_NAME}
${ICON_RC}
)
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wWinMainCRTStartup"
)
if(MSVC)
target_compile_options(
${PROJECT_NAME}
PRIVATE
/W4
)
endif()
target_include_directories(
${PROJECT_NAME}
PRIVATE
${CMAKE_SOURCE_DIR}/src
)
target_link_libraries(
${PROJECT_NAME}
PRIVATE
d3d11.lib
)
add_subdirectory(external)
add_subdirectory(src)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:${PROJECT_NAME}>
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.exe
)
# CPack
if(NOT DEFINED APP_PACKAGE)
set(APP_PACKAGE false)
endif()
if (APP_PACKAGE)
include(InstallRequiredSystemLibraries)
install(TARGETS ${PROJECT_NAME}
DESTINATION bin
)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/"
DESTINATION "bin/assets"
)
# CPack configuration
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_VENDOR "Xash")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A cpp mono injector")
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} ${PROJECT_NAME})
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})
set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME})
# NSIS
set(CPACK_GENERATOR NSIS)
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.ico")
set(CPACK_NSIS_PACKAGE_NAME "XashInjector")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.ico")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\.github/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\.git/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/build/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/dllTest/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/external/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "/scripts/")
include(CPack)
endif()