[5695] | 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 | # General package configuration. Merely sets the include paths. |
---|
| 24 | # Library files are treated separately. |
---|
| 25 | # |
---|
[3167] | 26 | |
---|
| 27 | # Check package version info |
---|
[5935] | 28 | # MAJOR: Breaking change |
---|
| 29 | # MINOR: No breaking changes by the dependency package |
---|
| 30 | # For example any code running on 3.0 should still run on 3.1 |
---|
| 31 | # But you can specify that the code only runs on 3.1 and higher |
---|
| 32 | # or 4.0 and higher (so both 3.1 and 4.0 will work). |
---|
| 33 | SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0) |
---|
| 34 | |
---|
[3167] | 35 | IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt) |
---|
| 36 | SET(DEPENDENCY_VERSION 1.0) |
---|
| 37 | ELSE() |
---|
| 38 | # Get version from file |
---|
| 39 | FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content) |
---|
| 40 | SET(_match) |
---|
| 41 | STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content}) |
---|
| 42 | IF(_match) |
---|
| 43 | SET(DEPENDENCY_VERSION ${_match}) |
---|
| 44 | ELSE() |
---|
| 45 | MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.") |
---|
| 46 | ENDIF() |
---|
| 47 | ENDIF() |
---|
| 48 | |
---|
| 49 | INCLUDE(CompareVersionStrings) |
---|
[5935] | 50 | SET(_version_match FALSE) |
---|
| 51 | FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS}) |
---|
| 52 | # Get major version |
---|
| 53 | STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}") |
---|
| 54 | COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE) |
---|
| 55 | IF(_result EQUAL 0) |
---|
| 56 | COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE) |
---|
| 57 | IF(NOT _result LESS 0) |
---|
| 58 | SET(_version_match TRUE) |
---|
| 59 | ENDIF() |
---|
| 60 | ENDIF() |
---|
| 61 | ENDFOREACH(_version) |
---|
| 62 | IF(NOT _version_match) |
---|
[3167] | 63 | MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n" |
---|
[5935] | 64 | "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n" |
---|
| 65 | "You can get a new version from www.orxonox.net") |
---|
[3167] | 66 | ENDIF() |
---|
| 67 | |
---|
[5695] | 68 | IF(NOT _INTERNAL_PACKAGE_MESSAGE) |
---|
| 69 | MESSAGE(STATUS "Using library package for the dependencies.") |
---|
| 70 | SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE) |
---|
| 71 | ENDIF() |
---|
[3167] | 72 | |
---|
| 73 | # Include paths and other special treatments |
---|
[5781] | 74 | SET(ENV{ALUTDIR} ${DEP_INCLUDE_DIR}/freealut) |
---|
[3370] | 75 | SET(ENV{BOOST_ROOT} ${DEP_INCLUDE_DIR}/boost) |
---|
[5781] | 76 | SET(ENV{CEGUIDIR} ${DEP_INCLUDE_DIR}/cegui) |
---|
| 77 | SET(ENV{DXSDK_DIR} ${DEP_INCLUDE_DIR}/directx) |
---|
| 78 | SET(ENV{ENETDIR} ${DEP_INCLUDE_DIR}/enet) |
---|
[3370] | 79 | SET(ENV{LUA_DIR} ${DEP_INCLUDE_DIR}/lua) |
---|
[5781] | 80 | SET(ENV{OGGDIR} ${DEP_INCLUDE_DIR}/libogg) |
---|
| 81 | SET(ENV{VORBISDIR} ${DEP_INCLUDE_DIR}/libvorbis) |
---|
[3370] | 82 | SET(ENV{OGRE_HOME} ${DEP_INCLUDE_DIR}/ogre) |
---|
[5781] | 83 | SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR}) |
---|
| 84 | SET(ENV{OPENALDIR} ${DEP_INCLUDE_DIR}/openal) |
---|
| 85 | LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include) |
---|
| 86 | LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include) |
---|
[3167] | 87 | |
---|
| 88 | ### INSTALL ### |
---|
[3370] | 89 | |
---|
[5781] | 90 | # Tcl script library |
---|
| 91 | INSTALL( |
---|
| 92 | DIRECTORY ${DEP_LIBRARY_DIR}/tcl/ |
---|
| 93 | DESTINATION lib/tcl |
---|
| 94 | ) |
---|
| 95 | |
---|
[3167] | 96 | # On Windows, DLLs have to be in the executable folder, install them |
---|
| 97 | IF(WIN32 AND DEP_BINARY_DIR) |
---|
| 98 | ## DEBUG |
---|
| 99 | # When installing a debug version, we really can't know which libraries |
---|
| 100 | # are used in released mode because there might be deps of deps. |
---|
| 101 | # --> Copy all of them, except the debug databases |
---|
| 102 | INSTALL( |
---|
| 103 | DIRECTORY ${DEP_BINARY_DIR}/ |
---|
| 104 | DESTINATION bin |
---|
| 105 | CONFIGURATIONS Debug |
---|
| 106 | REGEX "^.*\\.pdb$" EXCLUDE |
---|
| 107 | ) |
---|
| 108 | |
---|
| 109 | ## RELEASE |
---|
| 110 | # Try to filter out all the debug libraries. If the regex doesn't do the |
---|
| 111 | # job anymore, simply adjust it. |
---|
| 112 | INSTALL( |
---|
| 113 | DIRECTORY ${DEP_BINARY_DIR}/ |
---|
| 114 | DESTINATION bin |
---|
| 115 | CONFIGURATIONS Release RelWithDebInfo MinSizeRel |
---|
| 116 | REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE |
---|
| 117 | ) |
---|
| 118 | ENDIF() |
---|