[2710] | 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 | # |
---|
[1505] | 19 | |
---|
[2710] | 20 | ################ Various Options ################ |
---|
| 21 | |
---|
| 22 | # various macro includes |
---|
| 23 | INCLUDE(FlagUtilities) |
---|
[3196] | 24 | INCLUDE(TargetUtilities) |
---|
[2710] | 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 |
---|
[3196] | 31 | ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" ORXONOX_RELEASE) |
---|
[2710] | 32 | |
---|
| 33 | ################ OrxonoxConfig.h ################ |
---|
| 34 | |
---|
| 35 | # Check endianness |
---|
| 36 | INCLUDE(TestBigEndian) |
---|
| 37 | TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN) |
---|
| 38 | IF(NOT ORXONOX_BIG_ENDIAN) |
---|
| 39 | SET(ORXONOX_LITTLE_ENDIAN TRUE) |
---|
| 40 | ENDIF() |
---|
| 41 | |
---|
| 42 | # 32/64 bit system check |
---|
| 43 | IF(CMAKE_SIZEOF_VOID_P EQUAL 8) |
---|
| 44 | SET(ORXONOX_ARCH_64 TRUE) |
---|
| 45 | ELSE() |
---|
| 46 | SET(ORXONOX_ARCH_32 TRUE) |
---|
| 47 | ENDIF() |
---|
| 48 | |
---|
| 49 | # Platforms |
---|
| 50 | SET(ORXONOX_PLATFORM_WINDOWS ${WIN32}) |
---|
| 51 | SET(ORXONOX_PLATFORM_APPLE ${APPLE}) |
---|
| 52 | SET(ORXONOX_PLATFORM_UNIX ${UNIX}) |
---|
| 53 | IF(UNIX AND NOT APPLE) |
---|
| 54 | SET(ORXONOX_PLATFORM_LINUX TRUE) |
---|
| 55 | ENDIF() |
---|
| 56 | |
---|
| 57 | # Check __forceinline |
---|
[2724] | 58 | IF(MSVC) |
---|
| 59 | INCLUDE(CheckCXXSourceCompiles) |
---|
| 60 | SET(_source "int main() { return 0; } __forceinline void test() { return; }") |
---|
| 61 | CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE) |
---|
| 62 | ENDIF(MSVC) |
---|
[2710] | 63 | |
---|
| 64 | # Check ciso646 include (literal operators) |
---|
| 65 | INCLUDE(CheckIncludeFileCXX) |
---|
| 66 | CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H) |
---|
| 67 | |
---|
| 68 | # XCode and Visual Studio support multiple configurations. In order to tell the |
---|
| 69 | # which one we have to define the macros separately for each configuration |
---|
| 70 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug" Debug) |
---|
| 71 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release" Release) |
---|
| 72 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo) |
---|
| 73 | ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel" MinSizeRel) |
---|
| 74 | |
---|
| 75 | SET(GENERATED_FILE_COMMENT |
---|
[3196] | 76 | "DO NOT EDIT THIS FILE! <br> |
---|
[2710] | 77 | It has been automatically generated by CMake from OrxonoxConfig.h.in") |
---|
| 78 | # Copy and configure OrxonoxConfig which gets included in every file |
---|
| 79 | CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h) |
---|
| 80 | # This file only gets included by very few classes to avoid a large recompilation |
---|
| 81 | CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h) |
---|
| 82 | |
---|
[3196] | 83 | SET(ORXONOX_CONFIG_FILES |
---|
| 84 | ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h |
---|
| 85 | ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in |
---|
| 86 | ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h |
---|
| 87 | ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in |
---|
| 88 | ) |
---|
[2710] | 89 | |
---|
| 90 | ############## Include Directories ############## |
---|
| 91 | |
---|
| 92 | # Set the search paths for include files |
---|
| 93 | INCLUDE_DIRECTORIES( |
---|
| 94 | # External |
---|
| 95 | ${OGRE_INCLUDE_DIR} |
---|
| 96 | ${CEGUI_INCLUDE_DIR} |
---|
| 97 | ${ENET_INCLUDE_DIR} |
---|
| 98 | ${Boost_INCLUDE_DIRS} |
---|
| 99 | ${OPENAL_INCLUDE_DIRS} |
---|
| 100 | ${ALUT_INCLUDE_DIR} |
---|
| 101 | ${VORBIS_INCLUDE_DIR} |
---|
| 102 | ${OGG_INCLUDE_DIR} |
---|
| 103 | ${LUA_INCLUDE_DIR} |
---|
| 104 | ${TCL_INCLUDE_PATH} |
---|
| 105 | ${DIRECTX_INCLUDE_DIR} |
---|
| 106 | ${ZLIB_INCLUDE_DIR} |
---|
[3196] | 107 | ${VLD_INCLUDE_DIR} |
---|
[2710] | 108 | |
---|
| 109 | # All library includes are prefixed with the path to avoid conflicts |
---|
| 110 | ${CMAKE_CURRENT_SOURCE_DIR} |
---|
| 111 | # Bullet headers really need the include directory |
---|
| 112 | ${CMAKE_CURRENT_SOURCE_DIR}/bullet |
---|
[3084] | 113 | # OIS headers need the root dir as well |
---|
| 114 | ${CMAKE_CURRENT_SOURCE_DIR}/ois |
---|
[2710] | 115 | # Convenience directory |
---|
| 116 | ${CMAKE_CURRENT_SOURCE_DIR}/orxonox |
---|
| 117 | # OrxonoxConfig.h |
---|
| 118 | ${CMAKE_CURRENT_BINARY_DIR} |
---|
| 119 | # Tolua bind files for Core |
---|
| 120 | ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR} |
---|
| 121 | # Tolua bind files for Orxonox |
---|
| 122 | ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR} |
---|
| 123 | ) |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | ################ Sub Directories ################ |
---|
| 127 | |
---|
| 128 | # Third party libraries |
---|
[1505] | 129 | ADD_SUBDIRECTORY(tolua) |
---|
| 130 | |
---|
[2710] | 131 | # Include CEGUILua if not requested otherwise |
---|
| 132 | IF(CEGUILUA_USE_INTERNAL_LIBRARY) |
---|
| 133 | IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION}) |
---|
| 134 | MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!") |
---|
| 135 | ENDIF() |
---|
[1854] | 136 | |
---|
[2710] | 137 | INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION}) |
---|
| 138 | ADD_SUBDIRECTORY(ceguilua) |
---|
| 139 | ENDIF() |
---|
[1810] | 140 | |
---|
[2710] | 141 | ADD_SUBDIRECTORY(bullet) |
---|
| 142 | ADD_SUBDIRECTORY(cpptcl) |
---|
| 143 | ADD_SUBDIRECTORY(ogreceguirenderer) |
---|
| 144 | ADD_SUBDIRECTORY(ois) |
---|
| 145 | ADD_SUBDIRECTORY(tinyxml) |
---|
[1810] | 146 | |
---|
[2710] | 147 | # Orxonox code |
---|
[1505] | 148 | ADD_SUBDIRECTORY(util) |
---|
| 149 | ADD_SUBDIRECTORY(core) |
---|
| 150 | ADD_SUBDIRECTORY(network) |
---|
| 151 | ADD_SUBDIRECTORY(orxonox) |
---|