forked from evemuproject/evemu_crucible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
291 lines (231 loc) · 8.23 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
288
289
290
291
#
# CMake build system file for EVEmu.
#
# Author: Bloody.Rabbit
#
###############
# CMake setup #
###############
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 FATAL_ERROR )
PROJECT( "evemu" )
SET( PROJECT_DESCRIPTION_SUMMARY "A server emulator for EVE Online" )
SET( PROJECT_VENDOR "The EVEmu development team" )
SET( PROJECT_VERSION "0.7-experimental" )
SET( CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
"${CMAKE_MODULE_PATH}" )
INCLUDE( "CheckSymbolExists" )
INCLUDE( "TargetBuildPCH" )
INCLUDE( "TestX64" )
###########
# Options #
###########
SET( EVEMU_COLLECTOR_ENABLE OFF
CACHE BOOL "Build eve-collector." )
SET( EVEMU_DOC_ENABLE OFF
CACHE BOOL "Generate HTML documentation (requires Doxygen)." )
SET( EVEMU_SOURCE_SCM ""
CACHE STRING "Source SCM in use; valid values: '', 'svn', 'git'" )
SET( EVEMU_TOOL_ENABLE OFF
CACHE BOOL "Build eve-tool." )
SET( EVEMU_ROOT_DIR "..////"
CACHE PATH "The root of EVEmu workspace." )
MARK_AS_ADVANCED( EVEMU_ROOT_DIR )
SET( TINYXML_USE_STL ON
CACHE BOOL "tinyxml will use native STL." )
MARK_AS_ADVANCED( TINYXML_USE_STL )
# Mark a bunch of stuff as advanced
MARK_AS_ADVANCED(Boost_DIR Boost_LIB_DIAGNOSTIC_DEFINITIONS CMAKE_INSTALL_PREFIX Lua_DIR)
#########
# Tests #
#########
TEST_X64( X64 )
CHECK_SYMBOL_EXISTS( "__FreeBSD__" "" FREE_BSD )
SET( GNUC ${CMAKE_COMPILER_IS_GNUCXX} )
################
# Dependencies #
################
FIND_PACKAGE( "Threads" REQUIRED )
IF (WIN32)
FIND_PACKAGE( "MySQL" 5.0 QUIET )
FIND_PACKAGE( "ZLIB" QUIET )
FIND_PACKAGE( "Boost" QUIET )
ELSE()
FIND_PACKAGE( "MySQL" 5.0 REQUIRED )
FIND_PACKAGE( "ZLIB" REQUIRED )
FIND_PACKAGE( "Boost" REQUIRED )
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
ENDIF (WIN32)
IF ( NOT WIN32)
FIND_PACKAGE( "ICONV" REQUIRED )
ENDIF ( NOT WIN32 )
IF( EVEMU_DOC_ENABLE )
FIND_PACKAGE( "Doxygen" REQUIRED )
ENDIF( EVEMU_DOC_ENABLE )
IF( NOT EVEMU_SOURCE_REVISION )
IF( EVEMU_SOURCE_SCM STREQUAL "svn" )
FIND_PACKAGE( "Subversion" REQUIRED )
ELSEIF( EVEMU_SOURCE_SCM STREQUAL "git" )
FIND_PACKAGE( "Git" REQUIRED )
ENDIF( EVEMU_SOURCE_SCM STREQUAL "svn" )
ENDIF( NOT EVEMU_SOURCE_REVISION )
FIND_PACKAGE( "Gangsta" QUIET )
FIND_PACKAGE( "Lua" QUIET )
FIND_PACKAGE( "TinyXML" QUIET )
FIND_PACKAGE( "UTF8CPP" QUIET )
#################
# Configuration #
#################
IF( WIN32 )
SET( PROJECT_STANDARD_LIBRARIES "wsock32" ${CMAKE_THREAD_LIBS_INIT} )
ELSE( WIN32 )
SET( PROJECT_STANDARD_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} )
ENDIF( WIN32 )
IF( MSVC )
#
# This is here as we usually use pre-built MySQL binaries which are
# compiled with /MT (use static libc); building with /MD (use DLL libc)
# results in linker warning during the linking stage, however the resultant
# binary works and is even a little bit smaller due to the dynamic linking.
#
# For now we supress the linker warning by forcing static libc.
#
#STRING( REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
#STRING( REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" )
#STRING( REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" )
#STRING( REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" )
#STRING( REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
# to avoid linking any boost libs
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"BOOST_DATE_TIME_NO_LIB\" /D \"BOOST_REGEX_NO_LIB\"" )
ENDIF( MSVC )
IF ( NOT MSVC )
# to avoid linking any boost libs
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB" )
ENDIF ( NOT MSVC )
IF( NOT EVEMU_SOURCE_REVISION )
IF( EVEMU_SOURCE_SCM STREQUAL "svn" )
Subversion_WC_INFO( "${PROJECT_SOURCE_DIR}" "${PROJECT_NAME}" )
SET( EVEMU_SOURCE_REVISION "r${${PROJECT_NAME}_WC_LAST_CHANGED_REV}"
CACHE STRING "Revision of the source." )
MARK_AS_ADVANCED( EVEMU_SOURCE_REVISION )
ELSEIF( EVEMU_SOURCE_SCM STREQUAL "git" )
GIT_TREE_INFO( "${PROJECT_SOURCE_DIR}" "${PROJECT_NAME}" )
SET( EVEMU_SOURCE_REVISION "${${PROJECT_NAME}_HASH_SHORT}"
CACHE STRING "Revision of the source." )
MARK_AS_ADVANCED( EVEMU_SOURCE_REVISION )
ENDIF( EVEMU_SOURCE_SCM STREQUAL "svn" )
ENDIF( NOT EVEMU_SOURCE_REVISION )
IF( EVEMU_SOURCE_REVISION )
SET( PROJECT_VERSION "${PROJECT_VERSION}-${EVEMU_SOURCE_REVISION}" )
ENDIF( EVEMU_SOURCE_REVISION )
############
# config.h #
############
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
ESCAPE_QUOTES @ONLY )
ADD_DEFINITIONS( "-DHAVE_CONFIG_H" )
INCLUDE_DIRECTORIES( "${PROJECT_BINARY_DIR}" )
############################
# Distributed dependencies #
############################
ADD_SUBDIRECTORY( "dep/utils" )
IF( NOT GANGSTA_FOUND )
ADD_SUBDIRECTORY( "dep/gangsta" )
SET( GANGSTA_FOUND TRUE )
SET( GANGSTA_INCLUDE_DIR "${gangsta_INCLUDE_DIR}" )
SET( GANGSTA_LIBRARIES "gangsta" )
ENDIF( NOT GANGSTA_FOUND )
IF( NOT LUA_FOUND )
ADD_SUBDIRECTORY( "dep/lua" )
SET( LUA_FOUND TRUE )
SET( LUA_INCLUDE_DIR "${lua_INCLUDE_DIR}" )
SET( LUA_LIBRARIES "lua" )
ENDIF( NOT LUA_FOUND )
IF( NOT TINYXML_FOUND )
ADD_SUBDIRECTORY( "dep/tinyxml" )
SET( TINYXML_FOUND TRUE )
SET( TINYXML_INCLUDE_DIR "${tinyxml_INCLUDE_DIR}" )
SET( TINYXML_LIBRARIES "tinyxml" )
ENDIF( NOT TINYXML_FOUND )
IF( NOT UTF8CPP_FOUND )
ADD_SUBDIRECTORY( "dep/utf8cpp" )
SET( UTF8CPP_FOUND TRUE )
SET( UTF8CPP_INCLUDE_DIR "${utf8cpp_INCLUDE_DIR}" )
SET( UTF8CPP_LIBRARIES "utf8cpp" )
ENDIF( NOT UTF8CPP_FOUND )
IF(NOT BOOST_FOUND)
ADD_SUBDIRECTORY("dep/boost")
SET(BOOST_FOUND TRUE)
SET(Boost_INCLUDE_DIR "${boost_INCLUDE_DIR}")
SET(Boost_DIR "${boost_INCLUDE_DIR}")
SET(BOOST_LIBRARIES "boost")
#LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ENDIF(NOT BOOST_FOUND)
IF(NOT MYSQL_FOUND)
ADD_SUBDIRECTORY("dep/mysql/include")
SET(MYSQL_FOUND TRUE)
SET(MYSQL_INCLUDE_DIR "${mysql_INCLUDE_DIR}")
SET(MYSQL_LIBRARIES "${mysql_INCLUDE_DIR}/../lib/opt/libmysql.lib")
ENDIF(NOT MYSQL_FOUND)
IF(NOT ZLIB_FOUND)
ADD_SUBDIRECTORY("dep/zlib")
SET(ZLIB_FOUND TRUE)
SET(ZLIB_INCLUDE_DIR "${zlib_INCLUDE_DIR}")
SET(ZLIB_LIBRARIES "zlib")
ENDIF(NOT ZLIB_FOUND)
ADD_SUBDIRECTORY( "dep/asio" )
SET ( ASIO_INCLUDE_DIR "${asio_INCLUDE_DIR}" )
###########################
# Generated documentation #
###########################
IF( EVEMU_DOC_ENABLE )
ADD_SUBDIRECTORY( "doc" )
ENDIF( EVEMU_DOC_ENABLE )
##################
# Targets import #
##################
IF( CMAKE_CROSSCOMPILING )
SET( EVEMU_TARGETS_IMPORT ""
CACHE FILEPATH "Path to an import script generated during a native build." )
MARK_AS_ADVANCED( EVEMU_TARGETS_IMPORT )
IF( EVEMU_TARGETS_IMPORT )
INCLUDE( "${EVEMU_TARGETS_IMPORT}" )
ENDIF( EVEMU_TARGETS_IMPORT )
ENDIF( CMAKE_CROSSCOMPILING )
################
# EVEmu source #
################
ADD_SUBDIRECTORY( "src/common" )
IF( NOT CMAKE_CROSSCOMPILING )
ADD_SUBDIRECTORY( "src/xmlpktgen" )
ENDIF( NOT CMAKE_CROSSCOMPILING )
ADD_SUBDIRECTORY( "src/eve-common" )
ADD_SUBDIRECTORY( "src/eve-server" )
IF( EVEMU_COLLECTOR_ENABLE )
ADD_SUBDIRECTORY( "src/eve-collector" )
ENDIF( EVEMU_COLLECTOR_ENABLE )
IF( EVEMU_TOOL_ENABLE )
ADD_SUBDIRECTORY( "src/eve-tool" )
ENDIF( EVEMU_TOOL_ENABLE )
##################
# Targets export #
##################
IF( NOT CMAKE_CROSSCOMPILING )
SET( EVEMU_TARGETS_EXPORT ""
CACHE FILEPATH "Path to an import script to generate (for cross-compiling)." )
MARK_AS_ADVANCED( EVEMU_TARGETS_EXPORT )
IF( EVEMU_TARGETS_EXPORT )
EXPORT( TARGETS "xmlpktgen"
FILE "${EVEMU_TARGETS_EXPORT}" )
ENDIF( EVEMU_TARGETS_EXPORT )
ENDIF( NOT CMAKE_CROSSCOMPILING )
###############
# CPack setup #
###############
SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION_SUMMARY}" )
SET( CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}" )
SET( CPACK_PACKAGE_VERSION "${PROJECT_VERSION}" )
INCLUDE( "CPack" )