Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/releases/release2012/cmake/tools/FindCEGUI.cmake @ 12397

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

Possible quickfix for tolua finding on Ubuntu precise.

  • Property svn:eol-style set to native
File size: 4.9 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# Find CEGUI headers
34FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
35  PATHS $ENV{CEGUIDIR}
36  PATH_SUFFIXES include include/CEGUI
37)
38
39# Inspect CEGUIVersion.h for the version number
40DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
41
42# Find CEGUI library
43FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
44  NAMES CEGUIBase CEGUI
45  PATHS $ENV{CEGUIDIR}
46  PATH_SUFFIXES lib bin
47)
48FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
49  NAMES
50    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
51    CEGUId CEGUI_d CEGUID CEGUI_D
52  PATHS $ENV{CEGUIDIR}
53  PATH_SUFFIXES lib bin
54)
55
56# Find CEGUILua headers
57FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h
58  PATHS
59    $ENV{CEGUIDIR}
60    $ENV{CEGUILUADIR}
61    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
62  PATH_SUFFIXES include include/CEGUI
63)
64# Find CEGUILua libraries
65FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
66  NAMES CEGUILua CEGUILuaScriptModule
67  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
68  PATH_SUFFIXES lib bin
69)
70FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
71  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
72  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
73  PATH_SUFFIXES lib bin
74)
75
76# Find CEGUI Tolua++ include file
77# We only need to add this path since we use tolua++ like a normal
78# dependency but it is shipped with CEGUILua.
79FIND_PATH(CEGUI_TOLUA_INCLUDE_DIR tolua++.h
80  PATHS
81    ${CEGUILUA_INCLUDE_DIR}
82    # For newer CEGUI versions >= 0.7
83    ${CEGUILUA_INCLUDE_DIR}/support/tolua++
84    # For Mac OS X, tolua++ is a separate framework in the dependency package
85    ${DEP_FRAMEWORK_DIR}
86  NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system
87)
88# Find CEGUI Tolua++ libraries
89FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
90  NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1
91  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
92  PATH_SUFFIXES lib bin
93)
94FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
95  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
96  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
97  PATH_SUFFIXES lib bin
98)
99
100# Newer versions of CEGUI have the renderer for OGRE shipped with them
101COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_compare TRUE)
102IF(_version_compare GREATER -1)
103  # Find CEGUI OGRE Renderer headers
104  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
105    PATHS
106      $ENV{CEGUIDIR}
107      $ENV{CEGUIOGRERENDERERDIR}
108      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
109    PATH_SUFFIXES include include/CEGUI
110  )
111  # Find CEGUI OGRE Renderer libraries
112  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
113    NAMES CEGUIOgreRenderer
114    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
115    PATH_SUFFIXES lib bin
116  )
117  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
118    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
119    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
120    PATH_SUFFIXES lib bin
121  )
122  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
123    CEGUI_OGRE_RENDERER_INCLUDE_DIR
124    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
125  )
126ELSE()
127  SET(CEGUI_OLD_VERSION TRUE)
128  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
129ENDIF()
130
131# Handle the REQUIRED argument and set CEGUI_FOUND
132# Also checks the version requirements if given
133FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
134  CEGUI_INCLUDE_DIR
135  CEGUI_LIBRARY_OPTIMIZED
136  CEGUILUA_INCLUDE_DIR
137  CEGUILUA_LIBRARY_OPTIMIZED
138  CEGUI_TOLUA_INCLUDE_DIR
139  CEGUI_TOLUA_LIBRARY_OPTIMIZED
140  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
141)
142
143# Collect optimized and debug libraries
144HANDLE_LIBRARY_TYPES(CEGUI)
145HANDLE_LIBRARY_TYPES(CEGUILUA)
146HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
147IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
148  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
149ENDIF()
150
151MARK_AS_ADVANCED(
152  CEGUI_INCLUDE_DIR
153  CEGUI_LIBRARY_OPTIMIZED
154  CEGUI_LIBRARY_DEBUG
155  CEGUILUA_INCLUDE_DIR
156  CEGUILUA_LIBRARY_OPTIMIZED
157  CEGUILUA_LIBRARY_DEBUG
158  CEGUI_TOLUA_INCLUDE_DIR
159  CEGUI_TOLUA_LIBRARY_OPTIMIZED
160  CEGUI_TOLUA_LIBRARY_DEBUG
161  CEGUI_OGRE_RENDERER_INCLUDE_DIR
162  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
163  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
164)
Note: See TracBrowser for help on using the repository browser.