[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 some basics and controls the configuration scripts |
---|
| 24 | # |
---|
| 25 | |
---|
[8351] | 26 | # Defined LINUX |
---|
| 27 | IF(UNIX AND NOT APPLE) |
---|
| 28 | SET(LINUX TRUE) |
---|
| 29 | ENDIF() |
---|
| 30 | |
---|
[7383] | 31 | IF(WIN32) |
---|
[8351] | 32 | IF(MSVC10) |
---|
| 33 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3 FATAL_ERROR) |
---|
| 34 | ELSE() |
---|
| 35 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) |
---|
| 36 | ENDIF() |
---|
[7383] | 37 | ELSE() |
---|
[8351] | 38 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
[7383] | 39 | ENDIF() |
---|
[1505] | 40 | |
---|
[2710] | 41 | # Keep devs from using the root directory as binary directory (messes up the source tree) |
---|
| 42 | IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) |
---|
| 43 | MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory! |
---|
| 44 | mkdir build; cd build; cmake .. |
---|
| 45 | And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles") |
---|
| 46 | ENDIF() |
---|
[1505] | 47 | |
---|
[2710] | 48 | PROJECT(Orxonox C CXX) |
---|
[1872] | 49 | |
---|
[5695] | 50 | ################ General Config ################# |
---|
| 51 | |
---|
| 52 | # Version info |
---|
[2710] | 53 | SET(ORXONOX_VERSION_MAJOR 0) |
---|
| 54 | SET(ORXONOX_VERSION_MINOR 0) |
---|
[6444] | 55 | SET(ORXONOX_VERSION_PATCH 4) |
---|
| 56 | SET(ORXONOX_VERSION 0.0.4) |
---|
[2718] | 57 | SET(ORXONOX_VERSION_NAME "Arcturus") |
---|
[1505] | 58 | |
---|
[5695] | 59 | # Standard path suffixes |
---|
| 60 | SET(DEFAULT_RUNTIME_PATH bin) |
---|
| 61 | SET(DEFAULT_LIBRARY_PATH lib) |
---|
| 62 | SET(DEFAULT_ARCHIVE_PATH lib/static) |
---|
| 63 | SET(DEFAULT_MODULE_PATH lib/modules) |
---|
| 64 | SET(DEFAULT_DOC_PATH doc) |
---|
| 65 | SET(DEFAULT_DATA_PATH data) |
---|
| 66 | SET(DEFAULT_CONFIG_PATH config) |
---|
| 67 | SET(DEFAULT_LOG_PATH log) |
---|
[8351] | 68 | SET(DEFAULT_BUNDLE_PATH bundle) |
---|
[1505] | 69 | |
---|
[5695] | 70 | # Set output directories |
---|
| 71 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH}) |
---|
| 72 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH}) |
---|
| 73 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH}) |
---|
| 74 | SET(CMAKE_MODULE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH}) |
---|
| 75 | SET(CMAKE_DOC_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH}) |
---|
| 76 | # Data directories are only inputs, no delclaration here |
---|
| 77 | SET(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH}) |
---|
| 78 | SET(CMAKE_LOG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH}) |
---|
| 79 | |
---|
| 80 | # Set the extension of the dynamic modules |
---|
| 81 | SET(ORXONOX_MODULE_EXTENSION ".module") |
---|
| 82 | |
---|
| 83 | # Sets where to find the external libraries like OgreMain.dll at runtime |
---|
| 84 | # On Unix you should not have to change this at all. |
---|
| 85 | # This only applies to development runs in the build tree |
---|
| 86 | SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
| 87 | |
---|
| 88 | # Take care of some CMake 2.6.0 leftovers |
---|
| 89 | MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) |
---|
| 90 | |
---|
| 91 | # This sets where to look for CMake modules (e.g. "Find*.cmake" files) |
---|
[7163] | 92 | SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/tools) |
---|
[1505] | 93 | |
---|
[8368] | 94 | # Flag variables for extra configuration "RelForDevs" should be hidden |
---|
| 95 | MARK_AS_ADVANCED( |
---|
| 96 | CMAKE_CXX_FLAGS_RELFORDEVS |
---|
| 97 | CMAKE_C_FLAGS_RELFORDEVS |
---|
| 98 | CMAKE_EXE_LINKER_FLAGS_RELFORDEVS |
---|
| 99 | CMAKE_MODULE_LINKER_FLAGS_RELFORDEVS |
---|
| 100 | CMAKE_SHARED_LINKER_FLAGS_RELFORDEVS |
---|
| 101 | ) |
---|
| 102 | |
---|
[5695] | 103 | IF(NOT CMAKE_CONFIGURATION_TYPES) |
---|
[8368] | 104 | # Set Debug build to default when not having multi-config generator like MSVC or XCODE |
---|
[5695] | 105 | IF(NOT CMAKE_BUILD_TYPE) |
---|
| 106 | SET(CMAKE_BUILD_TYPE Debug CACHE STRING |
---|
[8368] | 107 | "Build types are: Debug, RelForDevs, RelWithDebInfo, Release, MinSizeRel" FORCE) |
---|
[5695] | 108 | ENDIF() |
---|
| 109 | MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE) |
---|
| 110 | |
---|
| 111 | MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***") |
---|
| 112 | ELSE() |
---|
[8368] | 113 | # Make sure no build type is ever set |
---|
[5695] | 114 | IF(CMAKE_BUILD_TYPE) |
---|
| 115 | SET(CMAKE_BUILD_TYPE CACHE STRING FORCE) |
---|
| 116 | ENDIF() |
---|
[8368] | 117 | MARK_AS_ADVANCED(FORCE CMAKE_BUILD_TYPE) |
---|
| 118 | # Add our extra configuration "RelForDevs" |
---|
| 119 | SET(CMAKE_CONFIGURATION_TYPES "Debug;RelForDevs;RelWithDebInfo;Release;MinSizeRel" |
---|
| 120 | CACHE STRING "Semicolon separated list of supported configuration types." FORCE) |
---|
[5695] | 121 | ENDIF() |
---|
| 122 | |
---|
[8351] | 123 | # Debug builds can not be installed |
---|
| 124 | INSTALL(SCRIPT cmake/InstallCheck.cmake) |
---|
| 125 | |
---|
| 126 | IF(APPLE) |
---|
| 127 | # Set 10.5 as the base SDK by default |
---|
| 128 | SET(XCODE_ATTRIBUTE_SDKROOT macosx10.5) |
---|
| 129 | |
---|
| 130 | # 10.6 sets x86_64 as the default architecture. |
---|
| 131 | # Because Carbon isn't supported on 64-bit and we still need it, force the architectures to ppc and i386 |
---|
| 132 | IF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") |
---|
| 133 | SET(CMAKE_OSX_ARCHITECTURES "i386") |
---|
| 134 | ENDIF() |
---|
| 135 | IF(CMAKE_OSX_ARCHITECTURES MATCHES "ppc64") |
---|
| 136 | SET(CMAKE_OSX_ARCHITECTURES "ppc") |
---|
| 137 | ENDIF() |
---|
| 138 | IF(NOT CMAKE_OSX_ARCHITECTURES) |
---|
| 139 | SET(CMAKE_OSX_ARCHITECTURES "i386") |
---|
| 140 | ENDIF() |
---|
| 141 | ENDIF() |
---|
| 142 | |
---|
[5695] | 143 | ########### Subfolders and Subscripts ########### |
---|
| 144 | |
---|
[8351] | 145 | # General build and compiler options and configurations |
---|
| 146 | INCLUDE(CompilerConfig) |
---|
| 147 | |
---|
[2710] | 148 | # Library finding |
---|
| 149 | INCLUDE(LibraryConfig) |
---|
[1505] | 150 | |
---|
[5695] | 151 | # Configure installation paths and options |
---|
| 152 | INCLUDE(InstallConfig) |
---|
[1505] | 153 | |
---|
[5695] | 154 | # Configure data directory location and installation |
---|
| 155 | ADD_SUBDIRECTORY(data) |
---|
| 156 | |
---|
[2710] | 157 | # Create the actual project |
---|
| 158 | ADD_SUBDIRECTORY(src) |
---|
[1505] | 159 | |
---|
[2710] | 160 | # Configure the binary output directory. Do this after src! |
---|
| 161 | ADD_SUBDIRECTORY(bin) |
---|
[1505] | 162 | |
---|
[8351] | 163 | # System specific files (mostly for installation) |
---|
| 164 | ADD_SUBDIRECTORY(contrib) |
---|
| 165 | |
---|
[5695] | 166 | # Last but not least: Try to make a doc target with Doxygen |
---|
[2710] | 167 | ADD_SUBDIRECTORY(doc) |
---|
[8351] | 168 | |
---|
| 169 | ########### CPack Packaging ########### |
---|
| 170 | |
---|
| 171 | # Currently only testing on Apple |
---|
| 172 | #IF(APPLE) |
---|
| 173 | # INCLUDE(BundleConfig) |
---|
| 174 | #ENDIF(APPLE) |
---|