Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: sandbox/src/CMakeLists.txt @ 7329

Last change on this file since 7329 was 5782, checked in by rgrieder, 15 years ago

Applied changes to the real sandbox this time.

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