| 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 | # |
|---|
| 19 | # |
|---|
| 20 | # Author: |
|---|
| 21 | # Reto Grieder |
|---|
| 22 | # Description: |
|---|
| 23 | # Configures the compilers and sets build options. |
|---|
| 24 | # |
|---|
| 25 | |
|---|
| 26 | # Required macros and functions |
|---|
| 27 | INCLUDE(FlagUtilities) |
|---|
| 28 | INCLUDE(TargetUtilities) |
|---|
| 29 | |
|---|
| 30 | INCLUDE(SourceConfig.cmake) |
|---|
| 31 | |
|---|
| 32 | # Configure the two headers and set some options |
|---|
| 33 | INCLUDE(OrxonoxConfig.cmake) |
|---|
| 34 | |
|---|
| 35 | ################ Sub Directories ################ |
|---|
| 36 | |
|---|
| 37 | ADD_SUBDIRECTORY(external) |
|---|
| 38 | ADD_SUBDIRECTORY(libraries) |
|---|
| 39 | ADD_SUBDIRECTORY(orxonox) |
|---|
| 40 | SET(ORXONOX_MODULES CACHE INTERNAL "") |
|---|
| 41 | SET(ORXONOX_PLUGINS CACHE INTERNAL "") |
|---|
| 42 | ADD_SUBDIRECTORY(modules) |
|---|
| 43 | |
|---|
| 44 | ################## Executable ################### |
|---|
| 45 | |
|---|
| 46 | INCLUDE_DIRECTORIES( |
|---|
| 47 | ${CMAKE_CURRENT_SOURCE_DIR}/libraries |
|---|
| 48 | ${CMAKE_CURRENT_SOURCE_DIR}/orxonox |
|---|
| 49 | ) |
|---|
| 50 | |
|---|
| 51 | # Translate argument |
|---|
| 52 | IF(ORXONOX_USE_WINMAIN) |
|---|
| 53 | SET(ORXONOX_WIN32 WIN32) |
|---|
| 54 | ENDIF() |
|---|
| 55 | |
|---|
| 56 | SET(ORXONOX_MAIN_FILES Orxonox.cc) |
|---|
| 57 | |
|---|
| 58 | # Add special source file for OS X |
|---|
| 59 | IF(APPLE) |
|---|
| 60 | LIST(APPEND ORXONOX_MAIN_FILES OrxonoxMac.mm) |
|---|
| 61 | # Add the icon for win32 builds |
|---|
| 62 | ELSEIF(WIN32) |
|---|
| 63 | LIST(APPEND ORXONOX_MAIN_FILES ${CMAKE_SOURCE_DIR}/contrib/winresource.rc) |
|---|
| 64 | ENDIF() |
|---|
| 65 | |
|---|
| 66 | SET(ORXONOX_EXECUTABLE_NAME "orxonox" CACHE INTERNAL "") |
|---|
| 67 | |
|---|
| 68 | ORXONOX_ADD_EXECUTABLE(orxonox-main |
|---|
| 69 | # When defined as WIN32 this removes the console window on Windows |
|---|
| 70 | ${ORXONOX_WIN32} |
|---|
| 71 | LINK_LIBRARIES |
|---|
| 72 | orxonox |
|---|
| 73 | SOURCE_FILES |
|---|
| 74 | ${ORXONOX_MAIN_FILES} |
|---|
| 75 | OUTPUT_NAME |
|---|
| 76 | ${ORXONOX_EXECUTABLE_NAME} |
|---|
| 77 | ) |
|---|
| 78 | # Main executable should depend on all modules (but not on plugins) |
|---|
| 79 | ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES}) |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | # Apple Mac OS X specific build settings |
|---|
| 83 | IF(APPLE) |
|---|
| 84 | # On Apple we need to link to AppKit and Foundation frameworks |
|---|
| 85 | TARGET_LINK_LIBRARIES(orxonox-main |
|---|
| 86 | "-framework AppKit" |
|---|
| 87 | "-framework Foundation" |
|---|
| 88 | ) |
|---|
| 89 | |
|---|
| 90 | # Post-build step for the creation of the Dev-App bundle |
|---|
| 91 | INCLUDE(PrepareDevBundle) |
|---|
| 92 | ADD_CUSTOM_COMMAND( |
|---|
| 93 | TARGET orxonox-main |
|---|
| 94 | POST_BUILD |
|---|
| 95 | # Copy the executable into the Orxonox.app |
|---|
| 96 | 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" |
|---|
| 97 | # Copy the dev-build marker file to Orxonox.app |
|---|
| 98 | 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" |
|---|
| 99 | # Create a shortcut of the application to the root of the build tree |
|---|
| 100 | COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" |
|---|
| 101 | ) |
|---|
| 102 | ENDIF(APPLE) |
|---|
| 103 | |
|---|
| 104 | #################### Doxygen #################### |
|---|
| 105 | |
|---|
| 106 | # Prepare include paths for Doxygen. This is necessary to display |
|---|
| 107 | # the correct path to use when including a file, e.g. |
|---|
| 108 | # core/XMLPort.h instead of src/core/XMLPort.h |
|---|
| 109 | |
|---|
| 110 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/modules) |
|---|
| 111 | GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES) |
|---|
| 112 | # Replace ';' by spaces |
|---|
| 113 | STRING(REPLACE ";" " " _temp "${_temp}") |
|---|
| 114 | SET(DOXYGEN_INCLUDE_DIRECTORIES "${_temp}" PARENT_SCOPE) |
|---|