Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/CMakeLists.txt @ 11183

Last change on this file since 11183 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

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