Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 12119 was 12099, checked in by merholzl, 6 years ago

Merging changes for Flatpak building convenience into trunk

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