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