Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/kicklib/cmake/tools/FindCEGUI.cmake @ 8740

Last change on this file since 8740 was 8120, checked in by rgrieder, 14 years ago

Cleanup in CEGUI framework finding.

  • 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.
[7941]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
[7960]28INCLUDE(CompareVersionStrings)
[2710]29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
[1505]32
[8082]33# Find CEGUI headers
[2710]34FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
35  PATHS $ENV{CEGUIDIR}
[8120]36  PATH_SUFFIXES include include/CEGUI
[2710]37)
[7960]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}
[8113]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
[8082]56# Find CEGUILua headers
57FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h
[8113]58  PATHS
59    $ENV{CEGUIDIR}
60    $ENV{CEGUILUADIR}
61    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
[8120]62  PATH_SUFFIXES include include/CEGUI
[8082]63)
[7941]64# Find CEGUILua libraries
65FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
66  NAMES CEGUILua CEGUILuaScriptModule
[8113]67  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
68  PATH_SUFFIXES lib bin
[7941]69)
70FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
71  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
[8113]72  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
[7941]73  PATH_SUFFIXES lib bin
74)
75
[8061]76# Find CEGUI Tolua++ include file
77# We only need to add this path since we use tolua++ like a normal
[8082]78# dependency but it is shipped with CEGUILua.
[8061]79FIND_PATH(CEGUI_TOLUA_INCLUDE_DIR tolua++.h
80  PATHS
[8082]81    ${CEGUILUA_INCLUDE_DIR}
[8061]82    # For newer CEGUI versions >= 0.7
[8082]83    ${CEGUILUA_INCLUDE_DIR}/support/tolua++
[8113]84    # For Mac OS X, tolua++ is a separate framework in the dependency package
[8120]85    ${DEP_FRAMEWORK_DIR}
[8113]86  NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system
[8061]87)
[7941]88# Find CEGUI Tolua++ libraries
89FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8094]90  NAMES CEGUItoluapp tolua++ ceguitolua++
[8113]91  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
92  PATH_SUFFIXES lib bin
[7941]93)
94FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
95  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
[8113]96  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
[7941]97  PATH_SUFFIXES lib bin
98)
99
[7960]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)
[8082]103  # Find CEGUI OGRE Renderer headers
104  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
[8113]105    PATHS
106      $ENV{CEGUIDIR}
107      $ENV{CEGUIOGRERENDERERDIR}
108      ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
[8120]109    PATH_SUFFIXES include include/CEGUI
[8082]110  )
[7960]111  # Find CEGUI OGRE Renderer libraries
112  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
113    NAMES CEGUIOgreRenderer
[8113]114    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
[7960]115    PATH_SUFFIXES lib bin
116  )
117  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
118    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
[8113]119    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
[7960]120    PATH_SUFFIXES lib bin
121  )
[8082]122  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
123    CEGUI_OGRE_RENDERER_INCLUDE_DIR
124    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
125  )
[7960]126ELSE()
[8095]127  SET(CEGUI_OLD_VERSION TRUE)
[7960]128  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
129ENDIF()
[1776]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}"
[7941]134  CEGUI_INCLUDE_DIR
[2710]135  CEGUI_LIBRARY_OPTIMIZED
[8082]136  CEGUILUA_INCLUDE_DIR
[7941]137  CEGUILUA_LIBRARY_OPTIMIZED
[8061]138  CEGUI_TOLUA_INCLUDE_DIR
[7941]139  CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8082]140  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
[2710]141)
[1776]142
[2710]143# Collect optimized and debug libraries
144HANDLE_LIBRARY_TYPES(CEGUI)
[7941]145HANDLE_LIBRARY_TYPES(CEGUILUA)
146HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
[7960]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
[8082]155  CEGUILUA_INCLUDE_DIR
[7941]156  CEGUILUA_LIBRARY_OPTIMIZED
157  CEGUILUA_LIBRARY_DEBUG
[8061]158  CEGUI_TOLUA_INCLUDE_DIR
[7941]159  CEGUI_TOLUA_LIBRARY_OPTIMIZED
160  CEGUI_TOLUA_LIBRARY_DEBUG
[8082]161  CEGUI_OGRE_RENDERER_INCLUDE_DIR
[7960]162  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
163  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
[2710]164)
Note: See TracBrowser for help on using the repository browser.