Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2585


Ignore:
Timestamp:
Jan 12, 2009, 2:02:03 PM (16 years ago)
Author:
rgrieder
Message:

FindOgre now also checks for all the required plugins.
These are specified in cmake/ConfigPlatforms.cmake, however there is only one render system required.
${OGRE_PLUGINS_FOLDER_DEBUG}, ${OGRE_PLUGINS_FOLDER_RELEASE}, ${OGRE_PLUGINS_DEBUG}, ${OGRE_PLUGINS_RELEASE} are also set for later use.

Location:
code/branches/buildsystem2/cmake
Files:
3 edited

Legend:

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

    r2583 r2585  
    5454  SET(ENV{OPENALDIR}         ${MSVC_LIBRARY_DIR}/openal-1.1)
    5555  SET(ENV{LUA_DIR}           ${MSVC_LIBRARY_DIR}/lua-5.1.3)
    56   SET(ENV{OGRE_HOME}         ${MSVC_LIBRARY_DIR}/ogre-1.4.9)
     56  SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${ORXONOX_LIBRARY_BIN_DIR}")
    5757  SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include)
    5858  SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
  • code/branches/buildsystem2/cmake/ConfigPlatforms.cmake

    r2583 r2585  
    4444ENDIF(EXTRA_WARNINGS)
    4545
     46SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media")
     47# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
     48# Render systems may be optional, but at least one has to be found in FindOgre
     49SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX Plugin_CgProgramManager)
     50
     51
    4652###### Default Compiler/Linker Options ##########
    4753# Most people use GCC to compile orxonox, so use that as default
  • code/branches/buildsystem2/cmake/FindOGRE.cmake

    r2583 r2585  
    1313# Several changes and additions by Fabian 'x3n' Landau
    1414# Lots of simplifications by Adrian Friedli
     15# Plugin checking by Reto Grieder
    1516#                 > www.orxonox.net <
    1617
     
    2526    NAMES OgreMain
    2627    PATHS $ENV{OGRE_HOME} /usr/local /usr
    27     PATH_SUFFIXES lib bin/Release bin/release
     28    PATH_SUFFIXES lib bin/Release bin/release Release release
    2829)
    2930FIND_LIBRARY(OGRE_LIBRARY_DEBUG
    3031    NAMES OgreMain${LIBRARY_DEBUG_POSTFIX}
    3132    PATHS $ENV{OGRE_HOME} /usr/local /usr
    32     PATH_SUFFIXES lib bin/Debug bin/debug
     33    PATH_SUFFIXES lib bin/Debug bin/debug Debug debug
    3334)
    3435
     
    4142HandleLibraryTypes(OGRE)
    4243
     44###############################################
     45# Also make sure we have the required plugins #
     46###############################################
     47
     48IF(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)
     52ENDIF(WIN32)
     53SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
     54FOREACH(_plugin ${OGRE_PLUGINS})
     55    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
     56        NAMES ${_plugin}
     57        PATHS $ENV{OGRE_HOME}
     58        PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
     59    )
     60    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
     61        NAMES ${_plugin}${LIBRARY_DEBUG_POSTFIX}
     62        PATHS $ENV{OGRE_HOME} /usr/local /usr
     63        PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
     64    )
     65    # We only need at least one render system. Check at the end
     66    IF(NOT ${_plugin} MATCHES "RenderSystem")
     67      SET(OGRE_PLUGIN_${_plugin}_FIND_REQUIRED TRUE)
     68    ELSE(NOT ${_plugin} MATCHES "RenderSystem")
     69      SET(OGRE_PLUGIN_${_plugin}_FIND_REQUIRED FALSE)
     70      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
     71    ENDIF(NOT ${_plugin} MATCHES "RenderSystem")
     72    FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGRE_PLUGIN_${_plugin}
     73        "Could not find OGRE plugin named ${_plugin}"
     74        OGRE_PLUGIN_${_plugin}_OPTIMIZED
     75    )
     76
     77    # If debug version is not available, release will do as well
     78    IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     79        SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "")
     80    ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     81    MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
     82
     83    ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
     84    # Check and set the folders
     85    GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
     86    IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     87        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
     88    ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     89    SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
     90    GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
     91    IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     92        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
     93    ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     94    SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
     95
     96    # Create a list with the plugins for relase and debug configurations
     97    LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
     98    IF(OGRE_PLUGIN_${_plugin}_DEBUG)
     99        LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
     100    ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
     101        LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
     102    ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
     103ENDFOREACH(_plugin)
     104IF(NOT OGRE_RENDER_SYSTEM_FOUND)
     105    MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
     106ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
     107IF(WIN32)
     108    # Restore previous settings (see above before FOREACH)
     109    SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_STORED})
     110ENDIF(WIN32)
     111
     112# List has to be comma separated for orxonox.ini
     113STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
     114STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
     115
     116
    43117MARK_AS_ADVANCED(
    44118    OGRE_LIBRARY
Note: See TracChangeset for help on using the changeset viewer.