[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 | |
---|
[2710] | 26 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
[1505] | 27 | |
---|
[2710] | 28 | # Keep devs from using the root directory as binary directory (messes up the source tree) |
---|
| 29 | IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) |
---|
| 30 | MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory! |
---|
| 31 | mkdir build; cd build; cmake .. |
---|
| 32 | And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles") |
---|
| 33 | ENDIF() |
---|
[1505] | 34 | |
---|
[2710] | 35 | PROJECT(Orxonox C CXX) |
---|
[1872] | 36 | |
---|
[5695] | 37 | ################ General Config ################# |
---|
| 38 | |
---|
| 39 | # Standard path suffixes |
---|
| 40 | SET(DEFAULT_RUNTIME_PATH bin) |
---|
| 41 | SET(DEFAULT_LIBRARY_PATH lib) |
---|
| 42 | SET(DEFAULT_ARCHIVE_PATH lib/static) |
---|
| 43 | SET(DEFAULT_DOC_PATH doc) |
---|
| 44 | SET(DEFAULT_DATA_PATH data) |
---|
| 45 | SET(DEFAULT_CONFIG_PATH config) |
---|
| 46 | SET(DEFAULT_LOG_PATH log) |
---|
[1505] | 47 | |
---|
[5695] | 48 | # Set output directories |
---|
| 49 | SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH}) |
---|
| 50 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH}) |
---|
| 51 | SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH}) |
---|
| 52 | SET(CMAKE_DOC_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH}) |
---|
| 53 | # Data directories are only inputs, no delclaration here |
---|
| 54 | SET(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH}) |
---|
| 55 | SET(CMAKE_LOG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH}) |
---|
| 56 | |
---|
| 57 | # Sets where to find the external libraries like OgreMain.dll at runtime |
---|
| 58 | # On Unix you should not have to change this at all. |
---|
| 59 | # This only applies to development runs in the build tree |
---|
| 60 | SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
| 61 | |
---|
| 62 | # Take care of some CMake 2.6.0 leftovers |
---|
| 63 | MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) |
---|
| 64 | |
---|
| 65 | # This sets where to look for CMake modules (e.g. "Find*.cmake" files) |
---|
[2710] | 66 | SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
---|
[1505] | 67 | |
---|
[5695] | 68 | # Set Debug build to default when not having multi-config generator like msvc |
---|
| 69 | IF(NOT CMAKE_CONFIGURATION_TYPES) |
---|
| 70 | IF(NOT CMAKE_BUILD_TYPE) |
---|
| 71 | SET(CMAKE_BUILD_TYPE Debug CACHE STRING |
---|
| 72 | "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE) |
---|
| 73 | ENDIF() |
---|
| 74 | MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE) |
---|
| 75 | |
---|
| 76 | MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***") |
---|
| 77 | ELSE() |
---|
| 78 | IF(CMAKE_BUILD_TYPE) |
---|
| 79 | SET(CMAKE_BUILD_TYPE CACHE STRING FORCE) |
---|
| 80 | ENDIF() |
---|
| 81 | MARK_AS_ADVANCED(CMAKE_BUILD_TYPE) |
---|
| 82 | ENDIF() |
---|
| 83 | |
---|
| 84 | # Enable expensive optimisations: use this for a binary release build |
---|
| 85 | OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE) |
---|
| 86 | |
---|
| 87 | ########### Subfolders and Subscripts ########### |
---|
| 88 | |
---|
[2710] | 89 | # Library finding |
---|
| 90 | INCLUDE(LibraryConfig) |
---|
[1505] | 91 | |
---|
[2710] | 92 | # General build and compiler options and configurations |
---|
[5695] | 93 | INCLUDE(CompilerConfig) |
---|
[1505] | 94 | |
---|
[5695] | 95 | # Configure installation paths and options |
---|
| 96 | INCLUDE(InstallConfig) |
---|
[1505] | 97 | |
---|
[5695] | 98 | # Configure data directory location and installation |
---|
| 99 | ADD_SUBDIRECTORY(data) |
---|
| 100 | |
---|
[2710] | 101 | # Create the actual project |
---|
| 102 | ADD_SUBDIRECTORY(src) |
---|
[1505] | 103 | |
---|
[2710] | 104 | # Configure the binary output directory. Do this after src! |
---|
| 105 | ADD_SUBDIRECTORY(bin) |
---|
[1505] | 106 | |
---|
[5695] | 107 | # Last but not least: Try to make a doc target with Doxygen |
---|
[2710] | 108 | ADD_SUBDIRECTORY(doc) |
---|