Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 29, 2009, 11:11:45 PM (15 years ago)
Author:
rgrieder
Message:
  • Functionised CheckOGREPlugins.cmake
  • Updated LibraryConfigMSVC.cmake and LibraryConfigMinGW.cmake
  • Some more changes in LibraryConfig.cmake and BuildConfig.cmake
File:
1 edited

Legend:

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

    r2612 r2618  
    1 IF(WIN32)
     1#    Author: Reto '1337' Grieder (2008)
     2#
     3#    This program is free software; you can redistribute it and/or modify
     4#    it under the terms of the GNU General Public License as published by
     5#    the Free Software Foundation; either version 2 of the License, or
     6#    (at your option) any later version.
     7#
     8#    This program is distributed in the hope that it will be useful,
     9#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     10#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11#    GNU General Public License for more details.
     12#
     13#    You should have received a copy of the GNU General Public License
     14#    along with this program; if not, write to the Free Software
     15#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
     16
     17###################################################
     18# Make sure we have the required plugins for OGRE #
     19###################################################
     20
     21FUNCTION(CHECK_OGRE_PLUGINS)
     22
     23  SET(OGRE_PLUGINS ${ARGN})
     24
     25  IF(WIN32)
    226    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
    3     SET(CMAKE_FIND_LIBRARY_SUFFIXES_STORED ${CMAKE_FIND_LIBRARY_SUFFIXES})
    427    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
    5 ENDIF(WIN32)
    6 SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED "${CMAKE_FIND_LIBRARY_PREFIXES}")
    7 SET(CMAKE_FIND_LIBRARY_PREFIXES "")
     28  ENDIF(WIN32)
     29  # Do not prefix "lib" on any platform
     30  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
    831
    9 SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
    10 FOREACH(_plugin ${OGRE_PLUGINS})
     32  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
     33  FOREACH(_plugin ${OGRE_PLUGINS})
    1134    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
    12         NAMES ${_plugin}
    13         PATHS $ENV{OGRE_HOME} /usr/local /usr
    14         PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
     35      NAMES ${_plugin}
     36      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
     37      PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
    1538    )
    1639    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
    17         NAMES ${_plugin}${LIBRARY_DEBUG_POSTFIX}
    18         PATHS $ENV{OGRE_HOME} /usr/local /usr
    19         PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
     40      NAMES ${_plugin}d ${_plugin}_d
     41      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
     42      PATH_SUFFIXES lib lib/OGRE bin bin/Debug bin/debug Debug debug
    2043    )
    21     # We only need at least one render system. Check at the end
     44    # We only need at least one render system. Check at the end.
    2245    IF(NOT ${_plugin} MATCHES "RenderSystem")
    23         IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    24             MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
    25         ENDIF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     46      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     47        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
     48      ENDIF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    2649    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    2750      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
     
    2952
    3053    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    31         # If debug version is not available, release will do as well
    32         IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    33             SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "" FORCE)
    34         ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    35         MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
     54      # If debug version is not available, release will do as well
     55      IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     56        SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "" FORCE)
     57      ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     58      MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
    3659
    37         ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
    38         # Check and set the folders
    39         GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
    40         IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    41             MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
    42         ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    43         SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
    44         GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
    45         IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    46             MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
    47         ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    48         SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
     60      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
     61      # Check and set the folders
     62      GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
     63      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     64        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
     65      ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     66      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
     67      GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
     68      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     69        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
     70      ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     71      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
    4972
    50         # Create a list with the plugins for relase and debug configurations
    51         LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
    52         IF(OGRE_PLUGIN_${_plugin}_DEBUG)
    53             LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
    54         ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
    55             LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
    56         ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
     73      # Create a list with the plugins for relase and debug configurations
     74      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
     75      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
     76        # Determine debug postfix ("d" or "_d")
     77        IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
     78          LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
     79        ELSE(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
     80          LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
     81        ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
     82      ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
     83        LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
     84      ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
    5785    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    58 ENDFOREACH(_plugin)
    59 IF(NOT OGRE_RENDER_SYSTEM_FOUND)
    60     MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
    61 ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
    62 IF(WIN32)
    63     # Restore previous settings (see above before FOREACH)
    64     SET(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_STORED}")
    65 ENDIF(WIN32)
    66 SET(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES_STORED}")
     86  ENDFOREACH(_plugin)
     87  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
     88      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
     89  ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
    6790
    68 # List has to be comma separated for orxonox.ini
    69 STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
    70 STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
     91  # List has to be comma separated for orxonox.ini
     92  STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
     93  STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
     94
     95  # Set variables outside function scope
     96  SET(OGRE_PLUGINS_FOLDER_DEBUG ${OGRE_PLUGINS_FOLDER_DEBUG} PARENT_SCOPE)
     97  SET(OGRE_PLUGINS_FOLDER_RELEASE ${OGRE_PLUGINS_FOLDER_RELEASE} PARENT_SCOPE)
     98  SET(OGRE_PLUGINS_RELEASE ${OGRE_PLUGINS_RELEASE} PARENT_SCOPE)
     99  SET(OGRE_PLUGINS_DEBUG ${OGRE_PLUGINS_DEBUG} PARENT_SCOPE)
     100
     101ENDFUNCTION(CHECK_OGRE_PLUGINS)
Note: See TracChangeset for help on using the changeset viewer.