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