1 | # |
---|
2 | # ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | # > www.orxonox.net < |
---|
4 | # |
---|
5 | # This program is free software; you can redistribute it and/or |
---|
6 | # modify it under the terms of the GNU General Public License |
---|
7 | # as published by the Free Software Foundation; either version 2 |
---|
8 | # of the License, or (at your option) any later version. |
---|
9 | # |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU General Public License for more details. |
---|
14 | # |
---|
15 | # You should have received a copy of the GNU General Public License along |
---|
16 | # with this program; if not, write to the Free Software Foundation, |
---|
17 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
18 | # |
---|
19 | |
---|
20 | ################ Various Options ################ |
---|
21 | |
---|
22 | # various macro includes |
---|
23 | INCLUDE(FlagUtilities) |
---|
24 | INCLUDE(TargetUtilities) |
---|
25 | |
---|
26 | # Use TinyXML++ |
---|
27 | ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP") |
---|
28 | # OIS dynamic linking requires macro definition, at least for Windows |
---|
29 | ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB") |
---|
30 | # Tolua binding speedup if required |
---|
31 | ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" ORXONOX_RELEASE) |
---|
32 | |
---|
33 | # Default linking is SHARED |
---|
34 | SET(ORXONOX_DEFAULT_LINK SHARED) |
---|
35 | |
---|
36 | ################ OrxonoxConfig.h ################ |
---|
37 | |
---|
38 | # Check endianness |
---|
39 | INCLUDE(TestBigEndian) |
---|
40 | TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN) |
---|
41 | IF(NOT ORXONOX_BIG_ENDIAN) |
---|
42 | SET(ORXONOX_LITTLE_ENDIAN TRUE) |
---|
43 | ENDIF() |
---|
44 | |
---|
45 | # 32/64 bit system check |
---|
46 | IF(CMAKE_SIZEOF_VOID_P EQUAL 8) |
---|
47 | SET(ORXONOX_ARCH_64 TRUE) |
---|
48 | ELSE() |
---|
49 | SET(ORXONOX_ARCH_32 TRUE) |
---|
50 | ENDIF() |
---|
51 | |
---|
52 | # Platforms |
---|
53 | SET(ORXONOX_PLATFORM_WINDOWS ${WIN32}) |
---|
54 | SET(ORXONOX_PLATFORM_APPLE ${APPLE}) |
---|
55 | SET(ORXONOX_PLATFORM_UNIX ${UNIX}) |
---|
56 | IF(UNIX AND NOT APPLE) |
---|
57 | SET(ORXONOX_PLATFORM_LINUX TRUE) |
---|
58 | ENDIF() |
---|
59 | |
---|
60 | # Check __forceinline |
---|
61 | IF(MSVC) |
---|
62 | INCLUDE(CheckCXXSourceCompiles) |
---|
63 | SET(_source "int main() { return 0; } __forceinline void test() { return; }") |
---|
64 | CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE) |
---|
65 | ENDIF(MSVC) |
---|
66 | |
---|
67 | # Check ciso646 include (literal operators) |
---|
68 | INCLUDE(CheckIncludeFileCXX) |
---|
69 | CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H) |
---|
70 | |
---|
71 | # XCode and Visual Studio support multiple configurations. In order to tell the |
---|
72 | # which one we have to define the macros separately for each configuration |
---|
73 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug" Debug) |
---|
74 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release" Release) |
---|
75 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo) |
---|
76 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel" MinSizeRel) |
---|
77 | |
---|
78 | SET(GENERATED_FILE_COMMENT |
---|
79 | "DO NOT EDIT THIS FILE! <br> |
---|
80 | It has been automatically generated by CMake from OrxonoxConfig.h.in") |
---|
81 | # Copy and configure OrxonoxConfig which gets included in every file |
---|
82 | CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h) |
---|
83 | # This file only gets included by very few classes to avoid a large recompilation |
---|
84 | CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h) |
---|
85 | |
---|
86 | SET(ORXONOX_CONFIG_FILES |
---|
87 | ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h |
---|
88 | ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in |
---|
89 | ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h |
---|
90 | ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in |
---|
91 | ) |
---|
92 | |
---|
93 | ############## Include Directories ############## |
---|
94 | |
---|
95 | # Set the search paths for include files |
---|
96 | INCLUDE_DIRECTORIES( |
---|
97 | # External |
---|
98 | ${OGRE_INCLUDE_DIR} |
---|
99 | ${CEGUI_INCLUDE_DIR} |
---|
100 | ${ENET_INCLUDE_DIR} |
---|
101 | ${Boost_INCLUDE_DIRS} |
---|
102 | ${OPENAL_INCLUDE_DIRS} |
---|
103 | ${ALUT_INCLUDE_DIR} |
---|
104 | ${VORBIS_INCLUDE_DIR} |
---|
105 | ${OGG_INCLUDE_DIR} |
---|
106 | ${LUA_INCLUDE_DIR} |
---|
107 | ${TCL_INCLUDE_PATH} |
---|
108 | ${DIRECTX_INCLUDE_DIR} |
---|
109 | ${ZLIB_INCLUDE_DIR} |
---|
110 | ${VLD_INCLUDE_DIR} |
---|
111 | |
---|
112 | # All library includes are prefixed with the path to avoid conflicts |
---|
113 | ${CMAKE_CURRENT_SOURCE_DIR} |
---|
114 | # Bullet headers really need the include directory |
---|
115 | ${CMAKE_CURRENT_SOURCE_DIR}/bullet |
---|
116 | # OIS headers need the root dir as well |
---|
117 | ${CMAKE_CURRENT_SOURCE_DIR}/ois |
---|
118 | # Convenience directory |
---|
119 | ${CMAKE_CURRENT_SOURCE_DIR}/orxonox |
---|
120 | # OrxonoxConfig.h |
---|
121 | ${CMAKE_CURRENT_BINARY_DIR} |
---|
122 | # Tolua bind files for Core |
---|
123 | ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR} |
---|
124 | # Tolua bind files for Orxonox |
---|
125 | ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR} |
---|
126 | ) |
---|
127 | |
---|
128 | |
---|
129 | ################ Sub Directories ################ |
---|
130 | |
---|
131 | # Third party libraries |
---|
132 | ADD_SUBDIRECTORY(tolua) |
---|
133 | |
---|
134 | # Include CEGUILua if not requested otherwise |
---|
135 | IF(CEGUILUA_USE_INTERNAL_LIBRARY) |
---|
136 | IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION}) |
---|
137 | MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!") |
---|
138 | ENDIF() |
---|
139 | |
---|
140 | INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION}) |
---|
141 | ADD_SUBDIRECTORY(ceguilua) |
---|
142 | ENDIF() |
---|
143 | |
---|
144 | ADD_SUBDIRECTORY(bullet) |
---|
145 | ADD_SUBDIRECTORY(cpptcl) |
---|
146 | ADD_SUBDIRECTORY(ogreceguirenderer) |
---|
147 | ADD_SUBDIRECTORY(ois) |
---|
148 | ADD_SUBDIRECTORY(tinyxml) |
---|
149 | |
---|
150 | # Orxonox code |
---|
151 | ADD_SUBDIRECTORY(util) |
---|
152 | ADD_SUBDIRECTORY(core) |
---|
153 | ADD_SUBDIRECTORY(network) |
---|
154 | ADD_SUBDIRECTORY(orxonox) |
---|