Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 29, 2009, 11:35:54 PM (15 years ago)
Author:
rgrieder
Message:

This commit gets a little ugly, couldn't separate that anymore:

  • Renamed UseTolua.cmake to GenerateLuaBindings.cmake
  • Applied the macros for compiler flags, linker flags, header files and source groups Updated the whole build tree for that
  • Created real compiler config scripts (BuildConfigGCC.cmake and BuildConfigMSVC.cmake)
  • Large scale clean up in BuildConfig.cmake
  • You can now specify your own LibraryConfig and BuildConfig script via CMake Cache
  • Lots of small changes and fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2/cmake/BuildConfig.cmake

    r2618 r2621  
    3535# Sets where to find the external libraries like OgreMain.dll at runtime
    3636# On Unix you should not have to change this at all.
    37 IF(NOT ORXONOX_LIBRARY_BIN_DIR)
    38   SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
    39 ENDIF(NOT ORXONOX_LIBRARY_BIN_DIR)
     37IF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY)
     38  SET(ORXONOX_RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
     39ENDIF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY)
    4040
    4141# Set Debug build to default when not having multi-config generator like msvc
     
    5454
    5555OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
    56 IF(EXTRA_WARNINGS)
    57   SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter")
    58 ELSE(EXTRA_WARNINGS)
    59   SET(ORXONOX_WARNING_FLAGS "-Wall")
    60 ENDIF(EXTRA_WARNINGS)
    6156
    62 SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media")
     57# Specify media directory
     58GET_FILENAME_COMPONENT(_media_path "${CMAKE_SOURCE_DIR}/../media" ABSOLUTE)
     59SET(ORXONOX_MEDIA_DIRECTORY ${_media_path} CACHE PATH
     60    "Location of the media directory.")
     61IF(NOT EXISTS ${ORXONOX_MEDIA_DIRECTORY})
     62  MESSAGE(STATUS "Warning: The media directory does not exist ${ORXONOX_MEDIA_DIRECTORY}")
     63ENDIF(NOT EXISTS ${ORXONOX_MEDIA_DIRECTORY})
     64
    6365# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
    6466# Render systems may be optional, but at least one has to be found in FindOgre
     
    7880
    7981############## Compiler Config ##################
    80 INCLUDE(BuildConfigGCC)
    81 INCLUDE(BuildConfigMSVC)
    82 # User can create his own file if required
    83 IF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
    84   INCLUDE(${CMAKE_BINARY_DIR}/BuildConfigUser)
    85 ENDIF(EXISTS ${CMAKE_BINARY_DIR}/BuildConfigUser.cmake)
     82
     83INCLUDE(FlagUtilities)
     84
     85# Configure the compiler specific build options
     86IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
     87  INCLUDE(BuildConfigGCC)
     88ELSEIF(MSVC)
     89  INCLUDE(BuildConfigMSVC)
     90ELSE(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
     91  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
     92ENDIF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
     93
     94SET(BUILD_CONFIG_USER_SCRIPT "" CACHE FILEPATH
     95    "Specify a CMake script if you wish to write your own build config.
     96     See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
     97IF(BUILD_CONFIG_USER_SCRIPT)
     98  IF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake)
     99    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
     100  ELSEIF(EXISTS ${BUILD_CONFIG_USER_SCRIPT})
     101    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
     102  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
     103    INCLUDE(${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
     104  ENDIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake)
     105ENDIF(BUILD_CONFIG_USER_SCRIPT)
    86106
    87107
     
    97117
    98118
    99 ################### Macros ######################
     119####### Static/Dynamic linking defines ##########
    100120
    101 # Also define macros to easily extend the compiler flags
    102 # Additional argument is a condition
    103 MACRO(ADD_CXX_FLAGS _flag _cond)
    104   IF(${_cond})
    105     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
    106   ENDIF(${_cond})
    107 ENDMACRO(ADD_CXX_FLAGS _flag)
    108 MACRO(ADD_C_FLAGS _flag)
    109   IF(${_cond})
    110     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
    111   ENDIF(${_cond})
    112 ENDMACRO(ADD_C_FLAGS _flag)
     121# If no defines are specified, these libs get linked statically
     122ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
     123ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
     124ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
     125ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
     126
     127# If no defines are specified, these libs get linked dynamically
     128# You can change that optionally in the Cache.
     129ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
     130ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
     131ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
Note: See TracChangeset for help on using the changeset viewer.