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 | # 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 | # |
---|
27 | |
---|
28 | #################### Options #################### |
---|
29 | |
---|
30 | # Use, i.e. don't skip the full RPATH for the build tree |
---|
31 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) |
---|
32 | |
---|
33 | # Global switch to disable Precompiled Header Files |
---|
34 | IF(PCH_COMPILER_SUPPORT) |
---|
35 | OPTION(PCH_ENABLE "Global PCH switch" TRUE) |
---|
36 | ENDIF() |
---|
37 | |
---|
38 | # Global switch to disable multiple file compilations |
---|
39 | OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE) |
---|
40 | |
---|
41 | # Use WinMain() or main()? |
---|
42 | IF(WIN32) |
---|
43 | OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE) |
---|
44 | ENDIF() |
---|
45 | |
---|
46 | ################ Platform Config ################ |
---|
47 | |
---|
48 | # Check endianness |
---|
49 | INCLUDE(TestBigEndian) |
---|
50 | TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN) |
---|
51 | IF(NOT ORXONOX_BIG_ENDIAN) |
---|
52 | SET(ORXONOX_LITTLE_ENDIAN TRUE) |
---|
53 | ENDIF() |
---|
54 | |
---|
55 | # Platforms |
---|
56 | SET(ORXONOX_PLATFORM_WINDOWS ${WIN32}) |
---|
57 | SET(ORXONOX_PLATFORM_APPLE ${APPLE}) |
---|
58 | SET(ORXONOX_PLATFORM_UNIX ${UNIX}) |
---|
59 | IF(UNIX AND NOT APPLE) |
---|
60 | SET(ORXONOX_PLATFORM_LINUX TRUE) |
---|
61 | ENDIF() |
---|
62 | |
---|
63 | # Check __forceinline |
---|
64 | IF(MSVC) |
---|
65 | INCLUDE(CheckCXXSourceCompiles) |
---|
66 | SET(_source "int main() { return 0; } __forceinline void test() { return; }") |
---|
67 | CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE) |
---|
68 | ENDIF(MSVC) |
---|
69 | |
---|
70 | # Part of a woraround for OS X warnings. See OrxonoxConfig.h.in |
---|
71 | IF(HAVE_STDINT_H) |
---|
72 | SET(HAVE_STDINT_H 1) |
---|
73 | ELSE() |
---|
74 | SET(HAVE_STDINT_H 0) |
---|
75 | ENDIF() |
---|
76 | |
---|
77 | # Check iso646.h include (literal operators) |
---|
78 | INCLUDE(CheckIncludeFileCXX) |
---|
79 | CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H) |
---|
80 | |
---|
81 | ############## Configured Headers ############### |
---|
82 | |
---|
83 | SET(GENERATED_FILE_COMMENT |
---|
84 | "DO NOT EDIT THIS FILE! <br> |
---|
85 | It has been automatically generated by CMake from OrxonoxConfig.h.in") |
---|
86 | # Copy and configure OrxonoxConfig which gets included in every file |
---|
87 | CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h) |
---|
88 | # This file only gets included by very few classes to avoid a large recompilation |
---|
89 | CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h) |
---|
90 | |
---|
91 | SET(ORXONOX_CONFIG_FILES |
---|
92 | ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h |
---|
93 | ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in |
---|
94 | ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h |
---|
95 | ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in |
---|
96 | ) |
---|