forked from ccomrade/c1-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
210 lines (164 loc) · 7.1 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
cmake_minimum_required(VERSION 3.15)
################################################################################
project(C1-Launcher VERSION 6 LANGUAGES CXX RC)
################################################################################
if(NOT MSVC)
message(FATAL_ERROR "MSVC is the only supported compiler!")
endif()
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
# detect VS2005 compiler and use dynamically linked MSVC runtime library, otherwise use statically linked one
if(MSVC_VERSION EQUAL 1400)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
################################################################################
math(EXPR BUILD_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
message(STATUS "${PROJECT_NAME} v${PROJECT_VERSION_MAJOR} ${BUILD_BITS}-bit")
configure_file(Project.h.in ${PROJECT_BINARY_DIR}/Project.h)
################################################################################
add_library(LauncherBase STATIC
Code/CryCommon/CryGame/IGameRef.h
Code/CryCommon/CryGame/IGameStartup.h
Code/CryCommon/CrySystem/IConsole.h
Code/CryCommon/CrySystem/ICryPak.h
Code/CryCommon/CrySystem/ILog.h
Code/CryCommon/CrySystem/ISystem.cpp
Code/CryCommon/CrySystem/ISystem.h
Code/CryCommon/CrySystem/IValidator.h
Code/Launcher/CPUInfo.cpp
Code/Launcher/CPUInfo.h
Code/Launcher/CryRender.h
Code/Launcher/LauncherCommon.cpp
Code/Launcher/LauncherCommon.h
Code/Launcher/MemoryPatch.cpp
Code/Launcher/MemoryPatch.h
Code/Library/CPUID.cpp
Code/Library/CPUID.h
Code/Library/CrashLogger.cpp
Code/Library/CrashLogger.h
Code/Library/EXELoader.cpp
Code/Library/EXELoader.h
Code/Library/OS.cpp
Code/Library/OS.h
Code/Library/PathTools.cpp
Code/Library/PathTools.h
Code/Library/StdFile.h
Code/Library/StringFormat.cpp
Code/Library/StringFormat.h
Code/Library/StringView.h
)
target_link_libraries(LauncherBase PUBLIC dbghelp)
if(BUILD_BITS EQUAL 64)
target_compile_definitions(LauncherBase PUBLIC BUILD_64BIT)
endif()
# also include PROJECT_BINARY_DIR with configured Project.h
target_include_directories(LauncherBase PUBLIC Code ${PROJECT_BINARY_DIR})
# explicitly disable some stupid MSVC warnings
target_compile_options(LauncherBase PUBLIC /D_CRT_SECURE_NO_WARNINGS /wd4100 /wd4201 /wd4351 /wd4481 /wd4512)
# prevent modern MSVC from enabling ASLR, which breaks Crysis DLLs, and unlock memory above 2 GB
target_link_options(LauncherBase PUBLIC /DYNAMICBASE:NO /LARGEADDRESSAWARE)
################################################################################
add_library(GameLauncher STATIC
Code/Launcher/Game/GameLauncher.cpp
Code/Launcher/Game/GameLauncher.h
Code/Launcher/Game/LanguageHook.cpp
Code/Launcher/Game/LanguageHook.h
Code/Launcher/Game/Resources.h
)
target_link_libraries(GameLauncher LauncherBase)
set(GAME_LAUNCHER_MANIFESTS
${PROJECT_SOURCE_DIR}/Resources/Manifests/DpiAwareness.manifest
${PROJECT_SOURCE_DIR}/Resources/Manifests/EnableVisualStyles.manifest
${PROJECT_SOURCE_DIR}/Resources/Manifests/TrustInfo.manifest
${PROJECT_SOURCE_DIR}/Resources/Manifests/VC80_CRT.manifest
)
################################################################################
add_executable(Crysis WIN32
Code/Launcher/Game/Main.cpp
Resources/Crysis.rc
${GAME_LAUNCHER_MANIFESTS}
)
target_link_libraries(Crysis GameLauncher)
################################################################################
# 32-bit Warhead is not supported yet
if(BUILD_BITS EQUAL 64)
add_executable(CrysisWarheadLauncher WIN32
Code/Launcher/Game/Main.cpp
Resources/CrysisWarhead.rc
${GAME_LAUNCHER_MANIFESTS}
)
target_link_libraries(CrysisWarheadLauncher GameLauncher)
endif()
################################################################################
add_executable(CrysisWars WIN32
Code/Launcher/Game/Main.cpp
Resources/CrysisWars.rc
${GAME_LAUNCHER_MANIFESTS}
)
target_link_libraries(CrysisWars GameLauncher)
set_target_properties(CrysisWars
PROPERTIES
RUNTIME_OUTPUT_NAME Crysis
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Wars
)
################################################################################
add_executable(CrysisDedicatedServer WIN32
Code/Launcher/DedicatedServer/DedicatedServerLauncher.cpp
Code/Launcher/DedicatedServer/DedicatedServerLauncher.h
Code/Launcher/DedicatedServer/Main.cpp
Code/Launcher/DedicatedServer/Resources.h
Resources/DedicatedServer.rc
Resources/Manifests/DpiAwareness.manifest
Resources/Manifests/EnableVisualStyles.manifest
Resources/Manifests/TrustInfo.manifest
Resources/Manifests/VC80_CRT.manifest
)
target_link_libraries(CrysisDedicatedServer LauncherBase)
################################################################################
add_executable(CrysisHeadlessServer
Code/Launcher/HeadlessServer/HeadlessServerLauncher.cpp
Code/Launcher/HeadlessServer/HeadlessServerLauncher.h
Code/Launcher/HeadlessServer/Logger.cpp
Code/Launcher/HeadlessServer/Logger.h
Code/Launcher/HeadlessServer/Main.cpp
Code/Launcher/HeadlessServer/NullValidator.h
Resources/HeadlessServer.rc
Resources/Manifests/TrustInfo.manifest
Resources/Manifests/VC80_CRT.manifest
)
target_link_libraries(CrysisHeadlessServer LauncherBase)
################################################################################
add_executable(EditorLauncher WIN32
Code/Launcher/Editor/EditorLauncher.cpp
Code/Launcher/Editor/EditorLauncher.h
Code/Launcher/Editor/Main.cpp
Code/Launcher/Editor/Resources.h
Resources/Editor.rc
Resources/Manifests/DpiAwareness.manifest
Resources/Manifests/EnableVisualStyles.manifest
Resources/Manifests/TrustInfo.manifest
Resources/Manifests/VC80_CRT.manifest
Resources/Manifests/VC80_MFC.manifest
)
target_link_libraries(EditorLauncher LauncherBase)
################################################################################
set(CURSORS
${PROJECT_SOURCE_DIR}/Resources/CursorAmber.cur
${PROJECT_SOURCE_DIR}/Resources/CursorBlue.cur
${PROJECT_SOURCE_DIR}/Resources/CursorGreen.cur
${PROJECT_SOURCE_DIR}/Resources/CursorRed.cur
${PROJECT_SOURCE_DIR}/Resources/CursorWhite.cur
)
set(CRYSIS_RESOURCES ${CURSORS} ${PROJECT_SOURCE_DIR}/Resources/Crysis.ico)
set(CRYSIS_WARHEAD_RESOURCES ${CURSORS} ${PROJECT_SOURCE_DIR}/Resources/CrysisWarhead.ico)
set(CRYSIS_WARS_RESOURCES ${CURSORS} ${PROJECT_SOURCE_DIR}/Resources/CrysisWars.ico)
set(DEDICATED_SERVER_RESOURCES ${PROJECT_SOURCE_DIR}/Resources/DedicatedServer.ico)
set(EDITOR_RESOURCES ${PROJECT_SOURCE_DIR}/Resources/Editor.ico)
set_source_files_properties(Resources/Crysis.rc PROPERTIES OBJECT_DEPENDS "${CRYSIS_RESOURCES}")
set_source_files_properties(Resources/CrysisWarhead.rc PROPERTIES OBJECT_DEPENDS "${CRYSIS_WARHEAD_RESOURCES}")
set_source_files_properties(Resources/CrysisWars.rc PROPERTIES OBJECT_DEPENDS "${CRYSIS_WARS_RESOURCES}")
set_source_files_properties(Resources/DedicatedServer.rc PROPERTIES OBJECT_DEPENDS "${DEDICATED_SERVER_RESOURCES}")
set_source_files_properties(Resources/Editor.rc PROPERTIES OBJECT_DEPENDS "${EDITOR_RESOURCES}")
################################################################################