Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/environment2/src/CMakeLists.txt @ 10255

Last change on this file since 10255 was 8351, checked in by rgrieder, 14 years ago

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
  • Property svn:eol-style set to native
File size: 8.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 Behaviour (dependencies) ########
34
35# Disable auto linking completely for Boost and POCO
36ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
37ADD_COMPILER_FLAGS("-DPOCO_NO_AUTOMATIC_LIBS")
38
39IF(WIN32)
40  # If no defines are specified, these libs get linked statically
41  ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" LINK_BOOST_DYNAMIC)
42  #ADD_COMPILER_FLAGS("-DENET_DLL"           LINK_ENET_DYNAMIC)
43  ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   LINK_LUA5.1_DYNAMIC)
44  # If no defines are specified, these libs get linked dynamically
45  ADD_COMPILER_FLAGS("-DCEGUI_STATIC -DTOLUA_STATIC" NOT LINK_CEGUI_DYNAMIC)
46  ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    NOT LINK_OGRE_DYNAMIC)
47  ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       NOT LINK_TCL_DYNAMIC)
48
49  # Target Windows XP as minimum Windows version
50  # And try to catch all the different macro defines for that...
51  ADD_COMPILER_FLAGS("-D_WIN32_WINNT=0x0501")
52  ADD_COMPILER_FLAGS("-D_WIN32_WINDOWS=0x0501")
53  ADD_COMPILER_FLAGS("-DWINVER=0x0501")
54  ADD_COMPILER_FLAGS("-DNTDDI_VERSION=0x05010000")
55ENDIF(WIN32)
56
57######### Library Behaviour (external) ##########
58
59# Use TinyXML++
60ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
61
62# Default linking for externals is SHARED
63SET(ORXONOX_EXTERNAL_LINK_MODE SHARED CACHE STRING "Link mode for external libraries that we build ourselves. Note: on Windows, some libraries cannot be linked shared.")
64
65IF(ORXONOX_EXTERNAL_LINK_MODE STREQUAL "SHARED")
66  SET(_external_shared_link TRUE)
67ELSE()
68  SET(_external_shared_link FALSE)
69ENDIF()
70# If no defines are specified, these libs get linked dynamically
71ADD_COMPILER_FLAGS("-DENET_DLL"                    WIN32     _external_shared_link)
72ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link)
73ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB"              WIN32 NOT _external_shared_link)
74
75############## Include Directories ##############
76
77# Set the search paths for include files
78INCLUDE_DIRECTORIES(
79  # OrxonoxConfig.h
80  ${CMAKE_CURRENT_BINARY_DIR}
81
82  # All includes in "externals" should be prefixed with the path
83  # relative to "external" to avoid conflicts
84  ${CMAKE_CURRENT_SOURCE_DIR}/external
85  # Include directories needed even if only included by Orxonox
86  ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
87  ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
88
89  # External
90  ${OGRE_INCLUDE_DIR}
91  ${CEGUI_INCLUDE_DIR}
92  ${CEGUI_TOLUA_INCLUDE_DIR}
93  #${ENET_INCLUDE_DIR}
94  ${Boost_INCLUDE_DIRS}
95  ${POCO_INCLUDE_DIR}
96  ${OPENAL_INCLUDE_DIRS}
97  ${ALUT_INCLUDE_DIR}
98  ${VORBIS_INCLUDE_DIR}
99  ${OGG_INCLUDE_DIR}
100  ${LUA5.1_INCLUDE_DIR}
101  ${TCL_INCLUDE_PATH}
102  ${DIRECTX_INCLUDE_DIR}
103  ${ZLIB_INCLUDE_DIR}
104)
105
106IF(CEGUI_OLD_VERSION)
107  INCLUDE_DIRECTORIES(${CEGUILUA_INCLUDE_DIR})
108ENDIF()
109
110IF (DBGHELP_FOUND)
111  INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR})
112ENDIF()
113
114############## CEGUI OGRE Renderer ##############
115
116IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
117  SET(CEGUI_OGRE_RENDERER_LIBRARY ogreceguirenderer_orxonox)
118ENDIF()
119
120################### Tolua Bind ##################
121
122# Create directory because the tolua application doesn't work otherwise
123IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
124  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
125ENDIF()
126
127INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
128
129################ Sub Directories ################
130
131ADD_SUBDIRECTORY(external)
132ADD_SUBDIRECTORY(libraries)
133ADD_SUBDIRECTORY(orxonox)
134SET(ORXONOX_MODULES CACHE INTERNAL "")
135ADD_SUBDIRECTORY(modules)
136
137################## Executable ###################
138
139INCLUDE_DIRECTORIES(
140  ${CMAKE_CURRENT_SOURCE_DIR}/libraries
141  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
142)
143
144# Translate argument
145IF(ORXONOX_USE_WINMAIN)
146  SET(ORXONOX_WIN32 WIN32)
147ENDIF()
148
149SET(ORXONOX_MAIN_FILES Orxonox.cc)
150
151# Add special source file for OS X
152IF(APPLE)
153  LIST(APPEND ORXONOX_MAIN_FILES OrxonoxMac.mm)
154ENDIF()
155
156ORXONOX_ADD_EXECUTABLE(orxonox-main
157  # When defined as WIN32 this removes the console window on Windows
158  ${ORXONOX_WIN32}
159  LINK_LIBRARIES
160    orxonox
161  SOURCE_FILES
162    ${ORXONOX_MAIN_FILES}
163  OUTPUT_NAME orxonox
164)
165# Main executable should depend on all modules
166ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES})
167
168# Get name to configure the run scripts
169GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
170GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
171SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
172
173
174# When using Visual Studio we want to use the output directory as working
175# directory and we also want to specify where the external dlls
176# (lua, ogre, etc.) are. The problem hereby is that these information cannot
177# be specified in CMake because they are not stored in the actual project file.
178# This workaround will create a configured *.vcproj.user file that holds the
179# right values. When starting the solution for the first time,
180# these get written to the *vcproj.yourPCname.yourname.user
181IF(MSVC)
182  IF(CMAKE_CL_64)
183    SET(MSVC_PLATFORM "x64")
184  ELSE()
185    SET(MSVC_PLATFORM "Win32")
186  ENDIF()
187  IF(MSVC10)
188    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcxproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcxproj.user")
189  ELSE()
190    STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?).*$" "\\1"
191           VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
192    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcproj.user")
193  ENDIF()
194ENDIF(MSVC)
195
196# Apple Mac OS X specific build settings
197IF(APPLE)
198  # On Apple we need to link to AppKit and Foundation frameworks
199  TARGET_LINK_LIBRARIES(orxonox-main
200    "-framework AppKit"
201    "-framework Foundation"
202  )
203
204  # Post-build step for the creation of the Dev-App bundle
205  INCLUDE(PrepareDevBundle)
206  ADD_CUSTOM_COMMAND(
207    TARGET orxonox-main
208    POST_BUILD
209    # Copy the executable into the Orxonox.app
210    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"
211    # Copy the dev-build marker file to Orxonox.app
212    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"
213    # Create a shortcut of the application to the root of the build tree
214    COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app"
215  )
216ENDIF(APPLE)
217
218#################### Doxygen ####################
219
220# Prepare include paths for Doxygen. This is necessary to display
221# the correct path to use when including a file, e.g.
222# core/XMLPort.h instead of src/core/XMLPort.h
223
224INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/modules)
225GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES)
226# Replace ';' by spaces
227STRING(REPLACE ";" " " _temp "${_temp}")
228SET(DOXYGEN_INCLUDE_DIRECTORIES "${_temp}" PARENT_SCOPE)
Note: See TracBrowser for help on using the repository browser.