[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 | |
---|
[5695] | 30 | # Configure the two headers and set some options |
---|
| 31 | INCLUDE(OrxonoxConfig.cmake) |
---|
[2710] | 32 | |
---|
[5695] | 33 | ################ Library Defines ################ |
---|
[2710] | 34 | |
---|
[5695] | 35 | # Disable Boost auto linking completely |
---|
| 36 | ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB") |
---|
[2710] | 37 | |
---|
[5695] | 38 | # If no defines are specified, these libs get linked statically |
---|
| 39 | ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC) |
---|
| 40 | ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA_DYNAMIC) |
---|
[2710] | 41 | |
---|
| 42 | ############## Include Directories ############## |
---|
| 43 | |
---|
| 44 | # Set the search paths for include files |
---|
| 45 | INCLUDE_DIRECTORIES( |
---|
| 46 | # External |
---|
| 47 | ${Boost_INCLUDE_DIRS} |
---|
| 48 | ${LUA_INCLUDE_DIR} |
---|
[3196] | 49 | ${VLD_INCLUDE_DIR} |
---|
[2710] | 50 | |
---|
[5752] | 51 | # All includes in "externals" should be prefixed with the path |
---|
| 52 | # relative to "external" to avoid conflicts |
---|
| 53 | ${CMAKE_CURRENT_SOURCE_DIR}/external |
---|
| 54 | |
---|
[2710] | 55 | # OrxonoxConfig.h |
---|
| 56 | ${CMAKE_CURRENT_BINARY_DIR} |
---|
| 57 | ) |
---|
| 58 | |
---|
[5752] | 59 | ################### Tolua Bind ################## |
---|
| 60 | |
---|
| 61 | # Create directory because the tolua application doesn't work otherwise |
---|
| 62 | IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR}) |
---|
| 63 | FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR}) |
---|
| 64 | ENDIF() |
---|
| 65 | |
---|
| 66 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR}) |
---|
| 67 | |
---|
[2710] | 68 | ################ Sub Directories ################ |
---|
| 69 | |
---|
[5738] | 70 | ADD_SUBDIRECTORY(external) |
---|
| 71 | ADD_SUBDIRECTORY(libraries) |
---|
[5752] | 72 | ADD_SUBDIRECTORY(orxonox) |
---|
[1505] | 73 | |
---|
[5738] | 74 | ################ Executable ################ |
---|
[1854] | 75 | |
---|
[5752] | 76 | INCLUDE_DIRECTORIES( |
---|
| 77 | ${CMAKE_CURRENT_SOURCE_DIR}/libraries |
---|
| 78 | ${CMAKE_CURRENT_SOURCE_DIR}/orxonox |
---|
| 79 | ) |
---|
| 80 | |
---|
[5738] | 81 | # Translate argument |
---|
| 82 | IF(ORXONOX_USE_WINMAIN) |
---|
| 83 | SET(ORXONOX_WIN32 WIN32) |
---|
[2710] | 84 | ENDIF() |
---|
[1810] | 85 | |
---|
[5738] | 86 | ORXONOX_ADD_EXECUTABLE(orxonox-main |
---|
| 87 | # When defined as WIN32 this removes the console window on Windows |
---|
| 88 | ${ORXONOX_WIN32} |
---|
| 89 | LINK_LIBRARIES |
---|
| 90 | orxonox |
---|
| 91 | SOURCE_FILES |
---|
| 92 | Orxonox.cc |
---|
| 93 | OUTPUT_NAME orxonox |
---|
| 94 | ) |
---|
[1810] | 95 | |
---|
[5752] | 96 | # Get name to configure the run scripts |
---|
[5738] | 97 | GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION) |
---|
| 98 | GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME) |
---|
| 99 | SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "") |
---|
[5744] | 100 | |
---|
| 101 | |
---|
| 102 | # When using Visual Studio we want to use the output directory as working |
---|
| 103 | # directory and we also want to specify where the external dlls |
---|
| 104 | # (lua, ogre, etc.) are. The problem hereby is that these information cannot |
---|
| 105 | # be specified in CMake because they are not stored in the actual project file. |
---|
| 106 | # This workaround will create a configured *.vcproj.user file that holds the |
---|
| 107 | # right values. When starting the solution for the first time, |
---|
| 108 | # these get written to the *vcproj.yourPCname.yourname.user |
---|
| 109 | IF(MSVC) |
---|
| 110 | IF(CMAKE_CL_64) |
---|
| 111 | SET(MSVC_PLATFORM "x64") |
---|
| 112 | ELSE() |
---|
| 113 | SET(MSVC_PLATFORM "Win32") |
---|
| 114 | ENDIF() |
---|
| 115 | STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1" |
---|
| 116 | VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}") |
---|
| 117 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcproj.user") |
---|
| 118 | ENDIF(MSVC) |
---|