Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/CheckOGREPlugins.cmake @ 2612

Last change on this file since 2612 was 2612, checked in by rgrieder, 15 years ago

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.
  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1IF(WIN32)
2    # 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})
4    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
5ENDIF(WIN32)
6SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED "${CMAKE_FIND_LIBRARY_PREFIXES}")
7SET(CMAKE_FIND_LIBRARY_PREFIXES "")
8
9SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
10FOREACH(_plugin ${OGRE_PLUGINS})
11    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
15    )
16    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
20    )
21    # We only need at least one render system. Check at the end
22    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)
26    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
27      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
28    ENDIF(NOT ${_plugin} MATCHES "RenderSystem")
29
30    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)
36
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})
49
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)
57    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
58ENDFOREACH(_plugin)
59IF(NOT OGRE_RENDER_SYSTEM_FOUND)
60    MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
61ENDIF(NOT OGRE_RENDER_SYSTEM_FOUND)
62IF(WIN32)
63    # Restore previous settings (see above before FOREACH)
64    SET(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_STORED}")
65ENDIF(WIN32)
66SET(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES_STORED}")
67
68# List has to be comma separated for orxonox.ini
69STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
70STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
Note: See TracBrowser for help on using the repository browser.