[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 | # |
---|
[5664] | 19 | # |
---|
| 20 | # Author: |
---|
| 21 | # Reto Grieder |
---|
| 22 | # Description: |
---|
| 23 | # Configures the header files OrxonoxConfig.h and SpecialConfig.h |
---|
| 24 | # and sets some other options. All the build related options should be |
---|
| 25 | # found and set here if possible. |
---|
| 26 | # |
---|
[1505] | 27 | |
---|
[5664] | 28 | #################### Options #################### |
---|
[2710] | 29 | |
---|
[5664] | 30 | # Use, i.e. don't skip the full RPATH for the build tree |
---|
| 31 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) |
---|
[2710] | 32 | |
---|
[5664] | 33 | # Global switch to disable Precompiled Header Files |
---|
[8071] | 34 | # Note: PCH temporarily disabled on Mac because of severe problems |
---|
| 35 | IF(PCH_COMPILER_SUPPORT AND NOT APPLE) |
---|
[5664] | 36 | OPTION(PCH_ENABLE "Global PCH switch" TRUE) |
---|
| 37 | ENDIF() |
---|
[2710] | 38 | |
---|
[5929] | 39 | # Global switch to disable multiple file compilations |
---|
| 40 | OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE) |
---|
| 41 | |
---|
[5664] | 42 | # Use WinMain() or main()? |
---|
| 43 | IF(WIN32) |
---|
| 44 | OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE) |
---|
| 45 | ENDIF() |
---|
| 46 | |
---|
| 47 | ################ Platform Config ################ |
---|
| 48 | |
---|
[2710] | 49 | # Check endianness |
---|
| 50 | INCLUDE(TestBigEndian) |
---|
| 51 | TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN) |
---|
| 52 | IF(NOT ORXONOX_BIG_ENDIAN) |
---|
| 53 | SET(ORXONOX_LITTLE_ENDIAN TRUE) |
---|
| 54 | ENDIF() |
---|
| 55 | |
---|
| 56 | # Platforms |
---|
| 57 | SET(ORXONOX_PLATFORM_WINDOWS ${WIN32}) |
---|
| 58 | SET(ORXONOX_PLATFORM_APPLE ${APPLE}) |
---|
| 59 | SET(ORXONOX_PLATFORM_UNIX ${UNIX}) |
---|
| 60 | IF(UNIX AND NOT APPLE) |
---|
| 61 | SET(ORXONOX_PLATFORM_LINUX TRUE) |
---|
| 62 | ENDIF() |
---|
| 63 | |
---|
| 64 | # Check __forceinline |
---|
[2724] | 65 | IF(MSVC) |
---|
| 66 | INCLUDE(CheckCXXSourceCompiles) |
---|
| 67 | SET(_source "int main() { return 0; } __forceinline void test() { return; }") |
---|
| 68 | CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE) |
---|
| 69 | ENDIF(MSVC) |
---|
[2710] | 70 | |
---|
[8073] | 71 | # Check some non standard system includes |
---|
[2710] | 72 | INCLUDE(CheckIncludeFileCXX) |
---|
| 73 | CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H) |
---|
[8073] | 74 | CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H) |
---|
[2710] | 75 | |
---|
[8073] | 76 | # Part of a woraround for OS X warnings. See OrxonoxConfig.h.in |
---|
| 77 | SET(ORX_HAVE_STDINT_H ${HAVE_STDINT_H}) |
---|
| 78 | |
---|
[7818] | 79 | IF(MSVC) |
---|
| 80 | # Check whether we can use Visual Leak Detector |
---|
| 81 | FIND_FILE(VLD_DLL vld_x86.dll) |
---|
| 82 | IF(VLD_DLL) |
---|
| 83 | SET(HAVE_VLD TRUE) |
---|
| 84 | OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off) |
---|
| 85 | # Make sure the value is "on" or "off" for vld.ini |
---|
| 86 | IF(VISUAL_LEAK_DETECTOR_ENABLE) |
---|
| 87 | SET(VISUAL_LEAK_DETECTOR_ENABLE on) |
---|
| 88 | ELSE() |
---|
| 89 | SET(VISUAL_LEAK_DETECTOR_ENABLE off) |
---|
| 90 | ENDIF() |
---|
| 91 | ENDIF() |
---|
| 92 | MARK_AS_ADVANCED(VLD_DLL) |
---|
| 93 | ENDIF() |
---|
| 94 | |
---|
[5664] | 95 | ############## Configured Headers ############### |
---|
| 96 | |
---|
[2710] | 97 | SET(GENERATED_FILE_COMMENT |
---|
[3196] | 98 | "DO NOT EDIT THIS FILE! <br> |
---|
[2710] | 99 | It has been automatically generated by CMake from OrxonoxConfig.h.in") |
---|
| 100 | # Copy and configure OrxonoxConfig which gets included in every file |
---|
| 101 | CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h) |
---|
| 102 | # This file only gets included by very few classes to avoid a large recompilation |
---|
| 103 | CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h) |
---|
| 104 | |
---|
[3196] | 105 | SET(ORXONOX_CONFIG_FILES |
---|
| 106 | ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in |
---|
| 107 | ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in |
---|
| 108 | ) |
---|
[7980] | 109 | SET(ORXONOX_CONFIG_FILES_GENERATED |
---|
| 110 | ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h |
---|
| 111 | ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h |
---|
| 112 | ) |
---|
[8233] | 113 | |
---|
| 114 | # Make special target including the configured header files for Visual Studio |
---|
| 115 | IF(MSVC) |
---|
| 116 | ADD_CUSTOM_TARGET(config |
---|
| 117 | SOURCES |
---|
| 118 | ${ORXONOX_CONFIG_FILES} |
---|
| 119 | ${ORXONOX_CONFIG_FILES_GENERATED} |
---|
| 120 | ) |
---|
| 121 | ENDIF() |
---|