-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
245 lines (209 loc) · 5.45 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
cmake_minimum_required(VERSION 3.15)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr and automatically regenerate CMakeLists.txt
include("cmake/cmkr.cmake" OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Create a configure-time dependency on cmake.toml to improve IDE support
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-m32 ")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-m32 ")
# Options
option(DYNOHOOK_BUILD_STATIC_RUNTIME "" OFF)
# Variables
set(PORTAL2_DIR "D:/SteamLibrary/steamapps/common/Portal 2")
project(photon
LANGUAGES
C
CXX
DESCRIPTION
"Photon is a mod loader for Portal 2."
)
# Target: lodepng
set(lodepng_SOURCES
cmake.toml
"vendor/lodepng/lodepng.cpp"
"vendor/lodepng/lodepng.h"
)
add_library(lodepng STATIC)
target_sources(lodepng PRIVATE ${lodepng_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${lodepng_SOURCES})
add_library(lvandeve::lodepng ALIAS lodepng)
if(MSVC) # msvc
target_compile_options(lodepng PUBLIC
"/MP"
)
endif()
# Target: photon
set(CMKR_TARGET photon)
add_subdirectory("vendor/DynoHook" EXCLUDE_FROM_ALL)
set(photon_SOURCES
cmake.toml
"src/core/configs/configs.cpp"
"src/core/configs/configs.h"
"src/core/convars/convars.cpp"
"src/core/convars/convars.h"
"src/core/huds/huds.cpp"
"src/core/huds/huds.h"
"src/core/interfaces/interfaces.cpp"
"src/core/interfaces/interfaces.h"
"src/core/menu/framework.cpp"
"src/core/menu/framework.h"
"src/core/menu/gui.cpp"
"src/core/menu/gui.h"
"src/core/mods/mods.cpp"
"src/core/mods/mods.h"
"src/core/photon.cpp"
"src/core/photon.h"
"src/core/shared/ccon.cpp"
"src/core/shared/common.cpp"
"src/core/shared/config.cpp"
"src/core/shared/hud.cpp"
"src/core/shared/input.cpp"
"src/core/shared/menu.cpp"
"src/core/shared/render.cpp"
"src/core/shared/signal.cpp"
"src/core/signals/signals.cpp"
"src/core/signals/signals.h"
"src/sdk/ccon.h"
"src/sdk/common.h"
"src/sdk/config.h"
"src/sdk/hud.h"
"src/sdk/input.h"
"src/sdk/menu.h"
"src/sdk/photon.h"
"src/sdk/platform.h"
"src/sdk/render.h"
"src/sdk/signal.h"
"src/sdk/source-sdk/color.h"
"src/sdk/source-sdk/convar.h"
"src/sdk/source-sdk/misc.h"
"src/sdk/source-sdk/utlvector.h"
"src/sdk/source-sdk/vector.h"
"src/sdk/source_sdk.h"
"src/source-sdk/interfaces.h"
"src/source-sdk/interfaces/command_line.h"
"src/source-sdk/interfaces/console.h"
"src/source-sdk/interfaces/cvar.h"
"src/source-sdk/interfaces/engine_client.h"
"src/source-sdk/interfaces/entity_list.h"
"src/source-sdk/interfaces/font_manager.h"
"src/source-sdk/interfaces/game_rules.h"
"src/source-sdk/interfaces/input_system.h"
"src/source-sdk/interfaces/mem_alloc.h"
"src/source-sdk/interfaces/scheme.h"
"src/source-sdk/interfaces/surface.h"
"src/source-sdk/plugin.cpp"
"src/source-sdk/plugin.h"
"src/util/address.h"
"src/util/math.h"
"src/util/util.cpp"
"src/util/util.h"
)
add_library(photon SHARED)
target_sources(photon PRIVATE ${photon_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${photon_SOURCES})
target_compile_definitions(photon PUBLIC
NOMINMAX
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") # gcc
target_compile_definitions(photon PUBLIC
_GNU_SOURCE
)
endif()
target_compile_features(photon PUBLIC
cxx_std_20
)
if(MSVC) # msvc
target_compile_options(photon PUBLIC
"/MP"
)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") # gcc
target_compile_options(photon PUBLIC
-fPIC
-fpermissive
)
endif()
target_include_directories(photon PUBLIC
src
vendor
"vendor/DynoHook/include"
"build/vendor/DynoHook/exports"
"vendor/DynoHook/asmjit/src"
"vendor/json/single_include"
)
target_link_libraries(photon PUBLIC
dynohook
lvandeve::lodepng
)
# Target: example-mod
set(example-mod_SOURCES
cmake.toml
"example-mod/config/config.cpp"
"example-mod/config/config.h"
"example-mod/convars/convars.cpp"
"example-mod/convars/convars.h"
"example-mod/huds/hud.cpp"
"example-mod/huds/hud.h"
"example-mod/mod.cpp"
"example-mod/mod.h"
"example-mod/signals/signals.cpp"
"example-mod/signals/signals.h"
)
add_library(example-mod SHARED)
target_sources(example-mod PRIVATE ${example-mod_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${example-mod_SOURCES})
target_compile_definitions(example-mod PUBLIC
NOMINMAX
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") # gcc
target_compile_definitions(example-mod PUBLIC
_GNU_SOURCE
)
endif()
target_compile_features(example-mod PUBLIC
cxx_std_20
)
if(MSVC) # msvc
target_compile_options(example-mod PUBLIC
"/MP"
)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") # gcc
target_compile_options(example-mod PUBLIC
-fPIC
-fpermissive
)
endif()
target_include_directories(example-mod PUBLIC
example-mod
"src/sdk"
)
install(
TARGETS
photon
DESTINATION
${PORTAL2_DIR}
COMPONENT
photon
)
install(
TARGETS
example-mod
DESTINATION
"${PORTAL2_DIR}/photon"
COMPONENT
example-mod
)