Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ggz2/cmake/LibraryConfig.cmake @ 5910

Last change on this file since 5910 was 5740, checked in by landauf, 15 years ago

merged ggz into ggz2

  • Property svn:eol-style set to native
File size: 7.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
[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]33IF(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")
36ENDIF()
[2645]37
[2631]38############## Platform Scripts #################
[2618]39
[2631]40# On Windows using a package causes way less problems
41SET(_option_msg "Set this to true to use precompiled dependecy archives")
42IF(WIN32)
[2673]43  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
[2631]44ELSE(WIN32)
[2673]45  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
[2631]46ENDIF(WIN32)
[2618]47
48# Scripts for specific library and CMake config
49INCLUDE(LibraryConfigTardis)
50INCLUDE(LibraryConfigApple)
[1505]51
[2673]52IF(DEPENDENCY_PACKAGE_ENABLE)
53  GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
54  GET_FILENAME_COMPONENT(_dep_dir_2 ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies ABSOLUTE)
55  FIND_PATH(DEPENDENCY_PACKAGE_DIR
[2675]56    NAMES include
[2651]57    PATHS
58      ${CMAKE_SOURCE_DIR}/dependencies
[2673]59      ${_dep_dir_1}
60      ${_dep_dir_2}
[2711]61    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
[2651]62  )
[2673]63  IF(NOT DEPENDENCY_PACKAGE_DIR)
[2631]64    MESSAGE(STATUS "Warning: Could not find dependency directory."
65                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
[2651]66  ELSE()
[2674]67    INCLUDE(PackageConfigMinGW)
68    INCLUDE(PackageConfigMSVC)
[3196]69    INCLUDE(PackageConfig) # For both msvc and mingw
70  ENDIF()
[2673]71ENDIF(DEPENDENCY_PACKAGE_ENABLE)
[2631]72
[2618]73# User script
[5695]74SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
[2618]75    "Specify a CMake script if you wish to write your own library path config.
[5695]76     See LibraryConfigTardis.cmake for an example.")
77IF(LIBRARY_CONFIG_USER_SCRIPT)
78  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
79    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
[2624]80  ENDIF()
[5695]81ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
[2618]82
83
[2616]84############### Library finding #################
85# Performs the search and sets the variables    #
[2579]86
[5695]87FIND_PACKAGE(OGRE  1.4       REQUIRED)
[2616]88FIND_PACKAGE(ENet  1.1       REQUIRED)
89FIND_PACKAGE(Ogg             REQUIRED)
90FIND_PACKAGE(Vorbis          REQUIRED)
91FIND_PACKAGE(ALUT            REQUIRED)
92FIND_PACKAGE(ZLIB            REQUIRED)
[5740]93FIND_PACKAGE(GGZ                     )
94IF(NOT GGZMOD_FOUND)
95  MESSAGE(STATUS "GGZMOD not found, disabling GGZ support")
96ENDIF(NOT GGZMOD_FOUND)
[2616]97IF(WIN32)
98  FIND_PACKAGE(DirectX       REQUIRED)
99ENDIF(WIN32)
[1505]100
[2616]101##### CEGUI #####
102# We make use of the CEGUI script module called CEGUILua.
103# However there is a small issue with that: We use Tolua, a C++ binding
104# generator ourselves. And we also have to use our bindings in the same
105# lua state is CEGUILua's. Unfortunately this implies that both lua runtime
106# version are equal or else you get segmentation faults.
107# In order to match the Lua versions we decided to ship CEGUILua in our
108# repository, mainly because there is no way to determine which version of
109# Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
110# because we can then choose the Lua version. Future plans might involve only
111# accepting Lua 5.1.
112
113# Insert all internally supported CEGUILua versions here
114SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
115OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
116FIND_PACKAGE(CEGUI 0.5 REQUIRED)
117
[2615]118##### Lua #####
119IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
120  COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
121  IF(version_comparison LESS 0)
122    SET(LUA_VERSION_REQUEST 5.0)
[2624]123  ELSE()
[2615]124    SET(LUA_VERSION_REQUEST 5.1)
[2624]125  ENDIF()
126ELSE()
[2615]127  SET(LUA_VERSION_REQUEST 5)
[2624]128ENDIF()
[2615]129FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
[2510]130
[2616]131##### OpenAL #####
132FIND_PACKAGE(OpenAL REQUIRED)
[2630]133# Also use parent include dir (without AL/) for ALUT
134IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
135  GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
[2624]136ENDIF()
[2630]137SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
[2628]138# Notfiy user
139FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
[2616]140# Hide variables created by the script
[2628]141MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
[2616]142
[2637]143##### Tcl #####
144# We only require Tcl, so avoid confusing user about other Tcl stuff by
[2616]145# applying a little workaround
146SET(Tclsh_FIND_QUIETLY TRUE)
[2677]147FIND_PACKAGE(TCL QUIET)
[2616]148# Display messages separately
149SET(TCL_FIND_QUIETLY FALSE)
150FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
151
152##### Boost #####
153# Expand the next statement if newer boost versions than 1.36.1 are released
[3196]154SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0)
[3304]155FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
[2673]156# No auto linking, so this option is useless anyway
157MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
[2618]158
[3304]159
[2618]160####### Static/Dynamic linking options ##########
161
162# On Windows dynamically linked libraries need some special treatment
163# You may want to edit these settings if you provide your own libraries
164# Note: Default option in the libraries vary, but our default option is dynamic
165IF(WIN32)
166  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
167  OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
168  OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
169  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
170  OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
171  OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
172  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
173  IF(_version_comparison LESS 0)
174    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
175  ELSE(_version_comparison LESS 0)
176    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
177  ENDIF(_version_comparison LESS 0)
[2925]178
179  IF(DEPENDENCY_PACKAGE_ENABLE)
180    MARK_AS_ADVANCED(
181      LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC LINK_ENET_DYNAMIC
182      LINK_OGRE_DYNAMIC  LINK_TCL_DYNAMIC   LINK_ZLIB_DYNAMIC
183      LINK_LUA_DYNAMIC
184    )
185  ENDIF()
[2618]186ENDIF(WIN32)
[5695]187
188
189################# OGRE Plugins ##################
190
191# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
192SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
193IF(WIN32)
194  # CG program manager is probably DirectX related (not available under unix)
195  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
196ENDIF(WIN32)
197SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
198   "Specify which OGRE plugins to load. Existance check is performed.")
199
200# Check the plugins and determine the plugin folder
201# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
202INCLUDE(CheckOGREPlugins)
203CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
204
Note: See TracBrowser for help on using the repository browser.