[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 | # |
---|
[5695] | 19 | # |
---|
| 20 | # Author: |
---|
| 21 | # Reto Grieder |
---|
| 22 | # Description: |
---|
| 23 | # Configures the compilers and sets build options. |
---|
| 24 | # |
---|
[1505] | 25 | |
---|
[5695] | 26 | # Required macros and functions |
---|
[2710] | 27 | INCLUDE(FlagUtilities) |
---|
| 28 | |
---|
[7163] | 29 | ####### Library Behaviour (dependencies) ######## |
---|
[2710] | 30 | |
---|
[7955] | 31 | # Disable auto linking completely for Boost and POCO |
---|
[5695] | 32 | ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB") |
---|
[7955] | 33 | ADD_COMPILER_FLAGS("-DPOCO_NO_AUTOMATIC_LIBS") |
---|
[2710] | 34 | |
---|
[8351] | 35 | IF(WIN32) |
---|
| 36 | # If no defines are specified, these libs get linked statically |
---|
| 37 | ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" LINK_BOOST_DYNAMIC) |
---|
| 38 | #ADD_COMPILER_FLAGS("-DENET_DLL" LINK_ENET_DYNAMIC) |
---|
| 39 | ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" LINK_LUA5.1_DYNAMIC) |
---|
| 40 | # If no defines are specified, these libs get linked dynamically |
---|
| 41 | ADD_COMPILER_FLAGS("-DCEGUI_STATIC -DTOLUA_STATIC" NOT LINK_CEGUI_DYNAMIC) |
---|
| 42 | ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB" NOT LINK_OGRE_DYNAMIC) |
---|
| 43 | ADD_COMPILER_FLAGS("-DSTATIC_BUILD" NOT LINK_TCL_DYNAMIC) |
---|
[2710] | 44 | |
---|
[8351] | 45 | # Target Windows XP as minimum Windows version |
---|
| 46 | # And try to catch all the different macro defines for that... |
---|
[9683] | 47 | IF(MINGW) |
---|
| 48 | ADD_COMPILER_FLAGS("-D_WIN32_WINNT=0x05010000") |
---|
| 49 | ADD_COMPILER_FLAGS("-D_WIN32_WINDOWS=0x05010000") |
---|
| 50 | ADD_COMPILER_FLAGS("-DWINVER=0x05010000") |
---|
| 51 | ADD_COMPILER_FLAGS("-DNTDDI_VERSION=0x05010000") |
---|
| 52 | ELSE() |
---|
| 53 | ADD_COMPILER_FLAGS("-D_WIN32_WINNT=0x0501") |
---|
| 54 | ADD_COMPILER_FLAGS("-D_WIN32_WINDOWS=0x0501") |
---|
| 55 | ADD_COMPILER_FLAGS("-DWINVER=0x0501") |
---|
| 56 | ADD_COMPILER_FLAGS("-DNTDDI_VERSION=0x05010000") |
---|
| 57 | ENDIF() |
---|
[8351] | 58 | ENDIF(WIN32) |
---|
| 59 | |
---|
[8412] | 60 | # Visual Leak Dectector configuration |
---|
| 61 | IF(MSVC AND VLD_FOUND) |
---|
| 62 | OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" OFF) |
---|
| 63 | IF(VISUAL_LEAK_DETECTOR_ENABLE) |
---|
| 64 | # Force library linking by forcing the inclusion of a symbol |
---|
[10209] | 65 | ADD_LINKER_FLAGS("-INCLUDE:__imp_?g_vld@@3VVisualLeakDetector@@A" Debug) |
---|
[8412] | 66 | IF(MSVC90) |
---|
| 67 | # VS 2008 incremental linker crashes with /INCLUDE most of the time |
---|
| 68 | REMOVE_LINKER_FLAGS("-INCREMENTAL:YES" Debug) |
---|
| 69 | ADD_LINKER_FLAGS ("-INCREMENTAL:NO" Debug) |
---|
| 70 | ENDIF() |
---|
| 71 | ENDIF() |
---|
| 72 | ENDIF() |
---|
| 73 | |
---|
[7163] | 74 | ######### Library Behaviour (external) ########## |
---|
| 75 | |
---|
[5781] | 76 | # Use TinyXML++ |
---|
| 77 | ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP") |
---|
| 78 | |
---|
[8416] | 79 | # Default linking for externals |
---|
| 80 | IF(CMAKE_BUILD_TYPE MATCHES "(Debug|RelForDevs)") |
---|
| 81 | SET(_default_link_mode "SHARED") |
---|
| 82 | ELSE() |
---|
| 83 | SET(_default_link_mode "STATIC") |
---|
| 84 | ENDIF() |
---|
[8417] | 85 | SET(_message "Link mode for external libraries that we build ourselves. |
---|
| 86 | MSVC Note: certain libraries will not be linked shared.") |
---|
[8416] | 87 | SET(ORXONOX_EXTERNAL_LINK_MODE "${_default_link_mode}" CACHE STRING "${_message}") |
---|
[7163] | 88 | |
---|
| 89 | IF(ORXONOX_EXTERNAL_LINK_MODE STREQUAL "SHARED") |
---|
| 90 | SET(_external_shared_link TRUE) |
---|
| 91 | ELSE() |
---|
| 92 | SET(_external_shared_link FALSE) |
---|
| 93 | ENDIF() |
---|
| 94 | # If no defines are specified, these libs get linked dynamically |
---|
[7459] | 95 | ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 _external_shared_link) |
---|
[7163] | 96 | ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link) |
---|
| 97 | ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB" WIN32 NOT _external_shared_link) |
---|
| 98 | |
---|
[2710] | 99 | ############## Include Directories ############## |
---|
| 100 | |
---|
| 101 | # Set the search paths for include files |
---|
| 102 | INCLUDE_DIRECTORIES( |
---|
[8351] | 103 | # OrxonoxConfig.h |
---|
| 104 | ${CMAKE_CURRENT_BINARY_DIR} |
---|
| 105 | |
---|
| 106 | # All includes in "externals" should be prefixed with the path |
---|
| 107 | # relative to "external" to avoid conflicts |
---|
[9667] | 108 | ../src/external |
---|
[8351] | 109 | # Include directories needed even if only included by Orxonox |
---|
[9667] | 110 | ../src/external/bullet |
---|
| 111 | ../src/external/ois |
---|
[8351] | 112 | |
---|
[2710] | 113 | # External |
---|
| 114 | ${OGRE_INCLUDE_DIR} |
---|
[5781] | 115 | ${CEGUI_INCLUDE_DIR} |
---|
[8351] | 116 | ${CEGUI_TOLUA_INCLUDE_DIR} |
---|
[7459] | 117 | #${ENET_INCLUDE_DIR} |
---|
[2710] | 118 | ${Boost_INCLUDE_DIRS} |
---|
[7224] | 119 | ${POCO_INCLUDE_DIR} |
---|
[5781] | 120 | ${OPENAL_INCLUDE_DIRS} |
---|
| 121 | ${ALUT_INCLUDE_DIR} |
---|
| 122 | ${VORBIS_INCLUDE_DIR} |
---|
| 123 | ${OGG_INCLUDE_DIR} |
---|
[8351] | 124 | ${LUA5.1_INCLUDE_DIR} |
---|
[5781] | 125 | ${TCL_INCLUDE_PATH} |
---|
| 126 | ${DIRECTX_INCLUDE_DIR} |
---|
| 127 | ${ZLIB_INCLUDE_DIR} |
---|
[2710] | 128 | ) |
---|
| 129 | |
---|
[8351] | 130 | IF(CEGUI_OLD_VERSION) |
---|
| 131 | INCLUDE_DIRECTORIES(${CEGUILUA_INCLUDE_DIR}) |
---|
[5781] | 132 | ENDIF() |
---|
| 133 | |
---|
[7451] | 134 | IF (DBGHELP_FOUND) |
---|
| 135 | INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR}) |
---|
| 136 | ENDIF() |
---|
| 137 | |
---|
[8351] | 138 | ############## CEGUI OGRE Renderer ############## |
---|
| 139 | |
---|
| 140 | IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED) |
---|
| 141 | SET(CEGUI_OGRE_RENDERER_LIBRARY ogreceguirenderer_orxonox) |
---|
| 142 | ENDIF() |
---|
| 143 | |
---|
[5752] | 144 | ################### Tolua Bind ################## |
---|
| 145 | |
---|
[8729] | 146 | # Add hook script to the lua code that generates the bindings |
---|
| 147 | SET(TOLUA_PARSER_HOOK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libraries/core/ToluaInterfaceHook.lua) |
---|
| 148 | SET(TOLUA_PARSER_DEPENDENCIES ${TOLUA_PARSER_DEPENDENCIES} ${TOLUA_PARSER_HOOK_SCRIPT}) |
---|