Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib/cmake/LibraryConfig.cmake @ 7943

Last change on this file since 7943 was 7943, checked in by rgrieder, 13 years ago

Dropped support for Lua 5.0 in favour of v5.1. It also seems that all major Linux distributions (Debian, Ubuntu, Gentoo, Arch Linux and Fedora) compile CEGUI with Lua 5.1

  • Property svn:eol-style set to native
File size: 7.3 KB
Line 
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
28INCLUDE(CompareVersionStrings)
29INCLUDE(FindPackageHandleStandardArgs)
30
31# Prevent CMake from finding libraries in the installation folder on Windows.
32# There might already be an installation from another compiler
33IF(WIN32)
34  LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH  "${CMAKE_INSTALL_PREFIX}")
35  LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
36ENDIF()
37
38############## Platform Scripts #################
39
40# On Windows using a package causes way less problems
41SET(_option_msg "Set this to true to use precompiled dependecy archives")
42IF(WIN32)
43  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
44ELSE(WIN32)
45  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
46ENDIF(WIN32)
47
48# Scripts for specific library and CMake config
49INCLUDE(LibraryConfigTardis)
50INCLUDE(LibraryConfigApple)
51
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 ABSOLUTE)
55  IF(MINGW)
56    SET(_compiler_prefix mingw)
57  ELSEIF(MSVC80)
58    SET(_compiler_prefix msvc8)
59  ELSEIF(MSVC90)
60    SET(_compiler_prefix msvc9)
61  ENDIF()
62  FIND_PATH(DEPENDENCY_PACKAGE_DIR
63    NAMES version.txt
64    PATHS
65      ${CMAKE_SOURCE_DIR}/dependencies
66      ${_dep_dir_1}
67      ${_dep_dir_2}
68    PATH_SUFFIXES ${_compiler_prefix} ${_compiler_prefix}/dependencies
69    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
70  )
71  IF(NOT DEPENDENCY_PACKAGE_DIR)
72    MESSAGE(STATUS "Warning: Could not find dependency directory."
73                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
74  ELSE()
75    INCLUDE(PackageConfigMinGW)
76    INCLUDE(PackageConfigMSVC)
77    INCLUDE(PackageConfig) # For both msvc and mingw
78  ENDIF()
79ENDIF(DEPENDENCY_PACKAGE_ENABLE)
80
81# User script
82SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
83    "Specify a CMake script if you wish to write your own library path config.
84     See LibraryConfigTardis.cmake for an example.")
85IF(LIBRARY_CONFIG_USER_SCRIPT)
86  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
87    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
88  ENDIF()
89ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
90
91
92############### Library finding #################
93# Performs the search and sets the variables    #
94
95FIND_PACKAGE(OGRE     1.4    REQUIRED)
96#FIND_PACKAGE(ENet     1.1    REQUIRED)
97FIND_PACKAGE(Lua      5.1    REQUIRED)
98FIND_PACKAGE(Ogg             REQUIRED)
99FIND_PACKAGE(Vorbis          REQUIRED)
100FIND_PACKAGE(ALUT            REQUIRED)
101FIND_PACKAGE(ZLIB            REQUIRED)
102IF(POCO_REQUIRED)
103  FIND_PACKAGE(POCO          REQUIRED)
104ENDIF()
105IF(WIN32)
106  FIND_PACKAGE(DbgHelp)
107  FIND_PACKAGE(DirectX       REQUIRED)
108ENDIF()
109
110##### CEGUI #####
111# We make use of the CEGUI script module called CEGUILua.
112# However there is a small issue with that: Both CEGUILua and Orxonox use
113# Lua library functions on the same objects. And it turns out that in this case
114# the linked library must be EXACTLY the same.
115# Since Lua v5.1 has been out for a long while, this does not seem to be a
116# problem anymore, at least as long as Lua 5.2 is not released.
117FIND_PACKAGE(CEGUI 0.5 REQUIRED)
118
119##### OpenAL #####
120FIND_PACKAGE(OpenAL REQUIRED)
121# Also use parent include dir (without AL/) for ALUT
122IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
123  GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
124ENDIF()
125SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
126# Notfiy user
127FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
128# Hide variables created by the script
129MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
130
131##### Tcl #####
132# We only require Tcl, so avoid confusing user about other Tcl stuff by
133# applying a little workaround
134SET(Tclsh_FIND_QUIETLY TRUE)
135FIND_PACKAGE(TCL QUIET)
136# Display messages separately
137SET(TCL_FIND_QUIETLY FALSE)
138FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
139
140##### Boost #####
141# Expand the next statement if newer boost versions than 1.36.1 are released
142SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0
143                              1.41 1.41.0 1.42 1.42.0 1.43 1.43.0 1.44 1.44.0)
144IF( NOT TARDIS )
145  FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
146ENDIF()
147# No auto linking, so this option is useless anyway
148MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
149
150
151####### Static/Dynamic linking options ##########
152
153# On Windows dynamically linked libraries need some special treatment
154# You may want to edit these settings if you provide your own libraries
155# Note: Default option in the libraries vary, but our default option is dynamic
156IF(WIN32)
157  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
158  OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
159  #OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
160  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
161  OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
162  OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
163  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
164  IF(_version_comparison LESS 0)
165    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
166  ELSE(_version_comparison LESS 0)
167    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
168  ENDIF(_version_comparison LESS 0)
169
170  IF(DEPENDENCY_PACKAGE_ENABLE)
171    MARK_AS_ADVANCED(
172      LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC #LINK_ENET_DYNAMIC
173      LINK_OGRE_DYNAMIC  LINK_TCL_DYNAMIC   LINK_ZLIB_DYNAMIC
174      LINK_LUA_DYNAMIC
175    )
176  ENDIF()
177ENDIF(WIN32)
178
179
180################# OGRE Plugins ##################
181
182# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
183SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
184IF(WIN32)
185  # CG program manager is probably DirectX related (not available under unix)
186  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
187ENDIF(WIN32)
188SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
189   "Specify which OGRE plugins to load. Existance check is performed.")
190
191# Check the plugins and determine the plugin folder
192# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
193INCLUDE(CheckOGREPlugins)
194CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
195
Note: See TracBrowser for help on using the repository browser.