Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9259 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
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
[8351]33# Find CEGUI headers
[2710]34FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
35  PATHS $ENV{CEGUIDIR}
[8351]36  PATH_SUFFIXES include include/CEGUI
[2710]37)
[8351]38
39# Inspect CEGUIVersion.h for the version number
40DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
41
42# Find CEGUI library
[2710]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)
[1776]55
[8351]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)
[1776]75
[8351]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
[9163]90  NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1
[8351]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
[2710]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}"
[8351]134  CEGUI_INCLUDE_DIR
[2710]135  CEGUI_LIBRARY_OPTIMIZED
[8351]136  CEGUILUA_INCLUDE_DIR
137  CEGUILUA_LIBRARY_OPTIMIZED
138  CEGUI_TOLUA_INCLUDE_DIR
139  CEGUI_TOLUA_LIBRARY_OPTIMIZED
140  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
[2710]141)
[1776]142
[2710]143# Collect optimized and debug libraries
144HANDLE_LIBRARY_TYPES(CEGUI)
[8351]145HANDLE_LIBRARY_TYPES(CEGUILUA)
146HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
147IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
148  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
149ENDIF()
[1776]150
[2710]151MARK_AS_ADVANCED(
152  CEGUI_INCLUDE_DIR
153  CEGUI_LIBRARY_OPTIMIZED
154  CEGUI_LIBRARY_DEBUG
[8351]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
[2710]164)
Note: See TracBrowser for help on using the repository browser.