Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 29, 2012, 5:49:02 PM (12 years ago)
Author:
landauf
Message:

moved common cmake config for src/ and test/ to SourceConfig.cmake

Location:
code/branches/testing/src
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/CMakeLists.txt

    r8729 r9473  
    2828INCLUDE(TargetUtilities)
    2929
     30INCLUDE(SourceConfig.cmake)
     31
    3032# Configure the two headers and set some options
    3133INCLUDE(OrxonoxConfig.cmake)
    32 
    33 ####### Library Behaviour (dependencies) ########
    34 
    35 # Disable auto linking completely for Boost and POCO
    36 ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
    37 ADD_COMPILER_FLAGS("-DPOCO_NO_AUTOMATIC_LIBS")
    38 
    39 IF(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")
    55 ENDIF(WIN32)
    56 
    57 # Visual Leak Dectector configuration
    58 IF(MSVC AND VLD_FOUND)
    59   OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" OFF)
    60   IF(VISUAL_LEAK_DETECTOR_ENABLE)
    61     # Force library linking by forcing the inclusion of a symbol
    62     ADD_LINKER_FLAGS("-INCLUDE:__imp_?vld@@3VVisualLeakDetector@@A" Debug)
    63     IF(MSVC90)
    64       # VS 2008 incremental linker crashes with /INCLUDE most of the time
    65       REMOVE_LINKER_FLAGS("-INCREMENTAL:YES" Debug)
    66       ADD_LINKER_FLAGS   ("-INCREMENTAL:NO"  Debug)
    67     ENDIF()
    68   ENDIF()
    69 ENDIF()
    70 
    71 ######### Library Behaviour (external) ##########
    72 
    73 # Use TinyXML++
    74 ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
    75 
    76 # Default linking for externals
    77 IF(CMAKE_BUILD_TYPE MATCHES "(Debug|RelForDevs)")
    78   SET(_default_link_mode "SHARED")
    79 ELSE()
    80   SET(_default_link_mode "STATIC")
    81 ENDIF()
    82 SET(_message "Link mode for external libraries that we build ourselves.
    83 MSVC Note: certain libraries will not be linked shared.")
    84 SET(ORXONOX_EXTERNAL_LINK_MODE "${_default_link_mode}" CACHE STRING "${_message}")
    85 
    86 IF(ORXONOX_EXTERNAL_LINK_MODE STREQUAL "SHARED")
    87   SET(_external_shared_link TRUE)
    88 ELSE()
    89   SET(_external_shared_link FALSE)
    90 ENDIF()
    91 # If no defines are specified, these libs get linked dynamically
    92 ADD_COMPILER_FLAGS("-DENET_DLL"                    WIN32     _external_shared_link)
    93 ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link)
    94 ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB"              WIN32 NOT _external_shared_link)
    95 
    96 ############## Include Directories ##############
    97 
    98 # Set the search paths for include files
    99 INCLUDE_DIRECTORIES(
    100   # OrxonoxConfig.h
    101   ${CMAKE_CURRENT_BINARY_DIR}
    102 
    103   # All includes in "externals" should be prefixed with the path
    104   # relative to "external" to avoid conflicts
    105   ${CMAKE_CURRENT_SOURCE_DIR}/external
    106   # Include directories needed even if only included by Orxonox
    107   ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
    108   ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
    109 
    110   # External
    111   ${OGRE_INCLUDE_DIR}
    112   ${CEGUI_INCLUDE_DIR}
    113   ${CEGUI_TOLUA_INCLUDE_DIR}
    114   #${ENET_INCLUDE_DIR}
    115   ${Boost_INCLUDE_DIRS}
    116   ${POCO_INCLUDE_DIR}
    117   ${OPENAL_INCLUDE_DIRS}
    118   ${ALUT_INCLUDE_DIR}
    119   ${VORBIS_INCLUDE_DIR}
    120   ${OGG_INCLUDE_DIR}
    121   ${LUA5.1_INCLUDE_DIR}
    122   ${TCL_INCLUDE_PATH}
    123   ${DIRECTX_INCLUDE_DIR}
    124   ${ZLIB_INCLUDE_DIR}
    125 )
    126 
    127 IF(CEGUI_OLD_VERSION)
    128   INCLUDE_DIRECTORIES(${CEGUILUA_INCLUDE_DIR})
    129 ENDIF()
    130 
    131 IF (DBGHELP_FOUND)
    132   INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR})
    133 ENDIF()
    134 
    135 IF(VISUAL_LEAK_DETECTOR_ENABLE)
    136   INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR})
    137 ENDIF()
    138 
    139 ############## CEGUI OGRE Renderer ##############
    140 
    141 IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
    142   SET(CEGUI_OGRE_RENDERER_LIBRARY ogreceguirenderer_orxonox)
    143 ENDIF()
    144 
    145 ################### Tolua Bind ##################
    146 
    147 # Add hook script to the lua code that generates the bindings
    148 SET(TOLUA_PARSER_HOOK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libraries/core/ToluaInterfaceHook.lua)
    149 SET(TOLUA_PARSER_DEPENDENCIES ${TOLUA_PARSER_DEPENDENCIES} ${TOLUA_PARSER_HOOK_SCRIPT})
    15034
    15135################ Sub Directories ################
  • code/branches/testing/src/SourceConfig.cmake

    r9470 r9473  
    2626# Required macros and functions
    2727INCLUDE(FlagUtilities)
    28 INCLUDE(TargetUtilities)
    29 
    30 # Configure the two headers and set some options
    31 INCLUDE(OrxonoxConfig.cmake)
    3228
    3329####### Library Behaviour (dependencies) ########
     
    148144SET(TOLUA_PARSER_HOOK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libraries/core/ToluaInterfaceHook.lua)
    149145SET(TOLUA_PARSER_DEPENDENCIES ${TOLUA_PARSER_DEPENDENCIES} ${TOLUA_PARSER_HOOK_SCRIPT})
    150 
    151 ################ Sub Directories ################
    152 
    153 ADD_SUBDIRECTORY(external)
    154 ADD_SUBDIRECTORY(libraries)
    155 ADD_SUBDIRECTORY(orxonox)
    156 SET(ORXONOX_MODULES CACHE INTERNAL "")
    157 ADD_SUBDIRECTORY(modules)
    158 
    159 ################## Executable ###################
    160 
    161 INCLUDE_DIRECTORIES(
    162   ${CMAKE_CURRENT_SOURCE_DIR}/libraries
    163   ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
    164 )
    165 
    166 # Translate argument
    167 IF(ORXONOX_USE_WINMAIN)
    168   SET(ORXONOX_WIN32 WIN32)
    169 ENDIF()
    170 
    171 SET(ORXONOX_MAIN_FILES Orxonox.cc)
    172 
    173 # Add special source file for OS X
    174 IF(APPLE)
    175   LIST(APPEND ORXONOX_MAIN_FILES OrxonoxMac.mm)
    176 ENDIF()
    177 
    178 ORXONOX_ADD_EXECUTABLE(orxonox-main
    179   # When defined as WIN32 this removes the console window on Windows
    180   ${ORXONOX_WIN32}
    181   LINK_LIBRARIES
    182     orxonox
    183   SOURCE_FILES
    184     ${ORXONOX_MAIN_FILES}
    185   OUTPUT_NAME orxonox
    186 )
    187 # Main executable should depend on all modules
    188 ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES})
    189 
    190 # Get name to configure the run scripts
    191 GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
    192 GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
    193 SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
    194 
    195 
    196 # When using Visual Studio we want to use the output directory as working
    197 # directory and we also want to specify where the external dlls
    198 # (lua, ogre, etc.) are. The problem hereby is that these information cannot
    199 # be specified in CMake because they are not stored in the actual project file.
    200 # This workaround will create a configured *.vcproj.user file that holds the
    201 # right values. When starting the solution for the first time,
    202 # these get written to the *vcproj.yourPCname.yourname.user
    203 IF(MSVC)
    204   IF(CMAKE_CL_64)
    205     SET(MSVC_PLATFORM "x64")
    206   ELSE()
    207     SET(MSVC_PLATFORM "Win32")
    208   ENDIF()
    209   IF(MSVC10)
    210     CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcxproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcxproj.user")
    211   ELSE()
    212     STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?).*$" "\\1"
    213            VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
    214     CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcproj.user")
    215   ENDIF()
    216 ENDIF(MSVC)
    217 
    218 # Apple Mac OS X specific build settings
    219 IF(APPLE)
    220   # On Apple we need to link to AppKit and Foundation frameworks
    221   TARGET_LINK_LIBRARIES(orxonox-main
    222     "-framework AppKit"
    223     "-framework Foundation"
    224   )
    225 
    226   # Post-build step for the creation of the Dev-App bundle
    227   INCLUDE(PrepareDevBundle)
    228   ADD_CUSTOM_COMMAND(
    229     TARGET orxonox-main
    230     POST_BUILD
    231     # Copy the executable into the Orxonox.app
    232     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"
    233     # Copy the dev-build marker file to Orxonox.app
    234     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"
    235     # Create a shortcut of the application to the root of the build tree
    236     COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}.app" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app"
    237   )
    238 ENDIF(APPLE)
    239 
    240 #################### Doxygen ####################
    241 
    242 # Prepare include paths for Doxygen. This is necessary to display
    243 # the correct path to use when including a file, e.g.
    244 # core/XMLPort.h instead of src/core/XMLPort.h
    245 
    246 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/modules)
    247 GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES)
    248 # Replace ';' by spaces
    249 STRING(REPLACE ";" " " _temp "${_temp}")
    250 SET(DOXYGEN_INCLUDE_DIRECTORIES "${_temp}" PARENT_SCOPE)
Note: See TracChangeset for help on using the changeset viewer.