Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/cmake/tools/FindCEGUI.cmake @ 9691

Last change on this file since 9691 was 9675, checked in by landauf, 11 years ago

merged branch 'libs' back to trunk. orxonox now compiles and runs with ogre 1.8 and it compiles (but doesn't run) with cegui 0.8

  • Property svn:eol-style set to native
File size: 5.5 KB
Line 
1# Find CEGUI includes and library
2#
3# This module defines
4#  CEGUI_INCLUDE_DIR
5#  CEGUI_LIBRARY, the library to link against to use CEGUI.
6#  CEGUILUA_LIBRARY, the library to link against to use the CEGUI script module.
7#  CEGUI_TOLUA_LIBRARY, the library to link against to use Tolua++.
8#  CEGUI_FOUND, If false, do not try to use CEGUI
9#  CEGUI_VERSION, the version as string "x.y.z"
10#
11# Input:
12#  ENV{CEGUIDIR}, CEGUI path, optional
13#
14# Created by Matt Williams to find OGRE libraries
15# Copyright © 2007, Matt Williams
16#
17# Modified by Nicolas Schlumberger to find CEGUI libraries
18# and make it run on the Tardis-Infrastucture of the ETH Zurich
19# Copyright 2007, Nicolas Schlumberger
20#
21# Redistribution and use is allowed according to the terms of the BSD license.
22#
23# Several changes and additions by Fabian 'x3n' Landau
24# Lots of simplifications by Adrian Friedli and Reto Grieder
25# Version checking and CEGUILua finding by Reto Grieder
26#                 > www.orxonox.net <
27
28INCLUDE(CompareVersionStrings)
29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
32
33# Determine CEGUI's version
34FIND_FILE(CEGUI_VERSION_FILE CEGUIVersion.h Version.h
35  PATHS $ENV{CEGUIDIR}
36  PATH_SUFFIXES include include/CEGUI
37)
38DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE})
39
40# Find CEGUI headers
41COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare TRUE)
42# Version 0.8 introduced a new directory and file naming convention
43IF(_version_0_8_compare GREATER -1)
44  # 0.8 and newer
45  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI/CEGUI.h
46    PATHS $ENV{CEGUIDIR}
47    PATH_SUFFIXES include
48  )
49ELSE()
50  # 0.8 and older
51  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
52    PATHS $ENV{CEGUIDIR}
53    PATH_SUFFIXES include include/CEGUI
54  )
55ENDIF()
56
57# Find CEGUI library
58FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
59  NAMES CEGUIBase CEGUI CEGUIBase-0
60  PATHS $ENV{CEGUIDIR}
61  PATH_SUFFIXES lib bin
62)
63FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
64  NAMES
65    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
66    CEGUId CEGUI_d CEGUID CEGUI_D
67  PATHS $ENV{CEGUIDIR}
68  PATH_SUFFIXES lib bin
69)
70
71# Find CEGUILua headers
72FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h Functor.h
73  PATHS
74    $ENV{CEGUIDIR}
75    $ENV{CEGUILUADIR}
76    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
77    ${CEGUI_INCLUDE_DIR}/CEGUI/ScriptModules/Lua
78  PATH_SUFFIXES include include/CEGUI
79)
80# Find CEGUILua libraries
81FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
82  NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0
83  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
84  PATH_SUFFIXES lib bin
85)
86FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
87  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
88  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
89  PATH_SUFFIXES lib bin
90)
91
92# Find CEGUI Tolua++ include file
93# We only need to add this path since we use tolua++ like a normal
94# dependency but it is shipped with CEGUILua.
95FIND_PATH(CEGUI_TOLUA_INCLUDE_DIR tolua++.h
96  PATHS
97    ${CEGUILUA_INCLUDE_DIR}
98    # For newer CEGUI versions >= 0.7
99    ${CEGUILUA_INCLUDE_DIR}/support/tolua++
100    ${DEP_INCLUDE_DIR}/tolua++/include
101    # For Mac OS X, tolua++ is a separate framework in the dependency package
102    ${DEP_FRAMEWORK_DIR}
103  NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system
104)
105# Find CEGUI Tolua++ libraries
106FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
107  NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1
108  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
109  PATH_SUFFIXES lib bin
110)
111FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
112  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
113  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
114  PATH_SUFFIXES lib bin
115)
116
117# Newer versions of CEGUI have the renderer for OGRE shipped with them
118COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE)
119IF(_version_0_7_compare GREATER -1)
120  # Find CEGUI OGRE Renderer headers
121  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h Renderer.h
122    PATHS
123      $ENV{CEGUIDIR}
124      $ENV{CEGUIOGRERENDERERDIR}
125      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
126    PATH_SUFFIXES include include/CEGUI
127  )
128  # Find CEGUI OGRE Renderer libraries
129  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
130    NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0
131    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
132    PATH_SUFFIXES lib bin
133  )
134  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
135    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
136    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
137    PATH_SUFFIXES lib bin
138  )
139  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
140    CEGUI_OGRE_RENDERER_INCLUDE_DIR
141    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
142  )
143ELSE()
144  SET(CEGUI_OLD_VERSION TRUE)
145  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
146ENDIF()
147
148# Handle the REQUIRED argument and set CEGUI_FOUND
149# Also checks the version requirements if given
150FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
151  CEGUI_INCLUDE_DIR
152  CEGUI_LIBRARY_OPTIMIZED
153  CEGUILUA_INCLUDE_DIR
154  CEGUILUA_LIBRARY_OPTIMIZED
155  CEGUI_TOLUA_INCLUDE_DIR
156  CEGUI_TOLUA_LIBRARY_OPTIMIZED
157  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
158)
159
160# Collect optimized and debug libraries
161HANDLE_LIBRARY_TYPES(CEGUI)
162HANDLE_LIBRARY_TYPES(CEGUILUA)
163HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
164IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
165  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
166ENDIF()
167
168MARK_AS_ADVANCED(
169  CEGUI_INCLUDE_DIR
170  CEGUI_LIBRARY_OPTIMIZED
171  CEGUI_LIBRARY_DEBUG
172  CEGUILUA_INCLUDE_DIR
173  CEGUILUA_LIBRARY_OPTIMIZED
174  CEGUILUA_LIBRARY_DEBUG
175  CEGUI_TOLUA_INCLUDE_DIR
176  CEGUI_TOLUA_LIBRARY_OPTIMIZED
177  CEGUI_TOLUA_LIBRARY_DEBUG
178  CEGUI_OGRE_RENDERER_INCLUDE_DIR
179  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
180  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
181)
Note: See TracBrowser for help on using the repository browser.