Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2628 was 2628, checked in by rgrieder, 15 years ago

Small fixes:

  • CheckOGREPlugins wasn't handling debug libraries correctly
  • OpenAL was missig the "Found OpenAL" message
  • changed all find scripts to show the library in the output instead of the include directory
  • Run script gets overridden by force
  • Also copy run script to the bin folder
  • Property svn:eol-style set to native
File size: 6.6 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################ Misc Options ###################
32
33OPTION(LIBRARY_USE_PACKAGE_IF_SUPPORTED
34       "When set to false CMake will only look in the standard paths for libraries" ON)
35
36
37############## Platform Scripts #################
38
39# Scripts for specific library and CMake config
40INCLUDE(LibraryConfigTardis)
41INCLUDE(LibraryConfigApple)
42INCLUDE(LibraryConfigMSVC)
43INCLUDE(LibraryConfigMinGW)
44
45# User script
46SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
47    "Specify a CMake script if you wish to write your own library path config.
48     See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.")
49IF(LIBRARY_CONFIG_USER_SCRIPT)
50  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake)
51    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
52  ELSEIF(EXISTS ${LIBRARY_CONFIG_USER_SCRIPT})
53    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
54  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
55    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
56  ENDIF()
57ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
58
59
60############### Library finding #################
61# Performs the search and sets the variables    #
62
63FIND_PACKAGE(OGRE  1.4 EXACT REQUIRED)
64FIND_PACKAGE(ENet  1.1       REQUIRED)
65FIND_PACKAGE(Ogg             REQUIRED)
66FIND_PACKAGE(Vorbis          REQUIRED)
67FIND_PACKAGE(ALUT            REQUIRED)
68FIND_PACKAGE(ZLIB            REQUIRED)
69IF(WIN32)
70  FIND_PACKAGE(DirectX       REQUIRED)
71ENDIF(WIN32)
72
73##### CEGUI #####
74# We make use of the CEGUI script module called CEGUILua.
75# However there is a small issue with that: We use Tolua, a C++ binding
76# generator ourselves. And we also have to use our bindings in the same
77# lua state is CEGUILua's. Unfortunately this implies that both lua runtime
78# version are equal or else you get segmentation faults.
79# In order to match the Lua versions we decided to ship CEGUILua in our
80# repository, mainly because there is no way to determine which version of
81# Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
82# because we can then choose the Lua version. Future plans might involve only
83# accepting Lua 5.1.
84
85# Insert all internally supported CEGUILua versions here
86SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
87OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
88FIND_PACKAGE(CEGUI 0.5 REQUIRED)
89
90##### Lua #####
91IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
92  COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
93  IF(version_comparison LESS 0)
94    SET(LUA_VERSION_REQUEST 5.0)
95  ELSE()
96    SET(LUA_VERSION_REQUEST 5.1)
97  ENDIF()
98ELSE()
99  SET(LUA_VERSION_REQUEST 5)
100ENDIF()
101FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
102
103##### OpenAL #####
104FIND_PACKAGE(OpenAL REQUIRED)
105# ALUT's headers include openal headers, but like <AL/al.h>, not <al.h>
106# Unfortunately this is not the case on all systems, so FindOpenAL.cmake
107# specifies the directory/AL, which now causes problems with ALUT.
108IF(DEFINED OPENAL_FOUND_FIRST_TIME)
109  SET(OPENAL_FOUND_FIRST_TIME FALSE CACHE INTERNAL "")
110ELSE()
111  SET(OPENAL_FOUND_FIRST_TIME TRUE CACHE INTERNAL "")
112  STRING(REGEX REPLACE "^(.*)/AL$" "\\1" _openal_dir_2 ${OPENAL_INCLUDE_DIR})
113  IF(_openal_dir_2)
114    SET(OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} ${_openal_dir_2} CACHE STRING "" FORCE)
115  ENDIF()
116ENDIF()
117# Notfiy user
118FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
119# Hide variables created by the script
120MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
121
122##### TCL #####
123# We only require TCL, so avoid confusing user about other TCL stuff by
124# applying a little workaround
125SET(Tclsh_FIND_QUIETLY TRUE)
126FIND_PACKAGE(TCL 8.4 REQUIRED QUIET)
127# Display messages separately
128SET(TCL_FIND_QUIETLY FALSE)
129FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
130
131##### Boost #####
132# Expand the next statement if newer boost versions than 1.36.1 are released
133SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0)
134FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
135# With MSVC, automatic linking is performed for boost. So wee need to tell
136# the linker where to find them. Also note that when running FindBoost for the
137# first time, it will set ${Boost_LIBRARIES} to "" but afterwards to the libs.
138IF (MSVC)
139  # Little bit hacky, but Boost_LIBRARY_DIRS doesn't get set right when having
140  # debug and optimized libraries.
141  GET_FILENAME_COMPONENT(BOOST_LINK_DIR "${Boost_THREAD_LIBRARY_RELEASE}" PATH)
142  LINK_DIRECTORIES(${BOOST_LINK_DIR})
143ENDIF (MSVC)
144
145
146####### Static/Dynamic linking options ##########
147
148# On Windows dynamically linked libraries need some special treatment
149# You may want to edit these settings if you provide your own libraries
150# Note: Default option in the libraries vary, but our default option is dynamic
151IF(WIN32)
152  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
153  OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
154  OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
155  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
156  OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
157  OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
158  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
159  IF(_version_comparison LESS 0)
160    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
161  ELSE(_version_comparison LESS 0)
162    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
163  ENDIF(_version_comparison LESS 0)
164ENDIF(WIN32)
Note: See TracBrowser for help on using the repository browser.