forked from H-uru/Plasma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
287 lines (239 loc) · 8.61 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
project(Plasma)
cmake_minimum_required(VERSION 2.8.11.2)
include(FeatureSummary)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
# Set up Product Identification parameters
set(PRODUCT_BRANCH_ID "1" CACHE STRING "Branch ID")
set(PRODUCT_BUILD_ID "918" CACHE STRING "Build ID")
set(PRODUCT_BUILD_TYPE "50" CACHE STRING "Build Type")
set(PRODUCT_CORE_NAME "UruLive" CACHE STRING "Product Core Name")
set(PRODUCT_SHORT_NAME "UruLive" CACHE STRING "Product Short Name")
set(PRODUCT_LONG_NAME "Uru Live" CACHE STRING "Product Long Name")
set(PRODUCT_UUID "ea489821-6c35-4bd0-9dae-bb17c585e680"
CACHE STRING "Product UUID")
# Configure compile-time compiler-specific flags
include(cmake/CompilerChecks.cmake)
# HeadSpin Configuration
if(WIN32 AND NOT CYGWIN)
add_definitions(-DHS_BUILD_FOR_WIN32)
endif(WIN32 AND NOT CYGWIN)
if(UNIX)
# This is set for both Linux and Mac builds
add_definitions(-DHS_BUILD_FOR_UNIX)
endif(UNIX)
if(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DHS_BUILD_FOR_OSX)
endif(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DHS_BUILD_FOR_LINUX)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# End HeadSpin Configuration
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plasma_BINARY_DIR}/bin)
# Find all 3rd-party libraries that are required
find_package(OpenSSL REQUIRED)
set_package_properties(OpenSSL PROPERTIES
URL "https://www.openssl.org/"
DESCRIPTION "OpenSSL libraries for SSL/TLS"
TYPE REQUIRED
)
find_package(OpenAL REQUIRED)
set_package_properties(OpenAL PROPERTIES
URL "http://www.openal.org/"
DESCRIPTION "3D audio and EAX library"
TYPE REQUIRED
)
set(Python_ADDITIONAL_VERSIONS 2.7)
find_package(PythonLibs REQUIRED)
set_package_properties(PythonLibs PROPERTIES
URL "http://www.python.org"
DESCRIPTION "Python Scripting language C bindings"
TYPE REQUIRED
)
find_package(EXPAT REQUIRED)
set_package_properties(EXPAT PROPERTIES
URL "http://expat.sourceforge.net/"
DESCRIPTION "Expat XML Parser for C"
TYPE REQUIRED
)
find_package(ZLIB REQUIRED)
set_package_properties(ZLIB PROPERTIES
URL "http://www.zlib.net"
DESCRIPTION "Fast (de)compression library"
TYPE REQUIRED
)
find_package(JPEG REQUIRED)
set_package_properties(JPEG PROPERTIES
URL "http://libjpeg-turbo.virtualgl.org/"
DESCRIPTION "JPEG encoding and decoding library. libjpeg-turbo is recommended for better performance"
TYPE REQUIRED
)
find_package(PNG REQUIRED)
set_package_properties(PNG PROPERTIES
URL "http://www.libpng.org/pub/png/libpng.html"
DESCRIPTION "Efficient lossless image library"
TYPE REQUIRED
)
#TODO: Not required if we aren't building the client
find_package(Ogg REQUIRED)
set_package_properties(Ogg PROPERTIES
URL "https://xiph.org/ogg/"
DESCRIPTION "Ogg multimedia container library for various audio and video codecs"
TYPE REQUIRED
PURPOSE "Required for audio support in the client"
)
#TODO: Not required if we aren't building the client
find_package(Vorbis REQUIRED)
set_package_properties(Vorbis PROPERTIES
URL "https://xiph.org/vorbis/"
DESCRIPTION "Free and open audio codec for mid-to-high quality audio"
TYPE REQUIRED
PURPOSE "Required for audio support in the client"
)
#TODO: Not required if we aren't building the client
find_package(Speex REQUIRED)
set_package_properties(Speex PROPERTIES
URL "http://www.speex.org/"
DESCRIPTION "Free and open audio codec specifically designed for speech"
TYPE REQUIRED
PURPOSE "Required for in-game voice chat in the client"
)
find_package(VPX)
set_package_properties(VPX PROPERTIES
URL "http://www.webmproject.org/"
DESCRIPTION "VP8 and VP9 video codec"
TYPE OPTIONAL
PURPOSE "Required for in-game video playback support"
)
find_package(Opus)
set_package_properties(Opus PROPERTIES
URL "https://www.opus-codec.org/"
DESCRIPTION "Versatile free and open audio codec"
TYPE OPTIONAL
PURPOSE "Required for in-game video playback support"
)
find_package(CURL REQUIRED)
set_package_properties(CURL PROPERTIES
URL "http://curl.haxx.se/libcurl/"
DESCRIPTION "Multi-protocol file transfer library"
TYPE REQUIRED
)
find_package(Freetype)
set_package_properties(Freetype PROPERTIES
URL "http://www.freetype.org/"
DESCRIPTION "Library for rendering fonts"
TYPE OPTIONAL
PURPOSE "Required in order to build the plFontConverter tool"
)
if(WIN32)
#TODO: Not required if we aren't building the client
find_package(PhysX REQUIRED)
set_package_properties(PhysX PROPERTIES
URL "https://developer.nvidia.com/physx-sdk"
DESCRIPTION "Library for hardware-accelerated physics simulation for gaming"
TYPE REQUIRED
)
find_package(DirectX REQUIRED)
set_package_properties(DirectX PROPERTIES
DESCRIPTION "Framework for hardware-accelerated 3D graphics on Microsoft platforms"
TYPE REQUIRED
)
endif(WIN32)
if(VPX_FOUND AND Opus_FOUND)
set(MOVIE_AVAILABLE TRUE)
add_definitions(-DMOVIE_AVAILABLE)
endif()
include(PrecompiledHeader) #Precompiled Header helper macros
if(WIN32)
# libCurl isn't smart enough to detect this for us, so we have to configure it ourselves
option(CURL_IS_STATIC "Using the static version of libcurl?" ON)
if(CURL_IS_STATIC)
add_definitions(-DCURL_STATICLIB)
endif(CURL_IS_STATIC)
# Same story for expat
option(EXPAT_IS_STATIC "Using the static version of libexpat" ON)
endif(WIN32)
option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF)
if(PLASMA_EXTERNAL_RELEASE)
add_definitions(-DPLASMA_EXTERNAL_RELEASE)
endif(PLASMA_EXTERNAL_RELEASE)
set(PLASMA_TARGETS "Client"
CACHE STRING "Which set of plasma targets to build and use")
set_property(CACHE PLASMA_TARGETS PROPERTY STRINGS
"Client" "Server" "Patcher" "Ethereal" "NoAvMsgs")
if(PLASMA_TARGETS STREQUAL "Client")
add_definitions(-DCLIENT)
endif(PLASMA_TARGETS STREQUAL "Client")
if(PLASMA_TARGETS STREQUAL "Patcher")
add_definitions(-DPATCHER)
endif(PLASMA_TARGETS STREQUAL "Patcher")
if(PLASMA_TARGETS STREQUAL "Server")
add_definitions(-DSERVER)
endif(PLASMA_TARGETS STREQUAL "Server")
if(PLASMA_TARGETS STREQUAL "NoAvMsgs")
add_definitions(-DNO_AV_MSGS)
endif(PLASMA_TARGETS STREQUAL "NoAvMsgs")
if(PLASMA_TARGETS STREQUAL "Ethereal")
add_definitions(-DSTREAM_LOGGER)
endif(PLASMA_TARGETS STREQUAL "Ethereal")
#Allow us to disable certain parts of the build
option(PLASMA_BUILD_RESOURCE_DAT "Do we want to build resource.dat?" ON)
option(PLASMA_BUILD_LAUNCHER "Do we want to build plUruLauncher?" ON)
option(PLASMA_BUILD_TOOLS "Do we want to build the Plasma tools?" ON)
option(PLASMA_BUILD_TESTS "Do we want to build the unit tests?" OFF)
if(WIN32)
find_package(3dsm)
set_package_properties(3dsm PROPERTIES
URL "http://www.autodesk.com/"
DESCRIPTION "SDK for integrating with the 3DS Max modelling software"
TYPE OPTIONAL
PURPOSE "Required for building the Plasma plugins for 3DS Max"
)
option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF)
if (3dsm_BUILD_PLUGIN AND 3dsm_FOUND)
add_definitions(-DBUILDING_MAXPLUGIN)
endif()
else()
set(3dsm_BUILD_PLUGIN OFF)
endif()
if(WIN32)
find_package(VLD)
set_package_properties(VLD PROPERTIES
URL "https://vld.codeplex.com/"
DESCRIPTION "Visual Leak Debugger for software compiled with Microsoft Visual C++"
TYPE OPTIONAL
PURPOSE "Useful for detecting memory leaks (MSVC only)"
)
option(USE_VLD "Build and link with Visual Leak Detector" OFF)
if(USE_VLD AND VLD_FOUND)
add_definitions(-DUSE_VLD)
include_directories(${VLD_INCLUDE_DIR})
endif()
endif()
if(PLASMA_BUILD_TOOLS)
# Custom dummy target for compiling all tools
add_custom_target(tools)
endif()
include(TestBigEndian)
test_big_endian(BIG_ENDIAN)
if(BIG_ENDIAN)
add_definitions(-DBIG_ENDIAN)
else()
add_definitions(-DLITTLE_ENDIAN)
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_SCL_SECURE_NO_DEPRECATE)
endif(MSVC)
#TODO: Make the OpenSSL includes less promiscuous so this isn't needed
include_directories(${OPENSSL_INCLUDE_DIR})
add_subdirectory(Sources/Plasma)
add_subdirectory(Sources/Tools)
if(PLASMA_BUILD_TESTS)
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
add_subdirectory(Sources/Tests EXCLUDE_FROM_ALL)
endif(PLASMA_BUILD_TESTS)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)