Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/LibraryConfig.cmake @ 2636

Last change on this file since 2636 was 2631, checked in by rgrieder, 16 years ago

Exported package configuration to the dependencies folder.
LibraryConfig.cmake now includes all PackageConfig*.cmake files in the dependency folder, which then configure the library paths.

  • Property svn:eol-style set to native
File size: 6.8 KB
RevLine 
[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]28INCLUDE(CompareVersionStrings)
29INCLUDE(FindPackageHandleStandardArgs)
30
[2631]31############## Platform Scripts #################
[2618]32
[2631]33# On Windows using a package causes way less problems
34SET(_option_msg "Set this to true to use precompiled dependecy archives")
35IF(WIN32)
36  OPTION(USE_DEPENDENCY_PACKAGE "${_option_msg}" ON)
37ELSE(WIN32)
38  OPTION(USE_DEPENDENCY_PACKAGE "${_option_msg}" FALSE)
39ENDIF(WIN32)
[2618]40
41# Scripts for specific library and CMake config
42INCLUDE(LibraryConfigTardis)
43INCLUDE(LibraryConfigApple)
[1505]44
[2631]45IF(USE_DEPENDENCY_PACKAGE)
46  IF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/include)
47    SET(DEPENDENCY_DIR "${CMAKE_SOURCE_DIR}/dependencies" CACHE PATH "")
48  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../dependencies/include)
49    SET(DEPENDENCY_DIR "${CMAKE_SOURCE_DIR}/../dependencies" CACHE PATH "")
50  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies/include)
51    SET(DEPENDENCY_DIR "${CMAKE_SOURCE_DIR}/../lib_dist/dependencies" CACHE PATH "")
52  ELSE()
53    MESSAGE(STATUS "Warning: Could not find dependency directory."
54                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
55  ENDIF()
56  IF(DEPENDENCY_DIR)
57    FILE(GLOB _package_config_files dependencies/PackageConfig*.cmake)
58    FOREACH(_file ${_package_config_files})
59      INCLUDE(${_file})
60    ENDFOREACH(_file)
61  ENDIF()
62ENDIF(USE_DEPENDENCY_PACKAGE)
63
[2618]64# User script
65SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
66    "Specify a CMake script if you wish to write your own library path config.
67     See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.")
68IF(LIBRARY_CONFIG_USER_SCRIPT)
69  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake)
70    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
71  ELSEIF(EXISTS ${LIBRARY_CONFIG_USER_SCRIPT})
72    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
73  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
74    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
[2624]75  ENDIF()
[2618]76ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
77
78
[2616]79############### Library finding #################
80# Performs the search and sets the variables    #
[2579]81
[2616]82FIND_PACKAGE(OGRE  1.4 EXACT REQUIRED)
83FIND_PACKAGE(ENet  1.1       REQUIRED)
84FIND_PACKAGE(Ogg             REQUIRED)
85FIND_PACKAGE(Vorbis          REQUIRED)
86FIND_PACKAGE(ALUT            REQUIRED)
87FIND_PACKAGE(ZLIB            REQUIRED)
88IF(WIN32)
89  FIND_PACKAGE(DirectX       REQUIRED)
90ENDIF(WIN32)
[1505]91
[2616]92##### CEGUI #####
93# We make use of the CEGUI script module called CEGUILua.
94# However there is a small issue with that: We use Tolua, a C++ binding
95# generator ourselves. And we also have to use our bindings in the same
96# lua state is CEGUILua's. Unfortunately this implies that both lua runtime
97# version are equal or else you get segmentation faults.
98# In order to match the Lua versions we decided to ship CEGUILua in our
99# repository, mainly because there is no way to determine which version of
100# Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
101# because we can then choose the Lua version. Future plans might involve only
102# accepting Lua 5.1.
103
104# Insert all internally supported CEGUILua versions here
105SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
106OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
107FIND_PACKAGE(CEGUI 0.5 REQUIRED)
108
[2615]109##### Lua #####
110IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
111  COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
112  IF(version_comparison LESS 0)
113    SET(LUA_VERSION_REQUEST 5.0)
[2624]114  ELSE()
[2615]115    SET(LUA_VERSION_REQUEST 5.1)
[2624]116  ENDIF()
117ELSE()
[2615]118  SET(LUA_VERSION_REQUEST 5)
[2624]119ENDIF()
[2615]120FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
[2510]121
[2616]122##### OpenAL #####
123FIND_PACKAGE(OpenAL REQUIRED)
[2630]124# Also use parent include dir (without AL/) for ALUT
125IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
126  GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
[2624]127ENDIF()
[2630]128SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
[2628]129# Notfiy user
130FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
[2616]131# Hide variables created by the script
[2628]132MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
[2616]133
134##### TCL #####
135# We only require TCL, so avoid confusing user about other TCL stuff by
136# applying a little workaround
137SET(Tclsh_FIND_QUIETLY TRUE)
138FIND_PACKAGE(TCL 8.4 REQUIRED QUIET)
139# Display messages separately
140SET(TCL_FIND_QUIETLY FALSE)
141FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
142
143##### Boost #####
144# Expand the next statement if newer boost versions than 1.36.1 are released
145SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0)
[2630]146# MSVC seems to be the only compiler requiring system and date_time
147IF(MSVC)
148  FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem date_time system)
149ELSE(MSVC)
150  FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
151ENDIF(MSVC)
[2618]152
153####### Static/Dynamic linking options ##########
154
155# On Windows dynamically linked libraries need some special treatment
156# You may want to edit these settings if you provide your own libraries
157# Note: Default option in the libraries vary, but our default option is dynamic
158IF(WIN32)
159  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
160  OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
161  OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
162  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
163  OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
164  OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
165  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
166  IF(_version_comparison LESS 0)
167    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
168  ELSE(_version_comparison LESS 0)
169    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
170  ENDIF(_version_comparison LESS 0)
171ENDIF(WIN32)
Note: See TracBrowser for help on using the repository browser.