-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
187 lines (160 loc) · 5.82 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
# MaNGOS is a full featured server for World of Warcraft, supporting
# the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
#
# Copyright (C) 2005-2017 MaNGOS project <https://getmangos.eu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
set(EXECUTABLE_NAME mangosd)
#Main Files
file(GLOB SRC_GRP_MAIN *.cpp *.h)
source_group("Main" FILES ${SRC_GRP_MAIN})
#Command Line Files
file(GLOB SRC_GRP_COMM Comm/*.cpp Comm/*.h)
source_group("Command Line" FILES ${SRC_GRP_COMM})
#Remote Access Files
file(GLOB SRC_GRP_RA RA/*.cpp RA/*.h)
source_group("Remote Access" FILES ${SRC_GRP_RA})
set(EXECUTABLE_SRCS
${SRC_GRP_COMM}
${SRC_GRP_RA}
${SRC_GRP_MAIN}
)
if(SOAP)
file(GLOB SRC_GRP_SOAP SOAP/*.cpp SOAP/*.h)
source_group("SOAP" FILES ${SRC_GRP_SOAP})
LIST(APPEND EXECUTABLE_SRCS ${SRC_GRP_SOAP})
endif()
if(WIN32)
# add resource file to windows build
set(EXECUTABLE_SRCS ${EXECUTABLE_SRCS} mangosd.rc)
endif()
include_directories(
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/shared/Common
${CMAKE_SOURCE_DIR}/src/shared/Threading
${CMAKE_SOURCE_DIR}/src/shared/Utilities
${CMAKE_SOURCE_DIR}/src/shared/Log
${CMAKE_SOURCE_DIR}/src/shared/DataStores
${CMAKE_SOURCE_DIR}/src/shared/Win
${CMAKE_SOURCE_DIR}/src/shared/Linux
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_SOURCE_DIR}/src/game/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/game/BattleGround
${CMAKE_SOURCE_DIR}/src/game/Server
${CMAKE_SOURCE_DIR}/src/game/WorldHandlers
${CMAKE_SOURCE_DIR}/src/game/Maps
${CMAKE_SOURCE_DIR}/src/game/Object
${CMAKE_SOURCE_DIR}/src/game/Tools
${CMAKE_SOURCE_DIR}/src/game/References
${CMAKE_SOURCE_DIR}/src/game/MotionGenerators
${CMAKE_SOURCE_DIR}/src/game/vmap
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/shared
${ACE_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
if(PLAYERBOTS)
include_directories(
${CMAKE_SOURCE_DIR}/src/modules/Bots/playerbot
${CMAKE_SOURCE_DIR}/src/modules/Bots/ahbot
)
endif()
if(SCRIPT_LIB_ELUNA)
include_directories(${CMAKE_SOURCE_DIR}/src/modules/Eluna)
include_directories(${CMAKE_SOURCE_DIR}/dep/lualib)
endif()
if(SCRIPT_LIB_SD3)
include_directories(${CMAKE_SOURCE_DIR}/src/modules/SD3)
endif()
if(SOAP)
include_directories(${CMAKE_SOURCE_DIR}/dep/gsoap)
endif()
add_executable(${EXECUTABLE_NAME} ${EXECUTABLE_SRCS})
if(NOT ACE_USE_EXTERNAL)
add_dependencies(${EXECUTABLE_NAME} ace)
target_link_libraries(${EXECUTABLE_NAME} ace)
else()
target_link_libraries(${EXECUTABLE_NAME} ACE)
endif()
target_link_libraries(${EXECUTABLE_NAME}
game
shared
framework
g3dlite
${OPENSSL_LIBRARIES}
)
if(POSTGRESQL)
include_directories(${PostgreSQL_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${PostgreSQL_LIBRARIES})
else()
include_directories(${MYSQL_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${MYSQL_LIBRARY})
endif()
add_dependencies(${EXECUTABLE_NAME} game)
if(SOAP)
target_link_libraries(${EXECUTABLE_NAME} gsoap)
endif()
if(WIN32)
target_link_libraries(${EXECUTABLE_NAME} zlib)
endif()
if(UNIX)
target_link_libraries(${EXECUTABLE_NAME}
${OPENSSL_EXTRA_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
set(EXECUTABLE_LINK_FLAGS "")
if(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(EXECUTABLE_LINK_FLAGS "-Wl,--no-as-needed -pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(EXECUTABLE_LINK_FLAGS "-Wl,--no-as-needed -ldl -pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
endif()
endif()
if(APPLE)
set(EXECUTABLE_LINK_FLAGS "-framework Carbon ${EXECUTABLE_LINK_FLAGS}")
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${EXECUTABLE_LINK_FLAGS}")
install(TARGETS ${EXECUTABLE_NAME} DESTINATION "${BIN_DIR}")
#if defined(CLASSIC)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mangos0.conf.dist.in ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist)
#elseif defined(TBC)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mangos1.conf.dist.in ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist)
#elseif defined(WOTLK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mangos2.conf.dist.in ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist)
#elseif defined(CATA)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mangos3.conf.dist.in ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist)
#endif
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist DESTINATION ${CONF_INSTALL_DIR})
if(WIN32 AND MSVC)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/\${BUILD_TYPE}/${EXECUTABLE_NAME}.pdb" DESTINATION "${BIN_DIR}" CONFIGURATIONS Debug)
add_custom_command(TARGET ${EXECUTABLE_NAME}
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/mangosd.conf.dist" "${CONF_COPY_DIR}"
)
endif()
#Copy dlls to build dir
if(WIN32)
if(MSVC)
add_custom_command(TARGET ${EXECUTABLE_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${MYSQL_LIBRARY}" "${CMAKE_BINARY_DIR}/bin/$(Configuration)/"
)
elseif(XCODE)
add_custom_command(TARGET ${EXECUTABLE_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${MYSQL_LIBRARY}" "${CMAKE_BINARY_DIR}/bin/"
)
endif()
endif()