Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 12152 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
RevLine 
[1505]1# Find CEGUI includes and library
2#
3# This module defines
4#  CEGUI_INCLUDE_DIR
[2710]5#  CEGUI_LIBRARY, the library to link against to use CEGUI.
[8351]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++.
[1505]8#  CEGUI_FOUND, If false, do not try to use CEGUI
[2710]9#  CEGUI_VERSION, the version as string "x.y.z"
[1505]10#
[2710]11# Input:
12#  ENV{CEGUIDIR}, CEGUI path, optional
13#
[1505]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.
[1776]22#
23# Several changes and additions by Fabian 'x3n' Landau
[2710]24# Lots of simplifications by Adrian Friedli and Reto Grieder
25# Version checking and CEGUILua finding by Reto Grieder
[1776]26#                 > www.orxonox.net <
[1505]27
[8351]28INCLUDE(CompareVersionStrings)
[2710]29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
[1505]32
[9675]33# Determine CEGUI's version
34FIND_FILE(CEGUI_VERSION_FILE CEGUIVersion.h Version.h
[2710]35  PATHS $ENV{CEGUIDIR}
[11798]36  PATH_SUFFIXES
37    include
[12099]38    include/cegui-0/CEGUI
[11798]39    include/CEGUI
40    include/cegui-0.8.4/CEGUI
[11810]41    include/cegui-0.8.7/CEGUI
[2710]42)
[9675]43DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE})
[8351]44
[9675]45# Find CEGUI headers
[11795]46COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare)
[9675]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}
[11798]52    PATH_SUFFIXES
53      include
[12099]54      include/cegui-0/
[11798]55      include/cegui-${CEGUI_VERSION}/
[9675]56  )
57ELSE()
[11101]58  # 0.7 and older
[9675]59  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
60    PATHS $ENV{CEGUIDIR}
61    PATH_SUFFIXES include include/CEGUI
62  )
63ENDIF()
[8351]64
65# Find CEGUI library
[2710]66FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
[9675]67  NAMES CEGUIBase CEGUI CEGUIBase-0
[2710]68  PATHS $ENV{CEGUIDIR}
69  PATH_SUFFIXES lib bin
70)
71FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
72  NAMES
73    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
[10208]74    CEGUId CEGUI_d CEGUID CEGUI_D CEGUIBase-0_d
[2710]75  PATHS $ENV{CEGUIDIR}
76  PATH_SUFFIXES lib bin
77)
[1776]78
[8351]79# Find CEGUILua headers
[9675]80FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h Functor.h
[8351]81  PATHS
82    $ENV{CEGUIDIR}
83    $ENV{CEGUILUADIR}
84    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
[9675]85    ${CEGUI_INCLUDE_DIR}/CEGUI/ScriptModules/Lua
[8351]86  PATH_SUFFIXES include include/CEGUI
87)
88# Find CEGUILua libraries
89FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
[9675]90  NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0
[8351]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
[10208]96  CEGUILuaScriptModule-0_d
[8351]97  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
98  PATH_SUFFIXES lib bin
99)
[1776]100
[8351]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++
[9675]109    ${DEP_INCLUDE_DIR}/tolua++/include
[8351]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
[11117]115  NAMES CEGUItoluapp tolua++ toluapp ceguitolua++ tolua++5.1
[8351]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
[9675]126COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE)
127IF(_version_0_7_compare GREATER -1)
[8351]128  # Find CEGUI OGRE Renderer headers
[9675]129  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h Renderer.h
[8351]130    PATHS
131      $ENV{CEGUIDIR}
132      $ENV{CEGUIOGRERENDERERDIR}
133      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
[11798]134      ${CEGUI_INCLUDE_DIR}/CEGUI/RendererModules/Ogre
[8351]135    PATH_SUFFIXES include include/CEGUI
136  )
137  # Find CEGUI OGRE Renderer libraries
138  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
[9675]139    NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0
[8351]140    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
141    PATH_SUFFIXES lib bin
142  )
143  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
[10208]144    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRenderer-0_d
[8351]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
[2710]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}"
[8351]160  CEGUI_INCLUDE_DIR
[2710]161  CEGUI_LIBRARY_OPTIMIZED
[8351]162  CEGUILUA_INCLUDE_DIR
163  CEGUILUA_LIBRARY_OPTIMIZED
164  CEGUI_TOLUA_INCLUDE_DIR
165  CEGUI_TOLUA_LIBRARY_OPTIMIZED
166  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
[2710]167)
[1776]168
[2710]169# Collect optimized and debug libraries
170HANDLE_LIBRARY_TYPES(CEGUI)
[8351]171HANDLE_LIBRARY_TYPES(CEGUILUA)
172HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
173IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
174  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
175ENDIF()
[1776]176
[2710]177MARK_AS_ADVANCED(
178  CEGUI_INCLUDE_DIR
179  CEGUI_LIBRARY_OPTIMIZED
180  CEGUI_LIBRARY_DEBUG
[8351]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
[2710]190)
Note: See TracBrowser for help on using the repository browser.