[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 the compilers and sets build options. |
---|
| 24 | # |
---|
[1505] | 25 | |
---|
[5695] | 26 | # Required macros and functions |
---|
[2710] | 27 | INCLUDE(FlagUtilities) |
---|
[3196] | 28 | INCLUDE(TargetUtilities) |
---|
[2710] | 29 | |
---|
[9550] | 30 | INCLUDE(SourceConfig.cmake) |
---|
| 31 | |
---|
[5695] | 32 | # Configure the two headers and set some options |
---|
| 33 | INCLUDE(OrxonoxConfig.cmake) |
---|
[2710] | 34 | |
---|
| 35 | ################ Sub Directories ################ |
---|
| 36 | |
---|
[5738] | 37 | ADD_SUBDIRECTORY(external) |
---|
| 38 | ADD_SUBDIRECTORY(libraries) |
---|
[5752] | 39 | ADD_SUBDIRECTORY(orxonox) |
---|
[8079] | 40 | SET(ORXONOX_MODULES CACHE INTERNAL "") |
---|
[5738] | 41 | ADD_SUBDIRECTORY(modules) |
---|
[1505] | 42 | |
---|
[7401] | 43 | ################## Executable ################### |
---|
[1854] | 44 | |
---|
[5752] | 45 | INCLUDE_DIRECTORIES( |
---|
| 46 | ${CMAKE_CURRENT_SOURCE_DIR}/libraries |
---|
| 47 | ${CMAKE_CURRENT_SOURCE_DIR}/orxonox |
---|
| 48 | ) |
---|
| 49 | |
---|
[5738] | 50 | # Translate argument |
---|
| 51 | IF(ORXONOX_USE_WINMAIN) |
---|
| 52 | SET(ORXONOX_WIN32 WIN32) |
---|
[2710] | 53 | ENDIF() |
---|
[1810] | 54 | |
---|
[8351] | 55 | SET(ORXONOX_MAIN_FILES Orxonox.cc) |
---|
| 56 | |
---|
| 57 | # Add special source file for OS X |
---|
| 58 | IF(APPLE) |
---|
| 59 | LIST(APPEND ORXONOX_MAIN_FILES OrxonoxMac.mm) |
---|
[10267] | 60 | # Add the icon for win32 builds |
---|
[10268] | 61 | ELSEIF(WIN32) |
---|
[10267] | 62 | LIST(APPEND ORXONOX_MAIN_FILES ${CMAKE_SOURCE_DIR}/contrib/winresource.rc) |
---|
[8351] | 63 | ENDIF() |
---|
| 64 | |
---|
[5738] | 65 | ORXONOX_ADD_EXECUTABLE(orxonox-main |
---|
| 66 | # When defined as WIN32 this removes the console window on Windows |
---|
| 67 | ${ORXONOX_WIN32} |
---|
| 68 | LINK_LIBRARIES |
---|
| 69 | orxonox |
---|
| 70 | SOURCE_FILES |
---|
[8351] | 71 | ${ORXONOX_MAIN_FILES} |
---|
[5738] | 72 | OUTPUT_NAME orxonox |
---|
| 73 | ) |
---|
[7401] | 74 | # Main executable should depend on all modules |
---|
| 75 | ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES}) |
---|
[1810] | 76 | |
---|
[5752] | 77 | # Get name to configure the run scripts |
---|
[10186] | 78 | IF (POLICY CMP0026) |
---|
| 79 | CMAKE_POLICY(PUSH) |
---|
| 80 | CMAKE_POLICY(SET CMP0026 OLD) # we only use the file's name, not its actual location, so the old policy is fine |
---|
| 81 | ENDIF() |
---|
[5738] | 82 | GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION) |
---|
| 83 | GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME) |
---|
| 84 | SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "") |
---|
[10186] | 85 | IF (POLICY CMP0026) |
---|
| 86 | CMAKE_POLICY(POP) # set policy back to original settings |
---|
| 87 | ENDIF() |
---|
[5744] | 88 | |
---|
| 89 | |
---|
[8351] | 90 | # Apple Mac OS X specific build settings |
---|
| 91 | IF(APPLE) |
---|
| 92 | # On Apple we need to link to AppKit and Foundation frameworks |
---|
| 93 | TARGET_LINK_LIBRARIES(orxonox-main |
---|
| 94 | "-framework AppKit" |
---|
| 95 | "-framework Foundation" |
---|
| 96 | ) |
---|
| 97 | |
---|
| 98 | # Post-build step for the creation of the Dev-App bundle |
---|
| 99 | INCLUDE(PrepareDevBundle) |
---|
| 100 | ADD_CUSTOM_COMMAND( |
---|
| 101 | TARGET orxonox-main |
---|
| 102 | POST_BUILD |
---|
| 103 | # Copy the executable into the Orxonox.app |
---|
| 104 | COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${ORXONOX_EXECUTABLE_NAME}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app/Contents/MacOS" |
---|
| 105 | # Copy the dev-build marker file to Orxonox.app |
---|
| 106 | COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/orxonox_dev_build.keep_me" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app/Contents/MacOS" |
---|
| 107 | # Create a shortcut of the application to the root of the build tree |
---|
| 108 | COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" |
---|
| 109 | ) |
---|
| 110 | ENDIF(APPLE) |
---|
| 111 | |
---|
[7401] | 112 | #################### Doxygen #################### |
---|
| 113 | |
---|
| 114 | # Prepare include paths for Doxygen. This is necessary to display |
---|
| 115 | # the correct path to use when including a file, e.g. |
---|
| 116 | # core/XMLPort.h instead of src/core/XMLPort.h |
---|
| 117 | |
---|
| 118 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/modules) |
---|
| 119 | GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES) |
---|
| 120 | # Replace ';' by spaces |
---|
| 121 | STRING(REPLACE ";" " " _temp "${_temp}") |
---|
| 122 | SET(DOXYGEN_INCLUDE_DIRECTORIES "${_temp}" PARENT_SCOPE) |
---|