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