Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/forks/sandbox/src/CMakeLists.txt @ 11448

Last change on this file since 11448 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
Line 
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
27INCLUDE(FlagUtilities)
28INCLUDE(TargetUtilities)
29
30# Configure the two headers and set some options
31INCLUDE(OrxonoxConfig.cmake)
32
33################ Library Defines ################
34
35# Disable Boost auto linking completely
36ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
37
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)
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}
52  ${VLD_INCLUDE_DIR}
53
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
58  # OrxonoxConfig.h
59  ${CMAKE_CURRENT_BINARY_DIR}
60)
61
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
71################ Sub Directories ################
72
73ADD_SUBDIRECTORY(external)
74ADD_SUBDIRECTORY(libraries)
75ADD_SUBDIRECTORY(orxonox)
76ADD_SUBDIRECTORY(modules)
77
78################ Executable ################
79
80INCLUDE_DIRECTORIES(
81  ${CMAKE_CURRENT_SOURCE_DIR}/libraries
82  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
83)
84
85# Translate argument
86IF(ORXONOX_USE_WINMAIN)
87  SET(ORXONOX_WIN32 WIN32)
88ENDIF()
89
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)
99
100# Get name to configure the run scripts
101GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
102GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
103SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
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.