Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib2/cmake/tools/FindCEGUI.cmake @ 8721

Last change on this file since 8721 was 8285, checked in by rgrieder, 14 years ago

Merged revisions 8098 - 8277 from kicklib to kicklib2.

  • 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.
[8283]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
[8283]28INCLUDE(CompareVersionStrings)
[2710]29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
[1505]32
[8284]33# Find CEGUI headers
[2710]34FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
35  PATHS $ENV{CEGUIDIR}
[8285]36  PATH_SUFFIXES include include/CEGUI
[2710]37)
[8283]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}
[8285]46  PATH_SUFFIXES lib bin
[2710]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
[8284]56# Find CEGUILua headers
57FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h
[8285]58  PATHS
59    $ENV{CEGUIDIR}
60    $ENV{CEGUILUADIR}
61    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
62  PATH_SUFFIXES include include/CEGUI
[8284]63)
[8283]64# Find CEGUILua libraries
65FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
66  NAMES CEGUILua CEGUILuaScriptModule
[8285]67  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
68  PATH_SUFFIXES lib bin
[8283]69)
70FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
71  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
[8285]72  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
[8283]73  PATH_SUFFIXES lib bin
74)
[1776]75
[8284]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++
[8285]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
[8284]87)
[8283]88# Find CEGUI Tolua++ libraries
89FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8284]90  NAMES CEGUItoluapp tolua++ ceguitolua++
[8285]91  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
92  PATH_SUFFIXES lib bin
[8283]93)
94FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
95  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
[8285]96  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
[8283]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)
[8284]103  # Find CEGUI OGRE Renderer headers
104  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
[8285]105    PATHS
106      $ENV{CEGUIDIR}
107      $ENV{CEGUIOGRERENDERERDIR}
108      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
109    PATH_SUFFIXES include include/CEGUI
[8284]110  )
[8283]111  # Find CEGUI OGRE Renderer libraries
112  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
113    NAMES CEGUIOgreRenderer
[8285]114    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
[8283]115    PATH_SUFFIXES lib bin
116  )
117  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
118    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
[8285]119    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
[8283]120    PATH_SUFFIXES lib bin
121  )
[8284]122  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
123    CEGUI_OGRE_RENDERER_INCLUDE_DIR
124    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
125  )
[8283]126ELSE()
[8284]127  SET(CEGUI_OLD_VERSION TRUE)
[8283]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}"
[8283]134  CEGUI_INCLUDE_DIR
[2710]135  CEGUI_LIBRARY_OPTIMIZED
[8284]136  CEGUILUA_INCLUDE_DIR
[8283]137  CEGUILUA_LIBRARY_OPTIMIZED
[8284]138  CEGUI_TOLUA_INCLUDE_DIR
[8283]139  CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8284]140  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
[2710]141)
[1776]142
[2710]143# Collect optimized and debug libraries
144HANDLE_LIBRARY_TYPES(CEGUI)
[8283]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
[8284]155  CEGUILUA_INCLUDE_DIR
[8283]156  CEGUILUA_LIBRARY_OPTIMIZED
157  CEGUILUA_LIBRARY_DEBUG
[8284]158  CEGUI_TOLUA_INCLUDE_DIR
[8283]159  CEGUI_TOLUA_LIBRARY_OPTIMIZED
160  CEGUI_TOLUA_LIBRARY_DEBUG
[8284]161  CEGUI_OGRE_RENDERER_INCLUDE_DIR
[8283]162  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
163  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
[2710]164)
Note: See TracBrowser for help on using the repository browser.