Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/forks/sandbox_qt/src/CMakeLists.txt @ 7805

Last change on this file since 7805 was 7805, checked in by rgrieder, 13 years ago

Changed source file handling procedure, especially for Qt moc files.

  • Property svn:eol-style set to native
File size: 4.6 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
[7163]33####### Library Behaviour (dependencies) ########
[2710]34
[5695]35# If no defines are specified, these libs get linked statically
[7421]36#ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
[5695]37# If no defines are specified, these libs get linked dynamically
[7421]38#ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
[2710]39
[7163]40######### Library Behaviour (external) ##########
41
42# Default linking for externals is SHARED
43SET(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.")
44
45IF(ORXONOX_EXTERNAL_LINK_MODE STREQUAL "SHARED")
46  SET(_external_shared_link TRUE)
47ELSE()
48  SET(_external_shared_link FALSE)
49ENDIF()
50# If no defines are specified, these libs get linked dynamically
[7421]51#ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD"          WIN32 NOT _external_shared_link)
[7163]52
[2710]53############## Include Directories ##############
54
55# Set the search paths for include files
56INCLUDE_DIRECTORIES(
57  # External
[3196]58  ${VLD_INCLUDE_DIR}
[2710]59
[5752]60  # All includes in "externals" should be prefixed with the path
61  # relative to "external" to avoid conflicts
62  ${CMAKE_CURRENT_SOURCE_DIR}/external
[5781]63  # Include directories needed even if only included by Orxonox
[7421]64  #${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
[5752]65
[2710]66  # OrxonoxConfig.h
67  ${CMAKE_CURRENT_BINARY_DIR}
68)
69
[7421]70###################### Qt4 ######################
[5781]71
[7421]72INCLUDE(${QT_USE_FILE})
[5752]73
[2710]74################ Sub Directories ################
75
[5738]76ADD_SUBDIRECTORY(external)
77ADD_SUBDIRECTORY(libraries)
[5752]78ADD_SUBDIRECTORY(orxonox)
[1505]79
[7401]80################## Executable ###################
[1854]81
[7805]82SET_SOURCE_FILES(ORXONOX_MAIN_SRC_FILES Orxonox.cc)
83
[5752]84INCLUDE_DIRECTORIES(
85  ${CMAKE_CURRENT_SOURCE_DIR}/libraries
86  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
87)
88
[5738]89# Translate argument
90IF(ORXONOX_USE_WINMAIN)
91  SET(ORXONOX_WIN32 WIN32)
[2710]92ENDIF()
[1810]93
[5738]94ORXONOX_ADD_EXECUTABLE(orxonox-main
95  # When defined as WIN32 this removes the console window on Windows
96  ${ORXONOX_WIN32}
97  LINK_LIBRARIES
[7423]98    ${QT_QTMAIN_LIBRARY}
[5738]99    orxonox
100  SOURCE_FILES
[7805]101    ${ORXONOX_MAIN_SRC_FILES}
[5738]102  OUTPUT_NAME orxonox
103)
[1810]104
[5752]105# Get name to configure the run scripts
[5738]106GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
107GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
108SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
[5744]109
110
111# When using Visual Studio we want to use the output directory as working
112# directory and we also want to specify where the external dlls
113# (lua, ogre, etc.) are. The problem hereby is that these information cannot
114# be specified in CMake because they are not stored in the actual project file.
115# This workaround will create a configured *.vcproj.user file that holds the
116# right values. When starting the solution for the first time,
117# these get written to the *vcproj.yourPCname.yourname.user
118IF(MSVC)
119  IF(CMAKE_CL_64)
120    SET(MSVC_PLATFORM "x64")
121  ELSE()
122    SET(MSVC_PLATFORM "Win32")
123  ENDIF()
124  STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
125         VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
126  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcproj.user")
127ENDIF(MSVC)
[7401]128
129#################### Doxygen ####################
130
131# Prepare include paths for Doxygen. This is necessary to display
132# the correct path to use when including a file, e.g.
133# core/XMLPort.h instead of src/core/XMLPort.h
134
135GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES)
136# Replace ';' by spaces
137STRING(REPLACE ";" " " _temp "${_temp}")
138SET(DOXYGEN_INCLUDE_DIRECTORIES "${_temp}" PARENT_SCOPE)
Note: See TracBrowser for help on using the repository browser.