Skip to content
Newer
Older
100644 212 lines (176 sloc) 5.73 KB
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 18, 2010
1 project(Trinity)
1edf80d *Fixed version required by cmakes. - by raczman
Blaymoira authored Jan 18, 2009
2 cmake_minimum_required(VERSION 2.6)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
3 cmake_policy(SET CMP0005 OLD)
4
229dbd8 Added check for ace/Stack_Trace.h header file,
raczman authored Jun 29, 2009
5 include(CheckIncludeFiles)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
6 include(cmake/FindAce.cmake)
7 include(cmake/FindMySql.cmake)
c172576 Include macro to find readline library(only on unix), and if not foun…
Kudlaty authored Jul 24, 2009
8 include(cmake/FindReadline.cmake)
b6e694a Add macro for finding Termcap with cmake, and some cleaning about rea…
Kudlaty authored Sep 6, 2009
9 include(cmake/FindTermcap.cmake)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
10 include(cmake/PCH.cmake)
11
12 # Force out-of-source build
13 string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE)
14 if(BUILDING_IN_SOURCE)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
15 message(FATAL_ERROR "This project requires an out of source build. Remove the file 'CMakeCache.txt' found in this directory before continuing, and create a separate build directory and run 'cmake path_to_project [options]' from there.")
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
16 endif(BUILDING_IN_SOURCE)
17
18 # Select the Release build configuration by default.
19 if(NOT CMAKE_BUILD_TYPE)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
20 set(CMAKE_BUILD_TYPE "Release")
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
21 endif(NOT CMAKE_BUILD_TYPE)
22
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
23 CONFIGURE_FILE(
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
24 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
25 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
26 IMMEDIATE @ONLY)
27
28 add_custom_target(uninstall
29 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
30 )
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
31
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
32 option(CENTOS "CENTOS" 0)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
33 option(DO_CLI "With CLI" 1)
34 option(DO_DEBUG "Debug mode" 0)
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
35 option(DO_MYSQL "With MySQL support" 1)
02efe02 @runningnak3d * Added missing include paths that got lost in the merge a few revs ago
runningnak3d authored Jun 9, 2010
36 option(DO_PCH "Use precompiled headers" 1)
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
37 option(DO_RA "With RA" 0)
02efe02 @runningnak3d * Added missing include paths that got lost in the merge a few revs ago
runningnak3d authored Jun 9, 2010
38 option(DO_SCRIPTS "With trinityscripts" 1)
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
39 option(DO_SQL "Copy SQL files" 0)
e548d60 Initial DO_TOOLS support for cmake
Tartalo authored Jun 6, 2010
40 option(DO_TOOLS "Compile tools" 0)
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
41 option(DO_WARN "Enable all compile warnings" 0)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
42
43 set(GENREV_SRC
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
44 src/genrevision/genrevision.cpp
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
45 )
46
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
47 if(DO_DEBUG)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
48 add_executable(genrev
dc6f2cd @Paradox Adds Debug or Release to the Full Revision string, fully tested under…
Paradox authored Dec 14, 2009
49 ${GENREV_SRC}
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
50 )
51 add_custom_target("revision.h" ALL
52 COMMAND "${CMAKE_BINARY_DIR}/genrev"
53 ${CMAKE_SOURCE_DIR}
54 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared"
55 DEPENDS genrev
56 )
dc6f2cd @Paradox Adds Debug or Release to the Full Revision string, fully tested under…
Paradox authored Dec 14, 2009
57 else (DO_DEBUG)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
58 add_executable(genrev
dc6f2cd @Paradox Adds Debug or Release to the Full Revision string, fully tested under…
Paradox authored Dec 14, 2009
59 ${GENREV_SRC}
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
60 )
61 add_custom_target("revision.h" ALL
62 COMMAND "${CMAKE_BINARY_DIR}/genrev"
63 ${CMAKE_SOURCE_DIR}
64 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared"
65 DEPENDS genrev
66 )
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
67 endif(DO_DEBUG)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
68
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
69 execute_process(
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
70 COMMAND hg tip --template {rev}
71 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
72 OUTPUT_VARIABLE HG_REVISION
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
73 )
74
90ba30c @runningnak3d * Changed TrinityCore2 to TrinityCore. There is no TrinityCore2 anymore.
runningnak3d authored Feb 15, 2010
75 message("* TrinityCore revision: ${HG_REVISION}")
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
76
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
77 if(PREFIX)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
78 set(CMAKE_INSTALL_PREFIX ${PREFIX})
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
79 endif(PREFIX)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
80
81 if(CONF_DIR)
82
83 else(CONF_DIR)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
84 set(CONF_DIR ${PREFIX}/etc)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
85 endif(CONF_DIR)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
86
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
87 set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
88
89 message("* Will install to: ${CMAKE_INSTALL_PREFIX}")
90 message("* With config dir at: ${CONF_DIR}")
44d419e @panaut0lordv Cmake - more handy lib install dir.
panaut0lordv authored Jan 28, 2009
91 message("* Libs install dir at: ${LIBSDIR}")
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
92
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
93 find_library(SSLLIB NAMES ssl DOC "SSL library")
94 find_library(ZLIB z "Zlib library")
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
95
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
96 if(DO_MYSQL)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
97 message("* With MySQL")
98 FIND_MYSQL()
99 ADD_DEFINITIONS(-DDO_MYSQL)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
100 endif(DO_MYSQL)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
101
ce62022 restore work scripts in *nix system
win32 authored Jan 21, 2010
102 if(DO_SCRIPTS)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
103 message("* With Trinity Scripts")
104 ADD_DEFINITIONS(-DDO_SCRIPTS)
105 add_definitions(-D_TRINITY_SCRIPT_CONFIG='"${CONF_DIR}/trinitycore.conf"')
ce62022 restore work scripts in *nix system
win32 authored Jan 21, 2010
106 else (DO_SCRIPTS)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
107 message("* Without Trinity Scripts")
ce62022 restore work scripts in *nix system
win32 authored Jan 21, 2010
108 endif(DO_SCRIPTS)
109
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
110 message("-- Miscellaneus options:")
111
112 if(DO_CLI)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
113 message("* With CLI")
114 add_definitions(-DENABLE_CLI)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
115 else (DO_CLI)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
116 message(* Without CLI)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
117 endif(DO_CLI)
118
119 if(DO_RA)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
120 message("* With RA")
121 add_definitions(-DENABLE_RA)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
122 else(DO_RA)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
123 message("* Without RA")
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
124 endif(DO_RA)
125
126 if(DO_DEBUG)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
127 message("* Debug mode ON")
128 add_definitions(-g -DTRINITY_DEBUG)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
129 endif(DO_DEBUG)
130
ced575a * Added DO_WARN (-DDO_WARN=1) option to CMake. This can help find/rem…
XTZGZoReX authored Mar 18, 2009
131 if(DO_WARN)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
132 message("* All warnings mode")
133 add_definitions(-Wall -Wfatal-errors -Wextra)
ced575a * Added DO_WARN (-DDO_WARN=1) option to CMake. This can help find/rem…
XTZGZoReX authored Mar 18, 2009
134 endif(DO_WARN)
135
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
136 if(DO_SQL)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
137 message("* Installing SQL files")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
138 else (DO_SQL)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
139 message("* NOT installing SQL files")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
140 endif(DO_SQL)
141
142 if(DO_PCH)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
143 message("* Using precompiled headers")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
144 else (DO_PCH)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
145 message("* NOT using precompiled headers")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
146 endif(DO_PCH)
147
148 if(DO_TOOLS)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
149 message("* With Tools")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
150 else (DO_TOOLS)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
151 message("* Without Tools")
a54624f Add some messages to main cmake file
Tartalo authored Jun 7, 2010
152 endif(DO_TOOLS)
153
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
154 if(UNIX)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
155 if(CENTOS)
156 add_definitions(-DCENTOS)
157 message("* Building with termcap")
158 FIND_TERMCAP()
159 else(CENTOS)
160 message("* Building with readline")
161 FIND_READLINE()
162 endif(CENTOS)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
163 endif(UNIX)
7604902 @panaut0lordv CentOS users - please use -DCENTOS=1, as termcap for everyone causes …
panaut0lordv authored Jun 19, 2009
164
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
165 FIND_ACE(ACE)
166 if(ACE_FOUND)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
167 message(STATUS "Found ACE library: ${ACE_LIBRARY}")
168 message(STATUS "Include dir is: ${ACE_INCLUDE_DIR}")
1edf80d *Fixed version required by cmakes. - by raczman
Blaymoira authored Jan 18, 2009
169 else(ACE_FOUND)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
170 message(SEND_ERROR "** ACE library not found! Trinity Core cannot be compiled!")
171 message(SEND_ERROR "** Please build ACE from http://www.cs.wustl.edu/~schmidt/ACE.html")
172 #For now remove msg about install from repo, as ubuntu/debian don't have needed ver in repos.
173 #message(SEND_ERROR "** your distro may provide a binary for ACE e.g. for ubuntu try apt-get install libace-dev")
174 return()
175 #set(BUILD_ACE 1)
176 #set(ACE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/dep/ACE_wrappers ${CMAKE_BINARY_DIR}/dep/ACE_wrappers")
177 #set(ACE_LIBRARY ACE)
178 #message(STATUS "I will try to build ACE from: ${ACE_INCLUDE_DIR}")
179 #message(STATUS "And link using: ${ACE_LIBRARY}")
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
180 endif(ACE_FOUND)
181
d36a479 Fix msg about have out of date ace lib, also some cosmetic change
Kudlaty authored Jul 25, 2009
182 #somehow line below don't work. so for now change it to if exist
183 #check_include_files(${ACE_INCLUDE_DIR}/ace/Stack_Trace.h HAVE_ACE_STACK_TRACE_H)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
184 if(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
185 set(HAVE_ACE_STACK_TRACE_H 1)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
186 else(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
187 message(STATUS "** Your libace is out of date. Please update your libace!")
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
188 endif(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h)
d36a479 Fix msg about have out of date ace lib, also some cosmetic change
Kudlaty authored Jul 25, 2009
189
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
190 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
191
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
192 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
193 set(MACOSX 1)
194 set(OSX_LIBS /opt/local/lib/libcrypto.dylib)
6f7c53b fix cmake/ACE for freeBSD and Mac OSX
raczman authored Feb 20, 2009
195 add_definitions(-D__ASSERTMACROS__)
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
196 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
6f7c53b fix cmake/ACE for freeBSD and Mac OSX
raczman authored Feb 21, 2009
197
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
198 add_definitions(--no-warnings) #to make build look nice, no gcc nazi warnings.
199
d607693 Add proper use of precompiled headers on linux - this removes an appr…
click authored May 17, 2010
200 set(CMAKE_SKIP_BUILD_RPATH FALSE)
201 set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
202 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
203 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
0dd0a1c More fixes for Cmake by raczman
KingPin authored Jan 18, 2009
204
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
205 add_subdirectory(externals)
09ddc71 Cmake build system for trinity
raczman authored Jan 17, 2009
206 add_subdirectory(src)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
207
873f8d0 * New -DDO_SQL swich for cmake by default disabled to avoid usual not
runningnak3d authored Apr 13, 2010
208 if(DO_SQL)
f867f6d Get g3dlib, zlib and jemalloc to build again
click authored Jun 8, 2010
209 message("* Copy SQL files ON")
210 add_subdirectory(sql)
873f8d0 * New -DDO_SQL swich for cmake by default disabled to avoid usual not
runningnak3d authored Apr 13, 2010
211 endif(DO_SQL)
Something went wrong with that request. Please try again.