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 | # |
---|
26 | |
---|
27 | # Check package version info |
---|
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 | IF(MSVC) |
---|
34 | SET(ALLOWED_MINIMUM_VERSIONS 4.3 5.1 6.0) |
---|
35 | ELSE() |
---|
36 | SET(ALLOWED_MINIMUM_VERSIONS 4.1 5.2) |
---|
37 | ENDIF() |
---|
38 | |
---|
39 | IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt) |
---|
40 | SET(DEPENDENCY_VERSION 1.0) |
---|
41 | ELSE() |
---|
42 | # Get version from file |
---|
43 | FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content) |
---|
44 | SET(_match) |
---|
45 | STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content}) |
---|
46 | IF(_match) |
---|
47 | SET(DEPENDENCY_VERSION ${_match}) |
---|
48 | ELSE() |
---|
49 | MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.") |
---|
50 | ENDIF() |
---|
51 | ENDIF() |
---|
52 | |
---|
53 | INCLUDE(CompareVersionStrings) |
---|
54 | SET(_version_match FALSE) |
---|
55 | FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS}) |
---|
56 | # Get major version |
---|
57 | STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}") |
---|
58 | COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE) |
---|
59 | IF(_result EQUAL 0) |
---|
60 | COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE) |
---|
61 | IF(NOT _result LESS 0) |
---|
62 | SET(_version_match TRUE) |
---|
63 | ENDIF() |
---|
64 | ENDIF() |
---|
65 | ENDFOREACH(_version) |
---|
66 | IF(NOT _version_match) |
---|
67 | MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n" |
---|
68 | "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n" |
---|
69 | "You can get a new version from www.orxonox.net") |
---|
70 | ENDIF() |
---|
71 | |
---|
72 | IF(NOT _INTERNAL_PACKAGE_MESSAGE) |
---|
73 | MESSAGE(STATUS "Using library package for the dependencies.") |
---|
74 | SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE) |
---|
75 | ENDIF() |
---|
76 | |
---|
77 | # Ogre versions >= 1.7 require the POCO library on Windows with MSVC for threading |
---|
78 | COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} 5 _result TRUE) |
---|
79 | IF(NOT _result EQUAL -1 AND NOT MINGW) |
---|
80 | SET(POCO_REQUIRED TRUE) |
---|
81 | ENDIF() |
---|
82 | |
---|
83 | # Include paths and other special treatments |
---|
84 | SET(ENV{ALUTDIR} ${DEP_INCLUDE_DIR}/freealut) |
---|
85 | SET(ENV{BOOST_ROOT} ${DEP_INCLUDE_DIR}/boost) |
---|
86 | SET(ENV{CEGUIDIR} ${DEP_INCLUDE_DIR}/cegui) |
---|
87 | SET(ENV{DBGHELP_DIR} ${DEP_INCLUDE_DIR}/dbghelp) |
---|
88 | SET(ENV{DXSDK_DIR} ${DEP_INCLUDE_DIR}/directx) |
---|
89 | #SET(ENV{ENETDIR} ${DEP_INCLUDE_DIR}/enet) |
---|
90 | SET(ENV{LUA5.1_DIR} ${DEP_INCLUDE_DIR}/lua) |
---|
91 | SET(ENV{OGGDIR} ${DEP_INCLUDE_DIR}/libogg) |
---|
92 | SET(ENV{VORBISDIR} ${DEP_INCLUDE_DIR}/libvorbis) |
---|
93 | SET(ENV{OGRE_HOME} ${DEP_INCLUDE_DIR}/ogre) |
---|
94 | SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR}) |
---|
95 | SET(ENV{OPENALDIR} ${DEP_INCLUDE_DIR}/openal) |
---|
96 | SET(ENV{POCODIR} ${DEP_INCLUDE_DIR}/poco) |
---|
97 | LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include) |
---|
98 | LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include) |
---|
99 | |
---|
100 | ### INSTALL ### |
---|
101 | |
---|
102 | # Tcl script library |
---|
103 | INSTALL( |
---|
104 | DIRECTORY ${DEP_LIBRARY_DIR}/tcl/ |
---|
105 | DESTINATION lib/tcl |
---|
106 | ) |
---|
107 | |
---|
108 | # On Windows, DLLs have to be in the executable folder, install them |
---|
109 | IF(WIN32 AND DEP_BINARY_DIR) |
---|
110 | ## DEBUG |
---|
111 | # When installing a debug version, we really can't know which libraries |
---|
112 | # are used in released mode because there might be deps of deps. |
---|
113 | # --> Copy all of them, except the debug databases |
---|
114 | INSTALL( |
---|
115 | DIRECTORY ${DEP_BINARY_DIR}/ |
---|
116 | DESTINATION bin |
---|
117 | CONFIGURATIONS Debug |
---|
118 | REGEX "^.*\\.pdb$" EXCLUDE |
---|
119 | ) |
---|
120 | |
---|
121 | ## RELEASE |
---|
122 | # Try to filter out all the debug libraries. If the regex doesn't do the |
---|
123 | # job anymore, simply adjust it. |
---|
124 | INSTALL( |
---|
125 | DIRECTORY ${DEP_BINARY_DIR}/ |
---|
126 | DESTINATION bin |
---|
127 | CONFIGURATIONS Release RelWithDebInfo MinSizeRel |
---|
128 | REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE |
---|
129 | ) |
---|
130 | ENDIF() |
---|