Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/WorldMap_HS18/cmake/tools/FindCEGUI.cmake @ 12137

Last change on this file since 12137 was 11810, checked in by landauf, 7 years ago

added path to cegui for ubuntu 17.10 and also making cegui 0.8 the minimal supported version

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