Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2612 for code/branches


Ignore:
Timestamp:
Jan 29, 2009, 10:04:38 PM (16 years ago)
Author:
rgrieder
Message:

Rearranged CMake configuration code. I split serveral files in two and moved some code around.
There are no actual code changes!

Details:

  • Everything that involves library finding is in LibraryConfig.cmake. It includes other LibraryConfigXXX.cmake files that set specific options for certain platforms or package configurations (like MSVC or MinGW dependency package).
  • All build related code is in BuildConfig.cmake. The actual compiler configuration is done in BuildConfigXXX.cmake where XXX can be GCC or MSVC.
  • The changes above implied splitting FindOGRE.cmake in two (was going to do it anyway, but rather in a later commit) so that CheckOGREPlugins.cmake is now a separate module.
Location:
code/branches/buildsystem2
Files:
2 edited
4 copied
4 moved

Legend:

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

    r2599 r2612  
    1616SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
    1717
    18 # Set binary output directories
    19 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    20 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    21 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
     18# Library Config
     19INCLUDE(LibraryConfig)
    2220
    23 # Set Debug build to default when not having multi-config generator like msvc
    24 IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    25   SET(CMAKE_BUILD_TYPE "Debug")
    26 ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     21# Build Config
     22INCLUDE(BuildConfig)
    2723
    28 ############## Platform Config ##################
    29 
    30 # Configure platform specific options
    31 INCLUDE(ConfigPlatforms)
    32 
    33 ################ Test options ###################
    34 
    35 OPTION(ENABLE_TESTS "Enable build tests.")
    36 IF(ENABLE_TESTS)
    37   ENABLE_TESTING()
    38 ENDIF(ENABLE_TESTS)
    39 
    40 OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
    41 OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
    42 
    43 ############### Library finding #################
    44 
    45 # Performs the search and sets the variables
    46 
    47 # Expand the next statement if newer boost versions than 1.36.1 are released
    48 SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 CACHE STRING "")
    49 FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
    50 # With MSVC, automatic linking is performed for boost. So wee need to tell
    51 # the linker where to find them. Also note that when running FindBoost for the
    52 # first time, it will set ${Boost_LIBRARIES} to "" but afterwards to the libs.
    53 IF (MSVC)
    54   LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
    55 ENDIF (MSVC)
    56 FIND_PACKAGE(OGRE REQUIRED)
    57 FIND_PACKAGE(CEGUI REQUIRED)
    58 FIND_PACKAGE(ENet REQUIRED)
    59 FIND_PACKAGE(OpenAL REQUIRED)
    60 FIND_PACKAGE(ALUT REQUIRED)
    61 FIND_PACKAGE(OggVorbis REQUIRED)
    62 FIND_PACKAGE(ZLIB REQUIRED)
    63 FIND_PACKAGE(DirectX REQUIRED)
    64 
    65 # Require Lua 5.0 or 5.1
    66 FIND_PACKAGE(Lua50 QUIET)
    67 IF(NOT LUA50_FOUND)
    68   # Remove variables set by Lua50 and try with Lua51
    69   SET(LUA_INCLUDE_DIR)
    70   SET(LUA_LIBRARY_lua)
    71   SET(LUA_LIBRARY_lualib)
    72   SET(LUA_LIBRARIES)
    73   FIND_PACKAGE(Lua51 REQUIRED)
    74 ENDIF(NOT LUA50_FOUND)
    75 # Determine Lua version (Lua50 may also find Lua51)
    76 FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION")
    77 STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}")
    78 
    79 # QUIET: Don't require the whole tcl rat tail
    80 FIND_PACKAGE(TCL QUIET)
    81 IF(NOT TCL_FOUND)
    82   MESSAGE(FATAL_ERROR "Tcl was not found.")
    83 ENDIF(NOT TCL_FOUND)
    84 
    85 # Hide variables created by CMake FindXX scripts
    86 MARK_AS_ADVANCED(
    87   LUA_LIBRARY_lua
    88   LUA_LIBRARY_lualib
    89   OPENAL_INCLUDE_DIR
    90   OPENAL_LIBRARY
    91 )
    92 
    93 ############### Orxonox Source ##################
    94 
     24# Creates the actual project
    9525ADD_SUBDIRECTORY(src)
    9626
  • code/branches/buildsystem2/cmake/BuildConfig.cmake

    r2611 r2612  
    2525 #      ...
    2626 #
    27  
    28 # If you want to set specific options for your platform, simply
    29 # create a file called "ConfigUser.cmake" in the binary folder
    30 # (see at the bottom of the file)
    3127
    32 ############ Misc Default Options ###############
     28################ Misc Options ###################
     29
     30# Set binary output directories
     31SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
     32SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
     33SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
     34
     35# Set Debug build to default when not having multi-config generator like msvc
     36IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     37  SET(CMAKE_BUILD_TYPE "Debug")
     38ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    3339
    3440# When searching for debug libraries, this is appended to the libarary name
     
    5561ENDIF(WIN32)
    5662
     63# Check the plugins and determine the plugin folder
     64# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
     65INCLUDE(CheckOGREPlugins)
    5766
    58 ###### Default Compiler/Linker Options ##########
    59 # Most people use GCC to compile orxonox, so use that as default
    6067
    61 SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS} -fPIC")
    62 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC")
    63 # These flags are added to the flags above
    64 SET(CMAKE_C_FLAGS_DEBUG            "    -g -ggdb")
    65 SET(CMAKE_CXX_FLAGS_DEBUG          "    -g -ggdb")
    66 SET(CMAKE_C_FLAGS_RELEASE          "-O3          -DNDEBUG")
    67 SET(CMAKE_CXX_FLAGS_RELEASE        "-O3          -DNDEBUG")
    68 SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -ggdb -DNDEBUG")
    69 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG")
    70 SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os          -DNDEBUG")
    71 SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os          -DNDEBUG")
     68############## Compiler Config ##################
     69INCLUDE(BuildConfigGCC)
     70INCLUDE(BuildConfigMSVC)
     71# User can create his own file if required
     72IF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
     73  INCLUDE(${CMAKE_BINARY_DIR}/BuildConfigUser)
     74ENDIF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
    7275
    73 SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
    74 SET(CMAKE_EXE_LINKER_FLAGS    " --no-undefined")
    75 SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
    76 SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
     76
     77################ Test options ###################
     78
     79OPTION(ENABLE_TESTS "Enable build tests.")
     80IF(ENABLE_TESTS)
     81  ENABLE_TESTING()
     82ENDIF(ENABLE_TESTS)
     83
     84OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
     85OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
     86
     87
     88################### Macros ######################
    7789
    7890# Also define macros to easily extend the compiler flags
     
    88100  ENDIF(${_cond})
    89101ENDMACRO(ADD_C_FLAGS _flag)
    90 
    91 ########## Plaform Specific Config ##############
    92 
    93 # Set the platform specific options and paths
    94 INCLUDE(ConfigTardis)
    95 INCLUDE(ConfigMSVC)
    96 INCLUDE(ConfigMinGW)
    97 # User can create his own file if required
    98 IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
    99   INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser)
    100 ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
  • code/branches/buildsystem2/cmake/BuildConfigGCC.cmake

    r2611 r2612  
    2525 #      ...
    2626 #
    27  
    28 # If you want to set specific options for your platform, simply
    29 # create a file called "ConfigUser.cmake" in the binary folder
    30 # (see at the bottom of the file)
    31 
    32 ############ Misc Default Options ###############
    33 
    34 # When searching for debug libraries, this is appended to the libarary name
    35 SET(LIBRARY_DEBUG_POSTFIX "_d")
    36 # Sets where to find the binary directory of external libraries
    37 SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
    38 # Working directory for the tolua parser. Adjust for windows because lua.dll has to be there!
    39 SET(TOLUA_PARSER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
    40 
    41 OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
    42 IF(EXTRA_WARNINGS)
    43   SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter")
    44 ELSE(EXTRA_WARNINGS)
    45   SET(ORXONOX_WARNING_FLAGS "-Wall")
    46 ENDIF(EXTRA_WARNINGS)
    47 
    48 SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media")
    49 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
    50 # Render systems may be optional, but at least one has to be found in FindOgre
    51 SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
    52 IF(WIN32)
    53   # CG program manager is probably DirectX related (not available under unix)
    54   LIST(APPEND OGRE_PLUGINS Plugin_CgProgramManager)
    55 ENDIF(WIN32)
    56 
    5727
    5828###### Default Compiler/Linker Options ##########
     
    7545SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
    7646SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
    77 
    78 # Also define macros to easily extend the compiler flags
    79 # Additional argument is a condition
    80 MACRO(ADD_CXX_FLAGS _flag _cond)
    81   IF(${_cond})
    82     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
    83   ENDIF(${_cond})
    84 ENDMACRO(ADD_CXX_FLAGS _flag)
    85 MACRO(ADD_C_FLAGS _flag)
    86   IF(${_cond})
    87     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
    88   ENDIF(${_cond})
    89 ENDMACRO(ADD_C_FLAGS _flag)
    90 
    91 ########## Plaform Specific Config ##############
    92 
    93 # Set the platform specific options and paths
    94 INCLUDE(ConfigTardis)
    95 INCLUDE(ConfigMSVC)
    96 INCLUDE(ConfigMinGW)
    97 # User can create his own file if required
    98 IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
    99   INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser)
    100 ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake)
  • code/branches/buildsystem2/cmake/BuildConfigMSVC.cmake

    r2611 r2612  
    3232
    3333IF (MSVC)
    34   MESSAGE(STATUS "Running on MSVC. Using customized paths and options.")
    35 
    36   ###################### Libraries ########################
    37 
    38   # Determine library directory
    39   IF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
    40     SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8")
    41   ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8)
    42     SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8")
    43   ELSE(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
    44     MESSAGE(FATAL_ERROR "Could not find dependency directory for the Visual Studio libraries")
    45   ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
    46   SET(ORXONOX_LIBRARY_BIN_DIR ${MSVC_LIBRARY_DIR}/bin)
    47 
    48   # Set variables for the include directories and the libraries
    49   # Note: When setting ENV${} variables, make sure to use quotes when
    50   #       having multiple directories.
    51   SET(ENV{BOOST_ROOT}        ${MSVC_LIBRARY_DIR}/boost-1.35.0)
    52   SET(ENV{CEGUIDIR}          ${MSVC_LIBRARY_DIR}/cegui-0.6.1)
    53   SET(ENV{ENETDIR}           ${MSVC_LIBRARY_DIR}/enet-1.2)
    54   SET(ENV{ALUTDIR}           ${MSVC_LIBRARY_DIR}/freealut-1.1.0)
    55   SET(ENV{OGGDIR}            ${MSVC_LIBRARY_DIR}/libogg-1.1.3)
    56   SET(ENV{VORBISDIR}         ${MSVC_LIBRARY_DIR}/libvorbis-1.2.0)
    57   SET(ENV{OPENALDIR}         ${MSVC_LIBRARY_DIR}/openal-1.1)
    58   SET(ENV{LUA_DIR}           ${MSVC_LIBRARY_DIR}/lua-5.1.3)
    59   SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${ORXONOX_LIBRARY_BIN_DIR}")
    60   SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include)
    61   SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
    62   # Do some hacking to avoid "Tclsh not found" message
    63   SET(TCL_TCLSH              ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
    64   SET(ZLIB_INCLUDE_DIR       ${MSVC_LIBRARY_DIR}/zlib-1.2.3/include)
    65   SET(ZLIB_LIBRARY optimized ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib.lib
    66                    debug     ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib_d.lib)
    67   SET(ZLIB_FOUND TRUE)
    6834
    6935  #################### Compiler Flags #####################
     
    12288  SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL     "${MSVC_LINKER_FLAGS_RELEASE}")
    12389
    124   ######################### Misc ##########################
    125 
    126   # Set tolua working directory because lua.dll is not where tolua is
    127   SET(TOLUA_PARSER_WORKING_DIRECTORY ${ORXONOX_LIBRARY_BIN_DIR})
    12890ENDIF (MSVC)
  • code/branches/buildsystem2/cmake/CheckOGREPlugins.cmake

    r2611 r2612  
    1 # Find OGRE includes and library
    2 #
    3 # This module defines
    4 #  OGRE_INCLUDE_DIR
    5 #  OGRE_LIBRARY, the library to link against to use OGRE.
    6 #  OGRE_FOUND, If false, do not try to use OGRE
    7 #
    8 # Copyright © 2007, Matt Williams
    9 # Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture of the ETH Zurich
    10 #
    11 # Redistribution and use is allowed according to the terms of the BSD license.
    12 #
    13 # Several changes and additions by Fabian 'x3n' Landau
    14 # Lots of simplifications by Adrian Friedli
    15 # Plugin checking by Reto Grieder
    16 #                 > www.orxonox.net <
    17 
    18 INCLUDE(FindPackageHandleStandardArgs)
    19 INCLUDE(HandleLibraryTypes)
    20 
    21 FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
    22     PATHS $ENV{OGRE_HOME} /usr/local /usr
    23     PATH_SUFFIXES include include/OGRE
    24 )
    25 FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
    26     NAMES OgreMain
    27     PATHS $ENV{OGRE_HOME} /usr/local /usr
    28     PATH_SUFFIXES lib bin/Release bin/release Release release
    29 )
    30 FIND_LIBRARY(OGRE_LIBRARY_DEBUG
    31     NAMES OgreMain${LIBRARY_DEBUG_POSTFIX}
    32     PATHS $ENV{OGRE_HOME} /usr/local /usr
    33     PATH_SUFFIXES lib bin/Debug bin/debug Debug debug
    34 )
    35 
    36 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGRE DEFAULT_MSG
    37     OGRE_LIBRARY_OPTIMIZED
    38     OGRE_INCLUDE_DIR
    39 )
    40 
    41 # Set optimized and debug libraries
    42 HandleLibraryTypes(OGRE)
    43 
    44 ###############################################
    45 # Also make sure we have the required plugins #
    46 ###############################################
    47 
    481IF(WIN32)
    492    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
     
    11669STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
    11770STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
    118 
    119 
    120 MARK_AS_ADVANCED(
    121     OGRE_LIBRARY
    122     OGRE_LIBRARY_OPTIMIZED
    123     OGRE_LIBRARY_DEBUG
    124     OGRE_INCLUDE_DIR
    125 )
  • code/branches/buildsystem2/cmake/FindOGRE.cmake

    r2594 r2612  
    4242HandleLibraryTypes(OGRE)
    4343
    44 ###############################################
    45 # Also make sure we have the required plugins #
    46 ###############################################
    47 
    48 IF(WIN32)
    49     # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
    50     SET(CMAKE_FIND_LIBRARY_SUFFIXES_STORED ${CMAKE_FIND_LIBRARY_SUFFIXES})
    51     SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
    52 ENDIF(WIN32)
    53 SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED "${CMAKE_FIND_LIBRARY_PREFIXES}")
    54 SET(CMAKE_FIND_LIBRARY_PREFIXES "")
    55 
    56 SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
    57 FOREACH(_plugin ${OGRE_PLUGINS})
    58     FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
    59         NAMES ${_plugin}
    60         PATHS $ENV{OGRE_HOME} /usr/local /usr
    61         PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
    62     )
    63     FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
    64         NAMES ${_plugin}${LIBRARY_DEBUG_POSTFIX}
    65         PATHS $ENV{OGRE_HOME} /usr/local /usr
    66         PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
    67     )
    68     # We only need at least one render system. Check at the end
    69     IF(NOT ${_plugin} MATCHES "RenderSystem")
    70         IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    71             MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
    72         ENDIF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    73     ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    74       SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
    75     ENDIF(NOT ${_plugin} MATCHES "RenderSystem")
    76 
    77     IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    78         # If debug version is not available, release will do as well
    79         IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    80             SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "" FORCE)
    81         ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    82         MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
    83 
    84         ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
    85         # Check and set the folders
    86         GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
    87         IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    88             MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
    89         ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    90         SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
    91         GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
    92         IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    93             MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
    94         ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    95         SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
    96 
    97         # Create a list with the plugins for relase and debug configurations
    98         LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
    99         IF(OGRE_PLUGIN_${_plugin}_DEBUG)
    100             LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
    101         ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
    102             LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
    103         ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
    104     ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    105 ENDFOREACH(_plugin)
    106 IF(NOT OGRE_RENDER_SYSTEM_FOUND)
    107     MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
    108 ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
    109 IF(WIN32)
    110     # Restore previous settings (see above before FOREACH)
    111     SET(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_STORED}")
    112 ENDIF(WIN32)
    113 SET(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES_STORED}")
    114 
    115 # List has to be comma separated for orxonox.ini
    116 STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
    117 STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
    118 
    119 
    12044MARK_AS_ADVANCED(
    12145    OGRE_LIBRARY
  • code/branches/buildsystem2/cmake/LibraryConfig.cmake

    r2611 r2612  
    1 PROJECT(Orxonox C CXX)
    2 
    3 CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
    4 
    5 SET(ORXONOX_VERSION_MAJOR 0)
    6 SET(ORXONOX_VERSION_MINOR 1)
    7 SET(ORXONOX_VERSION_PATCH 0)
    8 SET(ORXONOX_VERSION 0.1.0)
    9 
    10 # Keep devs from using the root directory as binary directory (messes up the source tree)
    11 IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
    12   MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
    13 ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
    14 
    15 # This sets where to look for modules (e.g. "Find*.cmake" files)
    16 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
    17 
    18 # Set binary output directories
    19 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    20 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    21 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    22 
    23 # Set Debug build to default when not having multi-config generator like msvc
    24 IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    25   SET(CMAKE_BUILD_TYPE "Debug")
    26 ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    27 
    28 ############## Platform Config ##################
    29 
    30 # Configure platform specific options
    31 INCLUDE(ConfigPlatforms)
    32 
    33 ################ Test options ###################
    34 
    35 OPTION(ENABLE_TESTS "Enable build tests.")
    36 IF(ENABLE_TESTS)
    37   ENABLE_TESTING()
    38 ENDIF(ENABLE_TESTS)
    39 
    40 OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
    41 OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
    42 
    43 ############### Library finding #################
     1INCLUDE(LibraryConfigMinGW)
     2INCLUDE(LibraryConfigMSVC)
     3INCLUDE(LibraryConfigTardis)
    444
    455# Performs the search and sets the variables
     
    9050  OPENAL_LIBRARY
    9151)
    92 
    93 ############### Orxonox Source ##################
    94 
    95 ADD_SUBDIRECTORY(src)
    96 
    97 # Configure the binary output directory
    98 ADD_SUBDIRECTORY(bin-config)
  • code/branches/buildsystem2/cmake/LibraryConfigMSVC.cmake

    r2611 r2612  
    6767  SET(ZLIB_FOUND TRUE)
    6868
    69   #################### Compiler Flags #####################
    70 
    71   # /MD    Minimal Rebuild
    72   # /RTC1  Both basic runtime checks
    73   # /MD[d] Multithreaded [debug] DLL
    74   # /Zi    Program Database
    75   # /ZI    Program Database for Edit & Continue
    76   # /WX    Warning Level X
    77   # /wdX   Disable specific warning X
    78   SET(MSVC_CL_FLAGS "
    79     /D WIN32 /D __WIN32__ /D _WIN32 /D _WINDOWS
    80     /D BOOST_ALL_DYN_LINK
    81     /D OIS_DYNAMIC_LIB
    82     /D ZLIB_WINAPI
    83     /D LUA_BUILD_AS_DLL
    84     /D _CRT_SECURE_NO_WARNINGS
    85     /W3
    86     /EHsc
    87     /wd4522
    88     /wd4251
    89     /wd4800
    90   ")
    91   SET(CMAKE_C_FLAGS                  "${MSVC_CL_FLAGS}")
    92   SET(CMAKE_CXX_FLAGS                "${MSVC_CL_FLAGS}")
    93 
    94   # Note: ${CMAKE_C_FLAGS} get added to the specific ones
    95   SET(MSVC_CL_FLAGS_DEBUG            "/MDd /Od  /Zi /Gm /RTC1")
    96   SET(MSVC_CL_FLAGS_RELEASE          "/MD  /MP2 /D TOLUA_RELEASE")
    97   SET(CMAKE_C_FLAGS_DEBUG            "${MSVC_CL_FLAGS_DEBUG}")
    98   SET(CMAKE_CXX_FLAGS_DEBUG          "${MSVC_CL_FLAGS_DEBUG}")
    99   SET(CMAKE_C_FLAGS_RELEASE          "${MSVC_CL_FLAGS_RELEASE} /O2")
    100   SET(CMAKE_CXX_FLAGS_RELEASE        "${MSVC_CL_FLAGS_RELEASE} /O2")
    101   SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "${MSVC_CL_FLAGS_RELEASE} /O2 /Zi")
    102   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${MSVC_CL_FLAGS_RELEASE} /O2 /Zi")
    103   SET(CMAKE_C_FLAGS_MINSIZEREL       "${MSVC_CL_FLAGS_RELEASE} /O1")
    104   SET(CMAKE_CXX_FLAGS_MINSIZEREL     "${MSVC_CL_FLAGS_RELEASE} /O1")
    105 
    106   ##################### Linker Flags ######################
    107 
    108   SET(MSVC_LINKER_FLAGS                        "")
    109   SET(CMAKE_EXE_LINKER_FLAGS                   "${MSVC_LINKER_FLAGS}")
    110   SET(CMAKE_SHARED_LINKER_FLAGS                "${MSVC_LINKER_FLAGS}")
    111 
    112   # Note: ${CMAKE_EXE_LINKER_FLAGS} get added to the specific ones
    113   SET(MSVC_LINKER_FLAGS_DEBUG                  "/INCREMENTAL:YES")
    114   SET(MSVC_LINKER_FLAGS_RELEASE                "/INCREMENTAL:NO /OPT:REF /OPT:ICF")
    115   SET(CMAKE_EXE_LINKER_FLAGS_DEBUG             "${MSVC_LINKER_FLAGS_DEBUG}")
    116   SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG          "${MSVC_LINKER_FLAGS_DEBUG}")
    117   SET(CMAKE_EXE_LINKER_FLAGS_RELEASE           "${MSVC_LINKER_FLAGS_RELEASE}")
    118   SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE        "${MSVC_LINKER_FLAGS_RELEASE}")
    119   SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO    "${MSVC_LINKER_FLAGS_RELEASE}")
    120   SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${MSVC_LINKER_FLAGS_RELEASE}")
    121   SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL        "${MSVC_LINKER_FLAGS_RELEASE}")
    122   SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL     "${MSVC_LINKER_FLAGS_RELEASE}")
    123 
    12469  ######################### Misc ##########################
    12570
Note: See TracChangeset for help on using the changeset viewer.