-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
243 lines (208 loc) · 6.01 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
# 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(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()
project(outrun2006tweaks-proj)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(ASMJIT_STATIC ON CACHE BOOL "" FORCE)
# disable unneeded FLAC stuff
set(INSTALL_MANPAGES OFF CACHE BOOL "" FORCE)
set(BUILD_CXXLIBS OFF CACHE BOOL "" FORCE)
set(BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_PROGRAMS OFF CACHE BOOL "" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(UPNPC_BUILD_SAMPLE OFF CACHE BOOL "" FORCE)
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "" FORCE)
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF)
if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
# Statically compile runtime
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
message(NOTICE "Building in Release mode")
endif()
include(FetchContent)
# Fix warnings about DOWNLOAD_EXTRACT_TIMESTAMP
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
message(STATUS "Fetching zydis (v4.0.0)...")
FetchContent_Declare(zydis
GIT_REPOSITORY
"https://github.com/zyantific/zydis"
GIT_TAG
v4.0.0
)
FetchContent_MakeAvailable(zydis)
message(STATUS "Fetching safetyhook (629558c64009a7291ba6ed5cfb49187086a27a47)...")
FetchContent_Declare(safetyhook
GIT_REPOSITORY
"https://github.com/cursey/safetyhook"
GIT_TAG
629558c64009a7291ba6ed5cfb49187086a27a47
)
FetchContent_MakeAvailable(safetyhook)
message(STATUS "Fetching ogg (v1.3.5)...")
FetchContent_Declare(ogg
GIT_REPOSITORY
"https://github.com/xiph/ogg"
GIT_TAG
v1.3.5
)
FetchContent_MakeAvailable(ogg)
message(STATUS "Fetching flac (1.4.3)...")
FetchContent_Declare(flac
GIT_REPOSITORY
"https://github.com/xiph/flac"
GIT_TAG
1.4.3
)
FetchContent_MakeAvailable(flac)
message(STATUS "Fetching miniupnpc (miniupnpd_2_3_7)...")
FetchContent_Declare(miniupnpc
GIT_REPOSITORY
"https://github.com/miniupnp/miniupnp"
GIT_TAG
miniupnpd_2_3_7
SOURCE_SUBDIR
miniupnpc
)
FetchContent_MakeAvailable(miniupnpc)
# Target: spdlog
set(spdlog_SOURCES
cmake.toml
"external/spdlog/src/async.cpp"
"external/spdlog/src/bundled_fmtlib_format.cpp"
"external/spdlog/src/cfg.cpp"
"external/spdlog/src/color_sinks.cpp"
"external/spdlog/src/file_sinks.cpp"
"external/spdlog/src/spdlog.cpp"
"external/spdlog/src/stdout_sinks.cpp"
)
add_library(spdlog STATIC)
target_sources(spdlog PRIVATE ${spdlog_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${spdlog_SOURCES})
target_compile_definitions(spdlog PUBLIC
SPDLOG_COMPILED_LIB
_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
)
target_include_directories(spdlog PUBLIC
"external/spdlog/include"
)
# Target: outrun2006tweaks
set(outrun2006tweaks_SOURCES
cmake.toml
"external/ModUtils/MemoryMgr.h"
"external/ModUtils/Patterns.cpp"
"external/ModUtils/Patterns.h"
"external/miniz/miniz.c"
"external/miniz/miniz.h"
"external/xxHash/xxhash.c"
"external/xxHash/xxhash.h"
"src/Proxy.cpp"
"src/Proxy.def"
"src/Proxy.hpp"
"src/Resource.rc"
"src/dllmain.cpp"
"src/exception.hpp"
"src/game.hpp"
"src/game_addrs.hpp"
"src/hook_mgr.cpp"
"src/hook_mgr.hpp"
"src/hooks_audio.cpp"
"src/hooks_bugfixes.cpp"
"src/hooks_exceptions.cpp"
"src/hooks_flac.cpp"
"src/hooks_forcefeedback.cpp"
"src/hooks_framerate.cpp"
"src/hooks_graphics.cpp"
"src/hooks_input.cpp"
"src/hooks_misc.cpp"
"src/hooks_textures.cpp"
"src/hooks_uiscaling.cpp"
"src/plugin.hpp"
"src/resource.h"
)
add_library(outrun2006tweaks SHARED)
target_sources(outrun2006tweaks PRIVATE ${outrun2006tweaks_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${outrun2006tweaks_SOURCES})
target_compile_definitions(outrun2006tweaks PUBLIC
_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
DIRECTINPUT_VERSION=0x0800
)
target_compile_features(outrun2006tweaks PUBLIC
cxx_std_20
)
target_compile_options(outrun2006tweaks PUBLIC
"/GR-"
"/GS-"
"/bigobj"
"/EHa"
"/MP"
)
target_include_directories(outrun2006tweaks PUBLIC
"shared/"
"src/"
"include/"
"external/ModUtils/"
"external/ini-cpp/ini/"
"external/xxHash/"
"external/miniz/"
)
target_link_libraries(outrun2006tweaks PUBLIC
spdlog
safetyhook
ogg
FLAC
version.lib
xinput9_1_0.lib
Hid.lib
libminiupnpc-static
)
target_link_options(outrun2006tweaks PUBLIC
"/DEBUG"
"/OPT:REF"
"/OPT:ICF"
)
set_target_properties(outrun2006tweaks PROPERTIES
OUTPUT_NAME
dinput8
SUFFIX
.dll
RUNTIME_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
)