Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5664


Ignore:
Timestamp:
Aug 20, 2009, 11:49:37 PM (15 years ago)
Author:
rgrieder
Message:
  • Moved all (as far as possible) build related CMake options and switches to src/OrxonoxConfig.cmake (new file). This should my constant problems of finding options I've created some time ago…
  • Renamed BuildConfig to CompilerConfig (since that's what it has become now).
  • Moved all installation related options and paths to cmake/InstallConfig.cmake (new file)
  • Note: I moved the very basic options to the root CMLs like default paths (bin, lib, doc, etc.), output directories and configuration type.

Actual code changes are absolutely minimal, maybe a few lines or so.

Location:
code/branches/resource2
Files:
4 edited
2 copied
3 moved

Legend:

Unmodified
Added
Removed
  • code/branches/resource2/CMakeLists.txt

    r5645 r5664  
    1717 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    1818 #
    19  
     19 #
     20 #  Author:
     21 #    Reto Grieder
     22 #  Description:
     23 #    Configures some basics and controls the configuration scripts
     24 #
     25
    2026CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
    2127
     
    2733ENDIF()
    2834
    29 
    3035PROJECT(Orxonox C CXX)
    3136
     37################ General Config #################
     38
     39# Version info
    3240SET(ORXONOX_VERSION_MAJOR 0)
    3341SET(ORXONOX_VERSION_MINOR 0)
     
    3644SET(ORXONOX_VERSION_NAME "Arcturus")
    3745
     46# Standard path suffixes
     47SET(DEFAULT_RUNTIME_PATH bin)
     48SET(DEFAULT_LIBRARY_PATH lib)
     49SET(DEFAULT_ARCHIVE_PATH lib/static)
     50SET(DEFAULT_DOC_PATH     doc)
     51SET(DEFAULT_DATA_PATH    data)
     52SET(DEFAULT_CONFIG_PATH  config)
     53SET(DEFAULT_LOG_PATH     log)
    3854
    39 # This sets where to look for modules (e.g. "Find*.cmake" files)
     55# Set output directories
     56SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
     57SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
     58SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
     59SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
     60# Data directories are only inputs, no delclaration here
     61SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
     62SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
     63
     64# Sets where to find the external libraries like OgreMain.dll at runtime
     65# On Unix you should not have to change this at all.
     66# This only applies to development runs in the build tree
     67SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
     68
     69# Take care of some CMake 2.6.0 leftovers
     70MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
     71
     72# This sets where to look for CMake modules (e.g. "Find*.cmake" files)
    4073SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
     74
     75# Set Debug build to default when not having multi-config generator like msvc
     76IF(NOT CMAKE_CONFIGURATION_TYPES)
     77  IF(NOT CMAKE_BUILD_TYPE)
     78    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
     79        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
     80  ENDIF()
     81  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
     82
     83  MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
     84ELSE()
     85  IF(CMAKE_BUILD_TYPE)
     86    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
     87  ENDIF()
     88  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
     89ENDIF()
     90
     91########### Subfolders and Subscripts ###########
    4192
    4293# Library finding
     
    4495
    4596# General build and compiler options and configurations
    46 INCLUDE(BuildConfig)
     97INCLUDE(CompilerConfig)
     98
     99# Configure installation paths and options
     100INCLUDE(InstallConfig)
    47101
    48102# Configure data directory location and installation
     
    55109ADD_SUBDIRECTORY(bin)
    56110
    57 # Last but not least: Try to make doxygen target
     111# Last but not least: Try to make a doc target with Doxygen
    58112ADD_SUBDIRECTORY(doc)
  • code/branches/resource2/cmake/CheckOGREPlugins.cmake

    r2710 r5664  
    3232 #    OGRE_PLUGINS_RELEASE        Names of the release plugins without ext.
    3333 #  Note:
    34  #    You must not specify render systems as input, but the ones found will be
    35  #    present in the output variables.
     34 #    You must not specify render systems as input. That will be taken care of
     35 #    automatically.
    3636 #
    3737
  • code/branches/resource2/cmake/CompilerConfig.cmake

    r5662 r5664  
    2121 #    Reto Grieder
    2222 #  Description:
    23  #    Configures the compilers and sets build options.
    24  #    This also includes handling the OGRE plugins and the data directory.
     23 #    Calls a compiler specific script and sets some options.
    2524 #
    26 
    27 ################# Misc Settings #################
    28 
    29 # Standard path suffixes, might not hold everywhere though
    30 SET(DEFAULT_RUNTIME_PATH bin)
    31 SET(DEFAULT_LIBRARY_PATH lib)
    32 SET(DEFAULT_ARCHIVE_PATH lib/static)
    33 SET(DEFAULT_DOC_PATH     doc)
    34 SET(DEFAULT_DATA_PATH    data)
    35 SET(DEFAULT_CONFIG_PATH  config)
    36 SET(DEFAULT_LOG_PATH     log)
    37 
    38 # Set output directories
    39 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
    40 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
    41 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
    42 SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
    43 # Data directories are only inputs
    44 SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
    45 SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
    46 
    47 # Take care of some CMake 2.6.0 leftovers
    48 MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
    49 
    50 # Sets where to find the external libraries like OgreMain.dll at runtime
    51 # On Unix you should not have to change this at all.
    52 IF(NOT RUNTIME_LIBRARY_DIRECTORY)
    53   SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
    54 ENDIF()
    55 
    56 # Set Debug build to default when not having multi-config generator like msvc
    57 IF(NOT CMAKE_CONFIGURATION_TYPES)
    58   IF(NOT CMAKE_BUILD_TYPE)
    59     SET(CMAKE_BUILD_TYPE Debug CACHE STRING
    60         "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
    61   ENDIF()
    62   MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
    63 
    64   MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
    65 ELSE()
    66   IF(CMAKE_BUILD_TYPE)
    67     SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
    68   ENDIF()
    69   MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
    70 ENDIF()
    71 
    72 
    73 ################# OGRE Plugins ##################
    74 
    75 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
    76 SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
    77 IF(WIN32)
    78   # CG program manager is probably DirectX related (not available under unix)
    79   LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
    80 ENDIF(WIN32)
    81 SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
    82    "Specify which OGRE plugins to load. Existance check is performed.")
    83 
    84 # Check the plugins and determine the plugin folder
    85 # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
    86 INCLUDE(CheckOGREPlugins)
    87 CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
    88 
    89 
    90 ################ Compiler Config ################
    9125
    9226OPTION(EXTRA_COMPILER_WARNINGS "Enable some extra warnings (heavily pollutes the output)" FALSE)
    9327
    94 INCLUDE(FlagUtilities)
    95 
    9628# Configure the compiler specific build options
    9729IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
    98   INCLUDE(BuildConfigGCC)
     30  INCLUDE(CompilerConfigGCC)
    9931ELSEIF(MSVC)
    100   INCLUDE(BuildConfigMSVC)
     32  INCLUDE(CompilerConfigMSVC)
    10133ELSE()
    10234  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
    10335ENDIF()
    10436
    105 SET(USER_SCRIPT_BUILD_CONFIG "" CACHE FILEPATH
    106     "Specify a CMake script if you wish to write your own build config.
    107      See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
    108 IF(USER_SCRIPT_BUILD_CONFIG)
    109   IF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG}.cmake)
    110     INCLUDE(${USER_SCRIPT_BUILD_CONFIG})
    111   ELSEIF(EXISTS ${USER_SCRIPT_BUILD_CONFIG})
    112     INCLUDE(${USER_SCRIPT_BUILD_CONFIG})
    113   ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG})
    114     INCLUDE(${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG})
     37SET(COMPILER_CONFIG_USER_SCRIPT "" CACHE FILEPATH
     38    "Specify a CMake script if you wish to write your own compiler config.
     39     See CompilerConfigGCC.cmake or CompilerConfigMSVC.cmake for examples.")
     40IF(COMPILER_CONFIG_USER_SCRIPT)
     41  IF(EXISTS ${CMAKE_MODULE_PATH}/${COMPILER_CONFIG_USER_SCRIPT})
     42    INCLUDE(${CMAKE_MODULE_PATH}/${COMPILER_CONFIG_USER_SCRIPT})
    11543  ENDIF()
    116 ENDIF(USER_SCRIPT_BUILD_CONFIG)
    117 
    118 
    119 ############# Installation Settings #############
    120 
    121 SET(_info_text "Puts all installed files in subfolders of the install prefix path. That root folder can then be moved, copied and renamed as you wish. The executable will not write to folders like ~/.orxonox or \"Applictation Data\"")
    122 IF(UNIX)
    123   OPTION(INSTALL_COPYABLE "${_info_text}" FALSE)
    124 ELSE()
    125   OPTION(INSTALL_COPYABLE "${_info_text}" TRUE)
    126 ENDIF()
    127 
    128 # Default installation paths
    129 SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_RUNTIME_PATH})
    130 SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
    131 SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
    132 SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
    133 SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH})
    134 SET(CONFIG_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_CONFIG_PATH})
    135 SET(LOG_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LOG_PATH})
    136 
    137 IF(NOT INSTALL_COPYABLE)
    138   IF(UNIX) # Apple too?
    139     # Using absolute paths
    140     SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
    141     SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
    142     SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
    143     SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
    144     SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/share/orxonox)
    145   ENDIF()
    146 
    147   # Leave empty because it is user and therefore runtime dependent
    148   SET(CONFIG_INSTALL_DIRECTORY)
    149   SET(LOG_INSTALL_DIRECTORY)
    150 ENDIF()
    151 
    152 
    153 ################## Unix rpath ###################
    154 
    155 # use, i.e. don't skip the full RPATH for the build tree
    156 SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
    157 
    158 # when building, don't use the install RPATH already
    159 # (but later on when installing)
    160 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
    161 
    162 # the RPATH to be used when installing
    163 IF(INSTALL_COPYABLE)
    164   SET(CMAKE_INSTALL_RPATH ${DEFAULT_LIBRARY_PATH})
    165 ELSE()
    166   SET(CMAKE_INSTALL_RPATH ${LIBRARY_INSTALL_DIRECTORY})
    167 ENDIF()
    168 
    169 # add the automatically determined parts of the RPATH
    170 # which point to directories outside the build tree to the install RPATH
    171 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
    172 
    173 
    174 ################ Various options ################
    175 
    176 # Enable expensive optimisations: Use this for a binary release build
    177 OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
    178 
    179 # Use WinMain() or main()?
    180 IF(WIN32)
    181   OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
    182 ENDIF()
    183 
    184 # Global switch to disable Precompiled Header Files
    185 IF(PCH_COMPILER_SUPPORT)
    186   OPTION(PCH_ENABLE "Global PCH switch" TRUE)
    187 ENDIF()
    188 
    189 
    190 ############ Static/Dynamic linking #############
    191 
    192 # Default linking is SHARED
    193 SET(ORXONOX_DEFAULT_LINK SHARED)
    194 
    195 # Disable Boost auto linking completely
    196 ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
    197 
    198 # If no defines are specified, these libs get linked statically
    199 ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
    200 ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
    201 ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
    202 ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
    203 
    204 # If no defines are specified, these libs get linked dynamically
    205 # You can change that optionally in the Cache.
    206 ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
    207 ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
    208 ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
     44ENDIF(COMPILER_CONFIG_USER_SCRIPT)
  • code/branches/resource2/cmake/CompilerConfigGCC.cmake

    r5662 r5664  
    2323 #    Sets the right compiler and linker flags for GCC.
    2424 #
     25
     26INCLUDE(FlagUtilities)
    2527
    2628# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
  • code/branches/resource2/cmake/CompilerConfigMSVC.cmake

    r5662 r5664  
    2323 #    Sets the right compiler and linker flags for the Microsoft Compiler.
    2424 #
     25
     26INCLUDE(FlagUtilities)
    2527
    2628################### Compiler Version ####################
  • code/branches/resource2/cmake/InstallConfig.cmake

    r5662 r5664  
    2121 #    Reto Grieder
    2222 #  Description:
    23  #    Configures the compilers and sets build options.
    24  #    This also includes handling the OGRE plugins and the data directory.
     23 #    Configures the installation (paths, rpaths, options)
    2524 #
    26 
    27 ################# Misc Settings #################
    28 
    29 # Standard path suffixes, might not hold everywhere though
    30 SET(DEFAULT_RUNTIME_PATH bin)
    31 SET(DEFAULT_LIBRARY_PATH lib)
    32 SET(DEFAULT_ARCHIVE_PATH lib/static)
    33 SET(DEFAULT_DOC_PATH     doc)
    34 SET(DEFAULT_DATA_PATH    data)
    35 SET(DEFAULT_CONFIG_PATH  config)
    36 SET(DEFAULT_LOG_PATH     log)
    37 
    38 # Set output directories
    39 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
    40 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
    41 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
    42 SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
    43 # Data directories are only inputs
    44 SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
    45 SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
    46 
    47 # Take care of some CMake 2.6.0 leftovers
    48 MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
    49 
    50 # Sets where to find the external libraries like OgreMain.dll at runtime
    51 # On Unix you should not have to change this at all.
    52 IF(NOT RUNTIME_LIBRARY_DIRECTORY)
    53   SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
    54 ENDIF()
    55 
    56 # Set Debug build to default when not having multi-config generator like msvc
    57 IF(NOT CMAKE_CONFIGURATION_TYPES)
    58   IF(NOT CMAKE_BUILD_TYPE)
    59     SET(CMAKE_BUILD_TYPE Debug CACHE STRING
    60         "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
    61   ENDIF()
    62   MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
    63 
    64   MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
    65 ELSE()
    66   IF(CMAKE_BUILD_TYPE)
    67     SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
    68   ENDIF()
    69   MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
    70 ENDIF()
    71 
    72 
    73 ################# OGRE Plugins ##################
    74 
    75 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
    76 SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
    77 IF(WIN32)
    78   # CG program manager is probably DirectX related (not available under unix)
    79   LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
    80 ENDIF(WIN32)
    81 SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
    82    "Specify which OGRE plugins to load. Existance check is performed.")
    83 
    84 # Check the plugins and determine the plugin folder
    85 # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
    86 INCLUDE(CheckOGREPlugins)
    87 CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
    88 
    89 
    90 ################ Compiler Config ################
    91 
    92 OPTION(EXTRA_COMPILER_WARNINGS "Enable some extra warnings (heavily pollutes the output)" FALSE)
    93 
    94 INCLUDE(FlagUtilities)
    95 
    96 # Configure the compiler specific build options
    97 IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
    98   INCLUDE(BuildConfigGCC)
    99 ELSEIF(MSVC)
    100   INCLUDE(BuildConfigMSVC)
    101 ELSE()
    102   MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
    103 ENDIF()
    104 
    105 SET(USER_SCRIPT_BUILD_CONFIG "" CACHE FILEPATH
    106     "Specify a CMake script if you wish to write your own build config.
    107      See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
    108 IF(USER_SCRIPT_BUILD_CONFIG)
    109   IF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG}.cmake)
    110     INCLUDE(${USER_SCRIPT_BUILD_CONFIG})
    111   ELSEIF(EXISTS ${USER_SCRIPT_BUILD_CONFIG})
    112     INCLUDE(${USER_SCRIPT_BUILD_CONFIG})
    113   ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG})
    114     INCLUDE(${CMAKE_MODULE_PATH}/${USER_SCRIPT_BUILD_CONFIG})
    115   ENDIF()
    116 ENDIF(USER_SCRIPT_BUILD_CONFIG)
    117 
    118 
    119 ############# Installation Settings #############
    12025
    12126SET(_info_text "Puts all installed files in subfolders of the install prefix path. That root folder can then be moved, copied and renamed as you wish. The executable will not write to folders like ~/.orxonox or \"Applictation Data\"")
     
    15055ENDIF()
    15156
    152 
    15357################## Unix rpath ###################
    15458
    155 # use, i.e. don't skip the full RPATH for the build tree
    156 SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
    157 
    158 # when building, don't use the install RPATH already
     59# When building, don't use the install RPATH already
    15960# (but later on when installing)
    16061SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
    16162
    162 # the RPATH to be used when installing
     63# The RPATH to be used when installing
    16364IF(INSTALL_COPYABLE)
    16465  SET(CMAKE_INSTALL_RPATH ${DEFAULT_LIBRARY_PATH})
     
    16768ENDIF()
    16869
    169 # add the automatically determined parts of the RPATH
     70# Add the automatically determined parts of the RPATH
    17071# which point to directories outside the build tree to the install RPATH
    17172SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
    172 
    173 
    174 ################ Various options ################
    175 
    176 # Enable expensive optimisations: Use this for a binary release build
    177 OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
    178 
    179 # Use WinMain() or main()?
    180 IF(WIN32)
    181   OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
    182 ENDIF()
    183 
    184 # Global switch to disable Precompiled Header Files
    185 IF(PCH_COMPILER_SUPPORT)
    186   OPTION(PCH_ENABLE "Global PCH switch" TRUE)
    187 ENDIF()
    188 
    189 
    190 ############ Static/Dynamic linking #############
    191 
    192 # Default linking is SHARED
    193 SET(ORXONOX_DEFAULT_LINK SHARED)
    194 
    195 # Disable Boost auto linking completely
    196 ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
    197 
    198 # If no defines are specified, these libs get linked statically
    199 ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
    200 ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
    201 ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
    202 ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
    203 
    204 # If no defines are specified, these libs get linked dynamically
    205 # You can change that optionally in the Cache.
    206 ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
    207 ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
    208 ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
  • code/branches/resource2/cmake/LibraryConfig.cmake

    r3304 r5664  
    3131# Prevent CMake from finding libraries in the installation folder on Windows.
    3232# There might already be an installation from another compiler
    33 IF(DEPENDENCY_PACKAGE_ENABLE)
     33IF(WIN32)
    3434  LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH  "${CMAKE_INSTALL_PREFIX}")
    3535  LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
     
    7272
    7373# User script
    74 SET(USER_SCRIPT_LIBRARY_CONFIG "" CACHE FILEPATH
     74SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
    7575    "Specify a CMake script if you wish to write your own library path config.
    76      See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.")
    77 IF(USER_SCRIPT_LIBRARY_CONFIG)
    78   IF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_LIBRARY_CONFIG}.cmake)
    79     INCLUDE(${USER_SCRIPT_LIBRARY_CONFIG})
    80   ELSEIF(EXISTS ${USER_SCRIPT_LIBRARY_CONFIG})
    81     INCLUDE(${USER_SCRIPT_LIBRARY_CONFIG})
    82   ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${USER_SCRIPT_LIBRARY_CONFIG})
    83     INCLUDE(${CMAKE_MODULE_PATH}/${USER_SCRIPT_LIBRARY_CONFIG})
    84   ENDIF()
    85 ENDIF(USER_SCRIPT_LIBRARY_CONFIG)
     76     See LibraryConfigTardis.cmake for an example.")
     77IF(LIBRARY_CONFIG_USER_SCRIPT)
     78  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
     79    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
     80  ENDIF()
     81ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
    8682
    8783
     
    185181  ENDIF()
    186182ENDIF(WIN32)
     183
     184
     185################# OGRE Plugins ##################
     186
     187# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
     188SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
     189IF(WIN32)
     190  # CG program manager is probably DirectX related (not available under unix)
     191  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
     192ENDIF(WIN32)
     193SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
     194   "Specify which OGRE plugins to load. Existance check is performed.")
     195
     196# Check the plugins and determine the plugin folder
     197# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
     198INCLUDE(CheckOGREPlugins)
     199CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
     200
  • code/branches/resource2/src/CMakeLists.txt

    r3368 r5664  
    1717 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    1818 #
     19 #
     20 #  Author:
     21 #    Reto Grieder
     22 #  Description:
     23 #    Configures the compilers and sets build options.
     24 #
    1925
    20 ################ Various Options ################
    21 
    22 # various macro includes
     26# Required macros and functions
    2327INCLUDE(FlagUtilities)
    2428INCLUDE(TargetUtilities)
    2529
     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("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
     41ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
     42ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
     43ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
     44# If no defines are specified, these libs get linked dynamically
     45ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
     46ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
     47ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
     48
    2649# Use TinyXML++
    2750ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
    28 # OIS dynamic linking requires macro definition, at least for Windows
    29 ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
    30 
    31 ################ OrxonoxConfig.h ################
    32 
    33 # Check endianness
    34 INCLUDE(TestBigEndian)
    35 TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
    36 IF(NOT ORXONOX_BIG_ENDIAN)
    37   SET(ORXONOX_LITTLE_ENDIAN TRUE)
    38 ENDIF()
    39 
    40 # 32/64 bit system check
    41 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
    42   SET(ORXONOX_ARCH_64 TRUE)
    43 ELSE()
    44   SET(ORXONOX_ARCH_32 TRUE)
    45 ENDIF()
    46 
    47 # Platforms
    48 SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
    49 SET(ORXONOX_PLATFORM_APPLE ${APPLE})
    50 SET(ORXONOX_PLATFORM_UNIX ${UNIX})
    51 IF(UNIX AND NOT APPLE)
    52   SET(ORXONOX_PLATFORM_LINUX TRUE)
    53 ENDIF()
    54 
    55 # Check __forceinline
    56 IF(MSVC)
    57   INCLUDE(CheckCXXSourceCompiles)
    58   SET(_source "int main() { return 0; } __forceinline void test() { return; }")
    59   CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
    60 ENDIF(MSVC)
    61 
    62 # Check ciso646 include (literal operators)
    63 INCLUDE(CheckIncludeFileCXX)
    64 CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
    65 
    66 # XCode and Visual Studio support multiple configurations. In order to tell the
    67 # which one we have to define the macros separately for each configuration
    68 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug"          Debug)
    69 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release"        Release)
    70 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo)
    71 ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel"     MinSizeRel)
    72 
    73 SET(GENERATED_FILE_COMMENT
    74    "DO NOT EDIT THIS FILE! <br>
    75     It has been automatically generated by CMake from OrxonoxConfig.h.in")
    76 # Copy and configure OrxonoxConfig which gets included in every file
    77 CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
    78 # This file only gets included by very few classes to avoid a large recompilation
    79 CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
    80 
    81 SET(ORXONOX_CONFIG_FILES
    82   ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
    83   ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
    84   ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
    85   ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
    86 )
    8751
    8852############## Include Directories ##############
  • code/branches/resource2/src/OrxonoxConfig.cmake

    r5662 r5664  
    1717 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    1818 #
     19 #
     20 #  Author:
     21 #    Reto Grieder
     22 #  Description:
     23 #    Configures the header files OrxonoxConfig.h and SpecialConfig.h
     24 #    and sets some other options. All the build related options should be
     25 #    found and set here if possible.
     26 #
    1927
    20 ################ Various Options ################
     28#################### Options ####################
    2129
    22 # various macro includes
    23 INCLUDE(FlagUtilities)
    24 INCLUDE(TargetUtilities)
     30# Default linking is SHARED
     31SET(ORXONOX_DEFAULT_LINK SHARED)
    2532
    26 # Use TinyXML++
    27 ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
    28 # OIS dynamic linking requires macro definition, at least for Windows
    29 ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
     33# Use, i.e. don't skip the full RPATH for the build tree
     34SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
    3035
    31 ################ OrxonoxConfig.h ################
     36# Global switch to disable Precompiled Header Files
     37IF(PCH_COMPILER_SUPPORT)
     38  OPTION(PCH_ENABLE "Global PCH switch" TRUE)
     39ENDIF()
     40
     41# Enable expensive optimisations: use this for a binary release build
     42OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
     43
     44# Use WinMain() or main()?
     45IF(WIN32)
     46  OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
     47ENDIF()
     48
     49################ Platform Config ################
    3250
    3351# Check endianness
     
    6078ENDIF(MSVC)
    6179
    62 # Check ciso646 include (literal operators)
     80# Check iso646.h include (literal operators)
    6381INCLUDE(CheckIncludeFileCXX)
    6482CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
    6583
    66 # XCode and Visual Studio support multiple configurations. In order to tell the
    67 # which one we have to define the macros separately for each configuration
     84# XCode and Visual Studio support multiple configurations. In order to tell
     85# about the active one we have to define the macro for each configuration
    6886ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug"          Debug)
    6987ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release"        Release)
    7088ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo)
    7189ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel"     MinSizeRel)
     90
     91############## Configured Headers ###############
    7292
    7393SET(GENERATED_FILE_COMMENT
     
    85105  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
    86106)
    87 
    88 ############## Include Directories ##############
    89 
    90 # Set the search paths for include files
    91 INCLUDE_DIRECTORIES(
    92   # External
    93   ${OGRE_INCLUDE_DIR}
    94   ${CEGUI_INCLUDE_DIR}
    95   ${ENET_INCLUDE_DIR}
    96   ${Boost_INCLUDE_DIRS}
    97   ${OPENAL_INCLUDE_DIRS}
    98   ${ALUT_INCLUDE_DIR}
    99   ${VORBIS_INCLUDE_DIR}
    100   ${OGG_INCLUDE_DIR}
    101   ${LUA_INCLUDE_DIR}
    102   ${TCL_INCLUDE_PATH}
    103   ${DIRECTX_INCLUDE_DIR}
    104   ${ZLIB_INCLUDE_DIR}
    105   ${VLD_INCLUDE_DIR}
    106 
    107   # All library includes are prefixed with the path to avoid conflicts
    108   ${CMAKE_CURRENT_SOURCE_DIR}
    109   # Bullet headers really need the include directory
    110   ${CMAKE_CURRENT_SOURCE_DIR}/bullet
    111   # OIS headers need the root dir as well
    112   ${CMAKE_CURRENT_SOURCE_DIR}/ois
    113   # Convenience directory
    114   ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
    115   # OrxonoxConfig.h
    116   ${CMAKE_CURRENT_BINARY_DIR}
    117   # Tolua bind files for Core
    118   ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
    119   # Tolua bind files for Orxonox
    120   ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
    121 )
    122 
    123 
    124 ################ Sub Directories ################
    125 
    126 # Third party libraries
    127 ADD_SUBDIRECTORY(tolua)
    128 
    129 # Include CEGUILua if not requested otherwise
    130 IF(CEGUILUA_USE_INTERNAL_LIBRARY)
    131   IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
    132     MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
    133   ENDIF()
    134 
    135   INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
    136   ADD_SUBDIRECTORY(ceguilua)
    137 ENDIF()
    138 
    139 ADD_SUBDIRECTORY(bullet)
    140 ADD_SUBDIRECTORY(cpptcl)
    141 ADD_SUBDIRECTORY(ogreceguirenderer)
    142 ADD_SUBDIRECTORY(ois)
    143 ADD_SUBDIRECTORY(tinyxml)
    144 
    145 # Orxonox code
    146 ADD_SUBDIRECTORY(util)
    147 ADD_SUBDIRECTORY(core)
    148 ADD_SUBDIRECTORY(network)
    149 ADD_SUBDIRECTORY(orxonox)
Note: See TracChangeset for help on using the changeset viewer.