-
-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
187 lines (164 loc) · 6.54 KB
/
Copy pathCMakeLists.txt
File metadata and controls
187 lines (164 loc) · 6.54 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
add_library(GWToolboxdll SHARED)
file(GLOB SOURCES CONFIGURE_DEPENDS
"*.h"
"*.cpp"
"GWToolbox.rc"
"Constants/*.h"
"Constants/*.cpp"
"Modules/*.h"
"Modules/*.cpp"
"Utils/*.h"
"Utils/*.cpp"
"Utils/*.ixx"
"Widgets/*.h"
"Widgets/*.cpp"
"Widgets/Minimap/*.h"
"Widgets/Minimap/*.cpp"
"Windows/*.h"
"Windows/*.cpp"
"Windows/Hotkeys/*.h"
"Windows/Hotkeys/*.cpp"
"Windows/Splits/*.h"
"Windows/Splits/*.cpp"
"Windows/Pathfinding/*.h"
"Windows/Pathfinding/*.hpp"
"Windows/Pathfinding/*.cpp"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
target_sources(GWToolboxdll PRIVATE ${SOURCES})
# Native Gw.dat reader/decoders (Utils/GwDat). Added explicitly rather than via the
# Utils glob so the reverse-engineered ATEX/xentax sources can build with warnings
# relaxed and without the precompiled header (they are self-contained).
file(GLOB GWDAT_SOURCES CONFIGURE_DEPENDS
"Utils/GwDat/*.h"
"Utils/GwDat/*.cpp"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${GWDAT_SOURCES})
target_sources(GWToolboxdll PRIVATE ${GWDAT_SOURCES})
set_source_files_properties(${GWDAT_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/Utils/GwDat/xentax.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Utils/GwDat/AtexAsm.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Utils/GwDat/AtexReader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Utils/GwDat/AtexDecompress.cpp"
PROPERTIES COMPILE_FLAGS "/W0")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/GWToolbox.rc"
PROPERTIES OBJECT_DEPENDS "${CMAKE_SOURCE_DIR}/Dependencies/GWCA/bin/gwca.dll")
# auto-generated files - export header & pch
include(GenerateExportHeader)
generate_export_header(GWToolboxdll)
#target_sources(GWToolboxdll PRIVATE FILE_SET generated_header TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} FILES ${CMAKE_CURRENT_BINARY_DIR}/gwtoolboxdll_export.h)
target_sources(GWToolboxdll PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gwtoolboxdll_export.h)
target_include_directories(GWToolboxdll PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
source_group(Generated FILES ${CMAKE_CURRENT_BINARY_DIR}/gwtoolboxdll_export.h)
target_precompile_headers(GWToolboxdll PRIVATE "stdafx.h")
source_group(Generated REGULAR_EXPRESSION cmake_pch)
target_compile_definitions(GWToolboxdll PRIVATE
"_USRDLL"
"GWCA_IMPORT"
)
target_compile_options(GWToolboxdll PRIVATE /Gy /utf-8)
target_compile_options(GWToolboxdll PRIVATE $<$<CONFIG:RelWithDebInfo>:/Zi>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Skip /W4 for clang-cl: it expands to -Wall -Wextra
target_compile_options(GWToolboxdll PRIVATE $<$<CONFIG:Debug>:/Z7 /Od>)
else()
target_compile_options(GWToolboxdll PRIVATE /W4 /WX)
target_compile_options(GWToolboxdll PRIVATE $<$<CONFIG:Debug>:/ZI /Od>)
endif()
set_target_properties(GWToolboxdll PROPERTIES
VS_GLOBAL_RunCodeAnalysis false
VS_GLOBAL_EnableMicrosoftCodeAnalysis true
VS_GLOBAL_EnableClangTidyCodeAnalysis false
)
target_link_options(GWToolboxdll PRIVATE
/WX /OPT:REF /OPT:ICF /SAFESEH:NO
$<$<NOT:$<CONFIG:Debug>>:/INCREMENTAL:NO>
$<$<CONFIG:Debug>:/IGNORE:4098 /OPT:NOREF /OPT:NOICF>
$<$<CONFIG:RelWithDebInfo>:/OPT:NOICF>
$<$<CONFIG:Debug>:/NODEFAULTLIB:LIBCMT>
/IGNORE:4099 # pdb not found for github action
"/DELAYLOAD:gwca.dll"
)
target_include_directories(GWToolboxdll PRIVATE
"${PROJECT_SOURCE_DIR}/Dependencies"
"${PROJECT_SOURCE_DIR}/Dependencies/GWCA/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
include(imgui_fonts)
find_package(minhook CONFIG REQUIRED)
find_package(unofficial-uwebsockets CONFIG REQUIRED)
find_package(recastnavigation CONFIG REQUIRED)
target_link_libraries(GWToolboxdll PRIVATE
# cmake targets:
RestClient
imgui
Microsoft::DirectXTex
directxtexloader
gwca
steamworks_sdk
easywsclient
${CPP_GAME_SDK}
glaze::glaze
imgui::fonts
IconFontCppHeaders
nativefiledialog
wintoast
minhook::minhook
ctre::ctre
unofficial::uwebsockets::uwebsockets
RecastNavigation::Detour
# libs:
Dbghelp.lib # for MiniDump
bcrypt.lib # for SHA256 (Resources.cpp)
delayimp # for delay loading gwca
)
file(GLOB FXC_PATHS "C:/Program Files (x86)/Windows Kits/10/bin/*/x86")
find_program(FXC fxc DOC "hlsl compiler" PATHS ${FXC_PATHS})
if(NOT FXC)
message(SEND_ERROR "unable to find Fxc.exe for HLSL compilation")
endif(NOT FXC)
file(GLOB HLSL_VERTEX_SHADER_FILES CONFIGURE_DEPENDS
Widgets/Minimap/Shaders/*_vs.hlsl
)
file(GLOB HLSL_PIXEL_SHADER_FILES CONFIGURE_DEPENDS
Widgets/Minimap/Shaders/*_ps.hlsl
)
set_source_files_properties(${HLSL_VERTEX_SHADER_FILES} PROPERTIES ShaderType "vs")
set_source_files_properties(${HLSL_PIXEL_SHADER_FILES} PROPERTIES ShaderType "ps")
foreach(FILE ${HLSL_VERTEX_SHADER_FILES} ${HLSL_PIXEL_SHADER_FILES})
get_filename_component(FILE_NOEXT ${FILE} NAME_WE)
get_filename_component(FILE_DIR ${FILE} DIRECTORY)
get_source_file_property(shadertype ${FILE} ShaderType)
set(OUTPUT_FILE ${FILE_DIR}/${FILE_NOEXT}.h)
add_custom_command(OUTPUT ${OUTPUT_FILE}
COMMAND ${FXC} /nologo /E main /T ${shadertype}_3_0 /Vn ${FILE_NOEXT} /O3 /Zi /Fh ${OUTPUT_FILE} ${FILE}
MAIN_DEPENDENCY ${FILE}
COMMENT "HLSL ${FILE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM)
list(APPEND SHADER_OUTPUTS ${OUTPUT_FILE})
endforeach()
add_custom_target(compile_shaders DEPENDS ${SHADER_OUTPUTS})
add_dependencies(GWToolboxdll compile_shaders)
# compress.ps1 needs PowerShell, which isn't available when configuring from a non-Windows
# host (e.g. the wine cross-build in scripts/build-wine-prefix.sh); gzip is a POSIX
# equivalent for the RelWithDebInfo-only PDB compression it does.
if(CMAKE_HOST_WIN32)
add_custom_command(TARGET GWToolboxdll POST_BUILD
COMMAND powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass
-File "${CMAKE_CURRENT_SOURCE_DIR}/compress.ps1"
"$<TARGET_PDB_FILE:GWToolboxdll>"
"$<CONFIG>"
COMMENT "Compressing PDB for distribution (RelWithDebInfo only)"
VERBATIM
)
else()
add_custom_command(TARGET GWToolboxdll POST_BUILD
COMMAND $<IF:$<CONFIG:RelWithDebInfo>,gzip,${CMAKE_COMMAND}>
$<IF:$<CONFIG:RelWithDebInfo>,-kf,-E>
$<IF:$<CONFIG:RelWithDebInfo>,$<TARGET_PDB_FILE:GWToolboxdll>,true>
COMMENT "Compressing PDB for distribution (RelWithDebInfo only)"
VERBATIM
)
endif()