forked from mangosR2/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
143 lines (125 loc) · 4.13 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
#
# Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
#
# 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
#
## magic to include revision data in SD2 version string
# revision.h: FORCE
# $(top_builddir)/src/tools/genrevision/genrevision $(srcdir)
file(GLOB_RECURSE mangosscript_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.h)
source_group("Other"
REGULAR_EXPRESSION .*
)
foreach(SRC ${mangosscript_SRCS})
get_filename_component(PTH ${SRC} PATH)
if(PTH)
if(NOT XCODE) # FIXME: Xcode Generator has bug with nested dirs
string(REPLACE "/" "\\\\" PTH ${PTH})
endif()
source_group(${PTH} FILES ${SRC})
endif()
endforeach(SRC)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/base
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_SOURCE_DIR}/src/framework
${CMAKE_SOURCE_DIR}/src/game
${CMAKE_SOURCE_DIR}/dep/include
${CMAKE_BINARY_DIR}
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
)
if(PCH)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
endif()
add_library(mangosscriptR2 SHARED
${mangosscript_SRCS}
)
if(WIN32)
target_link_libraries(mangosscriptR2
mangosd # FIXME: could this be done for unix? because unix won't generate exe.libs
${ACE_LIBRARIES}
debug ${WIN_DEBUGLIBS}
)
endif()
add_dependencies(mangosscriptR2 revision.h)
if(NOT ACE_USE_EXTERNAL)
add_dependencies(mangosscriptR2 ACE_Project)
# add_dependencies(mangosscriptR2 ace)
endif()
if(UNIX)
set(mangosscript_LINK_FLAGS "-pthread")
if(APPLE)
set(mangosscript_LINK_FLAGS "-framework Carbon ${mangosscript_LINK_FLAGS}")
# Needed for the linking because of the missing symbols
set(mangosscript_LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup ${mangosscript_LINK_FLAGS}")
endif()
if(APPLE)
set(mangosscript_PROPERTIES INSTALL_NAME_DIR "${LIBS_DIR}")
else()
set(mangosscript_PROPERTIES INSTALL_RPATH ${LIBS_DIR})
endif()
# Run out of build tree
set(mangosscript_PROPERTIES
${mangosscript_PROPERTIES}
BUILD_WITH_INSTALL_RPATH OFF
)
set_target_properties(mangosscriptR2 PROPERTIES
LINK_FLAGS ${mangosscript_LINK_FLAGS}
${mangosscript_PROPERTIES}
)
endif()
# Because size for linker is to big - seriously ?!
if(WIN32)
set_target_properties(mangosscriptR2 PROPERTIES
LINK_FLAGS_DEBUG "/DEBUG /INCREMENTAL:NO"
)
endif()
## libtool settings
# API versioning
# Link against dependencies
# How to increase version info:
# - only bug fixes implemented:
# bump the version to LTMANGOS_CURRENT:LTMANGOS_REVISION+1:LTMANGOS_AGE
# - augmented the interface:
# bump the version to LTMANGOS_CURRENT+1:0:LTMANGOS_AGE+1
# - broken old interface:
# bump the version to LTMANGOS_CURRENT+1:0:0
# set(LTMANGOS_CURRENT 0)
# set(LTMANGOS_REVISION 0)
# set(LTMANGOS_AGE 0)
# set_target_properties(script PROPERTIES LINK_FLAGS
# "-version-info ${LTMANGOS_CURRENT}:${LTMANGOS_REVISION}:${LTMANGOS_AGE}"
# )
# Generate precompiled header
if(PCH)
if(MSVC OR XCODE)
if(MSVC)
set(mangosscript_pch "${CMAKE_CURRENT_SOURCE_DIR}/include/precompiled.cpp")
endif()
add_native_precompiled_header(mangosscriptR2 ${CMAKE_CURRENT_SOURCE_DIR}/include/precompiled.h)
elseif(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(mangosscriptR2 ${CMAKE_CURRENT_SOURCE_DIR}/include/precompiled.h)
endif()
endif()
# LIBRARY = dyld / so, RUNTIME = dll
install(TARGETS mangosscriptR2
LIBRARY DESTINATION ${LIBS_DIR}
RUNTIME DESTINATION ${LIBS_DIR}
)
install(FILES scriptdev2.conf.dist.in DESTINATION ${CONF_DIR} RENAME scriptdev2.conf.dist)