Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/mac_osx/cmake/LibraryConfig.cmake @ 8125

Last change on this file since 8125 was 8048, checked in by rgrieder, 14 years ago

Removed obsolete file.

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