1 | IF(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) |
---|
5 | ENDIF(WIN32) |
---|
6 | SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED "${CMAKE_FIND_LIBRARY_PREFIXES}") |
---|
7 | SET(CMAKE_FIND_LIBRARY_PREFIXES "") |
---|
8 | |
---|
9 | SET(OGRE_RENDER_SYSTEM_FOUND FALSE) |
---|
10 | FOREACH(_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) |
---|
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}") |
---|
67 | |
---|
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}") |
---|