forked from jsj2008/lithtech
-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
190 lines (165 loc) · 6.02 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
cmake_minimum_required(VERSION 3.1)
project(Lithtech)
if(NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(DXVK dxvk-native)
if(DXVK_FOUND)
set(GL OFF)
set(VK ON)
else()
set(GL ON)
set(VK OFF)
endif()
endif()
option(BUILD_ENGINE "Build engine" ON)
option(BUILD_NOLF2 "Build No One Lives Forever 2 game code" ON)
option(BUILD_TRON "Build Tron 2.0 game code" OFF)
option(BUILD_BLOOD2 "Build Blood II game code" OFF)
option(BUILD_FEAR "Build F.E.A.R. game code" OFF)
option(BUILD_NOLF "Build No One Lives Forever game code" OFF)
option(BUILD_SHOGO "Build Shogo game code" OFF)
option(BUILD_TOOLS "Build tools" OFF)
if(WIN32)
option(ENABLE_D3D "Enable Direct3D" ON)
option(ENABLE_DIRECTX "Enable DirectX" ON)
option(ENABLE_DIRECTSHOW "Enable DirectShow" ON)
option(ENABLE_OPENAL "Use OpenAL as audio backend" OFF)
option(ENABLE_DIRECTMUSIC "Use DirectMusic as music backend" ON)
else(WIN32)
option(ENABLE_OPENGL "Enable OpenGL 3.3" ${GL})
option(ENABLE_VULKAN "Enable Vulkan" OFF)
option(ENABLE_DXVK "Enable DXVK" ${VK})
option(ENABLE_OPENAL "Use OpenAL as audio backend" ON)
option(ENABLE_DIRECTMUSIC OFF)
endif(WIN32)
option(USE_INTERNAL_ZLIB "Use bundled zlib" ON) # eventually want default to be OFF
option(USE_INTERNAL_FREETYPE "Use bundled freetype" ON) # eventually want default to be OFF
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/OUT")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
if (ENABLE_DXVK)
option(ENABLE_D3D "Enable Direct3D" ON)
pkg_check_modules(DXVK dxvk-native)
add_definitions(-DUSE_DXVK)
set(DXVK_INCLUDE_DIRS ${DXVK_INCLUDEDIR}/native/windows ${DXVK_INCLUDEDIR}/native/directx)
set(DXVK_LIB_DIRS ${DXVK_LIBDIR})
endif()
if (ENABLE_OPENAL AND NOT WIN32)
pkg_check_modules(OPENAL REQUIRED openal)
pkg_check_modules(MPG123 REQUIRED libmpg123)
endif()
if(ENABLE_D3D)
add_definitions(-D__D3D -D__D3DREND)
endif(ENABLE_D3D)
if(WIN32)
add_definitions(-D_WINDOWS)
else(WIN32)
add_definitions(-D_LINUX -D__LINUX)
set(LINUX 1)
endif(WIN32)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif(MSVC)
if(DEBUG)
add_definitions(-D_DEBUG)
else(DEBUG)
add_definitions(-D_FINAL)
endif(DEBUG)
if(USE_INTERNAL_ZLIB)
#set zlib vars
add_subdirectory(libs/zlib) # LIB_ZLib
else(USE_INTERNAL_ZLIB)
find_package(ZLIB)
endif(USE_INTERNAL_ZLIB)
# move to Lib_UI CMakeLists.txt?
if(USE_INTERNAL_FREETYPE)
#set freetype vars
else(USE_INTERNAL_FREETYPE)
find_package(Freetype)
endif(USE_INTERNAL_FREETYPE)
add_subdirectory(libs/lith) # LIB_Lith
add_subdirectory(libs/stdlith) # LIB_StdLith
add_subdirectory(libs/ltmem) # LIB_LTMem
add_subdirectory(libs/rezmgr) # LIB_RezMgr
add_subdirectory(libs/RandomGen) # LIB_Random
if(LINUX)
set(JSON_BuildTests off)
add_subdirectory(libs/DynRes)
add_subdirectory(json)
endif(LINUX)
if(BUILD_ENGINE)
add_subdirectory(runtime/ui) # LIB_UI
add_subdirectory(runtime/info) # LIB_Info
add_subdirectory(runtime/sound) # LIB_ILTSound
add_subdirectory(runtime/server) # DLL_Server
add_subdirectory(runtime/client) # EXE_Lithtech
if(ENABLE_D3D)
add_subdirectory(runtime/render_a/src/sys/d3d) # LIB_D3DRender
endif(ENABLE_D3D)
if(WIN32)
if(NOT ENABLE_OPENAL)
add_subdirectory(runtime/sound/src/sys/s_dx8) # DLL_SndDrvDX8
endif(NOT ENABLE_OPENAL)
if(ENABLE_DIRECTSHOW)
add_subdirectory(libs/dshow) # LIB_DShow
endif(ENABLE_DIRECTSHOW)
add_subdirectory(runtime/winbuild/ltmsg) # DLL_LTMsg
endif(WIN32)
endif(BUILD_ENGINE)
if(BUILD_NOLF2)
add_subdirectory(libs/MFCStub) # LIB_MFCStub
add_subdirectory(libs/ButeMgr) # LIB_ButeMgr
add_subdirectory(libs/CryptMgr) # LIB_CryptMgr
add_subdirectory(libs/RegMgr) # LIB_RegMgr
add_subdirectory(libs/LTGUIMgr) # LIB_LTGUIMgr
add_subdirectory(libs/ServerDir) # ServerDir
add_subdirectory(libs/WONAPI) # LIB_WONAPI
add_subdirectory(NOLF2/ClientFxDLL) # ClientFXDLL
add_subdirectory(NOLF2/ClientRes/TO2) # ClientRes
add_subdirectory(NOLF2/ClientShellDLL/TO2) # ClientShellDLL
add_subdirectory(NOLF2/ObjectDLL/TO2) # ObjectDLL
add_subdirectory(NOLF2/ServerRes/TO2) # ServerRes
endif(BUILD_NOLF2)
if(BUILD_FEAR)
if(NOT BUILD_NOLF2)
add_subdirectory(libs/MFCStub) # LIB_MFCStub
add_subdirectory(libs/ButeMgr) # LIB_ButeMgr
add_subdirectory(libs/CryptMgr) # LIB_CryptMgr
add_subdirectory(libs/RegMgr) # LIB_RegMgr
add_subdirectory(libs/LTGUIMgr) # LIB_LTGUIMgr
add_subdirectory(libs/ServerDir) # ServerDir
add_subdirectory(libs/WONAPI) # LIB_WONAPI
endif(NOT BUILD_NOLF2)
add_subdirectory(FEAR/ClientFxDLL) # ClientFXDLL
# add_subdirectory(NOLF2/ClientRes/TO2) # ClientRes
add_subdirectory(FEAR/ClientShellDLL) # ClientShellDLL
# add_subdirectory(NOLF2/ObjectDLL/TO2) # ObjectDLL
# add_subdirectory(NOLF2/ServerRes/TO2) # ServerRes
endif(BUILD_FEAR)
if(BUILD_TRON)
if(NOT BUILD_NOLF2)
add_subdirectory(libs/MFCStub)
add_subdirectory(libs/ButeMgr)
add_subdirectory(libs/CryptMgr)
add_subdirectory(libs/RegMgr)
add_subdirectory(libs/LTGUIMgr)
add_subdirectory(libs/ServerDir)
add_subdirectory(libs/WONAPI)
add_subdirectory(NOLF2/ClientFxDLL) # ClientFXDLL
endif(NOT BUILD_NOLF2)
add_subdirectory(NOLF2/ClientRes/TRON) # ClientRes
add_subdirectory(NOLF2/ClientShellDLL/TRON) # ClientShellDLL
add_subdirectory(NOLF2/ObjectDLL/TRON) # ObjectDLL
add_subdirectory(NOLF2/ServerRes/TRON) # ServerRes
endif(BUILD_TRON)
if(BUILD_TOOLS)
add_subdirectory(tools/DtxView) # TOOLS_DtxView
add_subdirectory(tools/LithRez) # TOOLS_LithRez
endif(BUILD_TOOLS)
if(NOT WIN32)
add_subdirectory(tests/RegMgr)
add_subdirectory(tests/CShell)
add_subdirectory(tests/DynRes)
add_subdirectory(tests/DynResDLL)
add_subdirectory(tests/rndgen)
endif(NOT WIN32)