[2618] | 1 | INCLUDE(CompareVersionStrings) |
---|
| 2 | INCLUDE(FindPackageHandleStandardArgs) |
---|
| 3 | |
---|
| 4 | ################ Misc Options ################### |
---|
| 5 | |
---|
| 6 | OPTION(LIBRARY_USE_PACKAGE_IF_SUPPORTED |
---|
| 7 | "When set to false CMake will only look in the standard paths for libraries" ON) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | ############## Platform Scripts ################# |
---|
| 11 | |
---|
| 12 | # Scripts for specific library and CMake config |
---|
| 13 | INCLUDE(LibraryConfigTardis) |
---|
| 14 | INCLUDE(LibraryConfigApple) |
---|
| 15 | INCLUDE(LibraryConfigMSVC) |
---|
[2612] | 16 | INCLUDE(LibraryConfigMinGW) |
---|
[1505] | 17 | |
---|
[2618] | 18 | # User script |
---|
| 19 | SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH |
---|
| 20 | "Specify a CMake script if you wish to write your own library path config. |
---|
| 21 | See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.") |
---|
| 22 | IF(LIBRARY_CONFIG_USER_SCRIPT) |
---|
| 23 | IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake) |
---|
| 24 | INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT}) |
---|
| 25 | ELSEIF(EXISTS ${LIBRARY_CONFIG_USER_SCRIPT}) |
---|
| 26 | INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT}) |
---|
| 27 | ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}) |
---|
| 28 | INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}) |
---|
[2624] | 29 | ENDIF() |
---|
[2618] | 30 | ENDIF(LIBRARY_CONFIG_USER_SCRIPT) |
---|
| 31 | |
---|
| 32 | |
---|
[2616] | 33 | ############### Library finding ################# |
---|
| 34 | # Performs the search and sets the variables # |
---|
[2579] | 35 | |
---|
[2616] | 36 | FIND_PACKAGE(OGRE 1.4 EXACT REQUIRED) |
---|
| 37 | FIND_PACKAGE(ENet 1.1 REQUIRED) |
---|
| 38 | FIND_PACKAGE(Ogg REQUIRED) |
---|
| 39 | FIND_PACKAGE(Vorbis REQUIRED) |
---|
| 40 | FIND_PACKAGE(ALUT REQUIRED) |
---|
| 41 | FIND_PACKAGE(ZLIB REQUIRED) |
---|
| 42 | IF(WIN32) |
---|
| 43 | FIND_PACKAGE(DirectX REQUIRED) |
---|
| 44 | ENDIF(WIN32) |
---|
[1505] | 45 | |
---|
[2616] | 46 | ##### CEGUI ##### |
---|
| 47 | # We make use of the CEGUI script module called CEGUILua. |
---|
| 48 | # However there is a small issue with that: We use Tolua, a C++ binding |
---|
| 49 | # generator ourselves. And we also have to use our bindings in the same |
---|
| 50 | # lua state is CEGUILua's. Unfortunately this implies that both lua runtime |
---|
| 51 | # version are equal or else you get segmentation faults. |
---|
| 52 | # In order to match the Lua versions we decided to ship CEGUILua in our |
---|
| 53 | # repository, mainly because there is no way to determine which version of |
---|
| 54 | # Lua CEGUILua was linked against (you'd have to specify yourself) and secondly |
---|
| 55 | # because we can then choose the Lua version. Future plans might involve only |
---|
| 56 | # accepting Lua 5.1. |
---|
| 57 | |
---|
| 58 | # Insert all internally supported CEGUILua versions here |
---|
| 59 | SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2) |
---|
| 60 | OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF) |
---|
| 61 | FIND_PACKAGE(CEGUI 0.5 REQUIRED) |
---|
| 62 | |
---|
[2615] | 63 | ##### Lua ##### |
---|
| 64 | IF(CEGUILUA_USE_EXTERNAL_LIBRARY) |
---|
| 65 | COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison) |
---|
| 66 | IF(version_comparison LESS 0) |
---|
| 67 | SET(LUA_VERSION_REQUEST 5.0) |
---|
[2624] | 68 | ELSE() |
---|
[2615] | 69 | SET(LUA_VERSION_REQUEST 5.1) |
---|
[2624] | 70 | ENDIF() |
---|
| 71 | ELSE() |
---|
[2615] | 72 | SET(LUA_VERSION_REQUEST 5) |
---|
[2624] | 73 | ENDIF() |
---|
[2615] | 74 | FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED) |
---|
[2510] | 75 | |
---|
[2616] | 76 | ##### OpenAL ##### |
---|
| 77 | FIND_PACKAGE(OpenAL REQUIRED) |
---|
| 78 | # ALUT's headers include openal headers, but like <AL/al.h>, not <al.h> |
---|
| 79 | # Unfortunately this is not the case on all systems, so FindOpenAL.cmake |
---|
| 80 | # specifies the directory/AL, which now causes problems with ALUT. |
---|
| 81 | IF(DEFINED OPENAL_FOUND_FIRST_TIME) |
---|
| 82 | SET(OPENAL_FOUND_FIRST_TIME FALSE CACHE INTERNAL "") |
---|
[2624] | 83 | ELSE() |
---|
[2616] | 84 | SET(OPENAL_FOUND_FIRST_TIME TRUE CACHE INTERNAL "") |
---|
| 85 | STRING(REGEX REPLACE "^(.*)/AL$" "\\1" _openal_dir_2 ${OPENAL_INCLUDE_DIR}) |
---|
| 86 | IF(_openal_dir_2) |
---|
| 87 | SET(OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} ${_openal_dir_2} CACHE STRING "" FORCE) |
---|
[2624] | 88 | ENDIF() |
---|
| 89 | ENDIF() |
---|
[2616] | 90 | # Hide variables created by the script |
---|
[2579] | 91 | MARK_AS_ADVANCED( |
---|
[2583] | 92 | OPENAL_INCLUDE_DIR |
---|
| 93 | OPENAL_LIBRARY |
---|
[2579] | 94 | ) |
---|
[2616] | 95 | |
---|
| 96 | ##### TCL ##### |
---|
| 97 | # We only require TCL, so avoid confusing user about other TCL stuff by |
---|
| 98 | # applying a little workaround |
---|
| 99 | SET(Tclsh_FIND_QUIETLY TRUE) |
---|
| 100 | FIND_PACKAGE(TCL 8.4 REQUIRED QUIET) |
---|
| 101 | # Display messages separately |
---|
| 102 | SET(TCL_FIND_QUIETLY FALSE) |
---|
| 103 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH) |
---|
| 104 | # Workaround a CMake bug that doesn't set the variables to the cache |
---|
| 105 | # Occurs at least on CMake 2.6.2 and 2.6.0 under Windows |
---|
| 106 | SET(TCL_LIBRARY ${TCL_LIBRARY} CACHE FILEPATH "") |
---|
| 107 | SET(TCL_INCLUDE_PATH ${TCL_INCLUDE_PATH} CACHE PATH "") |
---|
| 108 | |
---|
| 109 | ##### Boost ##### |
---|
| 110 | # Expand the next statement if newer boost versions than 1.36.1 are released |
---|
| 111 | SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0) |
---|
| 112 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
| 113 | # With MSVC, automatic linking is performed for boost. So wee need to tell |
---|
| 114 | # the linker where to find them. Also note that when running FindBoost for the |
---|
| 115 | # first time, it will set ${Boost_LIBRARIES} to "" but afterwards to the libs. |
---|
| 116 | IF (MSVC) |
---|
| 117 | # Little bit hacky, but Boost_LIBRARY_DIRS doesn't get set right when having |
---|
| 118 | # debug and optimized libraries. |
---|
| 119 | GET_FILENAME_COMPONENT(BOOST_LINK_DIR "${Boost_THREAD_LIBRARY_RELEASE}" PATH) |
---|
| 120 | LINK_DIRECTORIES(${BOOST_LINK_DIR}) |
---|
| 121 | ENDIF (MSVC) |
---|
[2618] | 122 | |
---|
| 123 | |
---|
| 124 | ####### Static/Dynamic linking options ########## |
---|
| 125 | |
---|
| 126 | # On Windows dynamically linked libraries need some special treatment |
---|
| 127 | # You may want to edit these settings if you provide your own libraries |
---|
| 128 | # Note: Default option in the libraries vary, but our default option is dynamic |
---|
| 129 | IF(WIN32) |
---|
| 130 | OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE) |
---|
| 131 | OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE) |
---|
| 132 | OPTION(LINK_ENET_DYNAMIC "Link ENet dynamically on Windows" TRUE) |
---|
| 133 | OPTION(LINK_OGRE_DYNAMIC "Link OGRE dynamically on Windows" TRUE) |
---|
| 134 | OPTION(LINK_TCL_DYNAMIC "Link TCL dynamically on Windows" TRUE) |
---|
| 135 | OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE) |
---|
| 136 | COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison) |
---|
| 137 | IF(_version_comparison LESS 0) |
---|
| 138 | OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE) |
---|
| 139 | ELSE(_version_comparison LESS 0) |
---|
| 140 | OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE) |
---|
| 141 | ENDIF(_version_comparison LESS 0) |
---|
| 142 | ENDIF(WIN32) |
---|