[2626] | 1 | # |
---|
| 2 | # ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | # > www.orxonox.net < |
---|
| 4 | # |
---|
| 5 | # This program is free software; you can redistribute it and/or |
---|
| 6 | # modify it under the terms of the GNU General Public License |
---|
| 7 | # as published by the Free Software Foundation; either version 2 |
---|
| 8 | # of the License, or (at your option) any later version. |
---|
| 9 | # |
---|
| 10 | # This program is distributed in the hope that it will be useful, |
---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | # GNU General Public License for more details. |
---|
| 14 | # |
---|
| 15 | # You should have received a copy of the GNU General Public License along |
---|
| 16 | # with this program; if not, write to the Free Software Foundation, |
---|
| 17 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 18 | # |
---|
| 19 | # |
---|
| 20 | # Author: |
---|
| 21 | # Reto Grieder |
---|
| 22 | # Description: |
---|
| 23 | # Configures the external libraries. Whenever possible, the find scripts |
---|
| 24 | # from the CMake module path are used, but that required some adjustments |
---|
| 25 | # for certain libraries (Boost, OpenAL, TCL) |
---|
| 26 | # |
---|
| 27 | |
---|
[2618] | 28 | INCLUDE(CompareVersionStrings) |
---|
| 29 | INCLUDE(FindPackageHandleStandardArgs) |
---|
| 30 | |
---|
[2696] | 31 | # Prevent CMake from finding libraries in the installation folder on Windows. |
---|
[2645] | 32 | # There might already be an installation from another compiler |
---|
[5695] | 33 | IF(WIN32) |
---|
[2696] | 34 | LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}") |
---|
| 35 | LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin") |
---|
| 36 | ENDIF() |
---|
[2645] | 37 | |
---|
[2631] | 38 | ############## Platform Scripts ################# |
---|
[2618] | 39 | |
---|
[2631] | 40 | # On Windows using a package causes way less problems |
---|
| 41 | SET(_option_msg "Set this to true to use precompiled dependecy archives") |
---|
| 42 | IF(WIN32) |
---|
[2673] | 43 | OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON) |
---|
[2631] | 44 | ELSE(WIN32) |
---|
[2673] | 45 | OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE) |
---|
[2631] | 46 | ENDIF(WIN32) |
---|
[2618] | 47 | |
---|
| 48 | # Scripts for specific library and CMake config |
---|
| 49 | INCLUDE(LibraryConfigTardis) |
---|
[1505] | 50 | |
---|
[2673] | 51 | IF(DEPENDENCY_PACKAGE_ENABLE) |
---|
| 52 | GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE) |
---|
| 53 | GET_FILENAME_COMPONENT(_dep_dir_2 ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies ABSOLUTE) |
---|
| 54 | FIND_PATH(DEPENDENCY_PACKAGE_DIR |
---|
[2675] | 55 | NAMES include |
---|
[2651] | 56 | PATHS |
---|
| 57 | ${CMAKE_SOURCE_DIR}/dependencies |
---|
[2673] | 58 | ${_dep_dir_1} |
---|
| 59 | ${_dep_dir_2} |
---|
[2711] | 60 | NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH |
---|
[2651] | 61 | ) |
---|
[2673] | 62 | IF(NOT DEPENDENCY_PACKAGE_DIR) |
---|
[2631] | 63 | MESSAGE(STATUS "Warning: Could not find dependency directory." |
---|
| 64 | "Disable LIBRARY_USE_PACKAGE if you have none intalled.") |
---|
[2651] | 65 | ELSE() |
---|
[2674] | 66 | INCLUDE(PackageConfigMinGW) |
---|
| 67 | INCLUDE(PackageConfigMSVC) |
---|
[3196] | 68 | INCLUDE(PackageConfig) # For both msvc and mingw |
---|
| 69 | ENDIF() |
---|
[2673] | 70 | ENDIF(DEPENDENCY_PACKAGE_ENABLE) |
---|
[2631] | 71 | |
---|
[2616] | 72 | ############### Library finding ################# |
---|
| 73 | # Performs the search and sets the variables # |
---|
[2579] | 74 | |
---|
[2615] | 75 | ##### Lua ##### |
---|
| 76 | IF(CEGUILUA_USE_EXTERNAL_LIBRARY) |
---|
| 77 | COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison) |
---|
| 78 | IF(version_comparison LESS 0) |
---|
| 79 | SET(LUA_VERSION_REQUEST 5.0) |
---|
[2624] | 80 | ELSE() |
---|
[2615] | 81 | SET(LUA_VERSION_REQUEST 5.1) |
---|
[2624] | 82 | ENDIF() |
---|
| 83 | ELSE() |
---|
[2615] | 84 | SET(LUA_VERSION_REQUEST 5) |
---|
[2624] | 85 | ENDIF() |
---|
[2615] | 86 | FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED) |
---|
[2510] | 87 | |
---|
[2616] | 88 | ##### Boost ##### |
---|
| 89 | # Expand the next statement if newer boost versions than 1.36.1 are released |
---|
[3196] | 90 | SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0) |
---|
[3304] | 91 | FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time) |
---|
[2673] | 92 | # No auto linking, so this option is useless anyway |
---|
| 93 | MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS) |
---|
[2618] | 94 | |
---|
[3304] | 95 | |
---|
[2618] | 96 | ####### Static/Dynamic linking options ########## |
---|
| 97 | |
---|
| 98 | # On Windows dynamically linked libraries need some special treatment |
---|
| 99 | # You may want to edit these settings if you provide your own libraries |
---|
| 100 | # Note: Default option in the libraries vary, but our default option is dynamic |
---|
| 101 | IF(WIN32) |
---|
| 102 | OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE) |
---|
| 103 | COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison) |
---|
| 104 | IF(_version_comparison LESS 0) |
---|
| 105 | OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE) |
---|
| 106 | ELSE(_version_comparison LESS 0) |
---|
| 107 | OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE) |
---|
| 108 | ENDIF(_version_comparison LESS 0) |
---|
[2925] | 109 | |
---|
| 110 | IF(DEPENDENCY_PACKAGE_ENABLE) |
---|
| 111 | MARK_AS_ADVANCED( |
---|
[5782] | 112 | LINK_BOOST_DYNAMIC |
---|
[2925] | 113 | LINK_LUA_DYNAMIC |
---|
| 114 | ) |
---|
| 115 | ENDIF() |
---|
[2618] | 116 | ENDIF(WIN32) |
---|