Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8111 was 8095, checked in by rgrieder, 15 years ago

Add CEGUIua include directory for CEGUI version below 0.7

  • 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}
36  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
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}
[8094]46  PATH_SUFFIXES lib bin CEGUIBase.framework CEGUI.framework
[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
58  PATHS $ENV{CEGUIDIR} ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
[8094]59  PATH_SUFFIXES include include/CEGUI CEGUILuaScriptModule.framework/Headers
[8082]60)
[7941]61# Find CEGUILua libraries
62FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
63  NAMES CEGUILua CEGUILuaScriptModule
64  PATHS $ENV{CEGUIDIR}
[8094]65  PATH_SUFFIXES lib bin CEGUILuaScriptModule.framework
[7941]66)
67FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
68  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
69  PATHS $ENV{CEGUIDIR}
70  PATH_SUFFIXES lib bin
71)
72
[8061]73# Find CEGUI Tolua++ include file
74# We only need to add this path since we use tolua++ like a normal
[8082]75# dependency but it is shipped with CEGUILua.
[8061]76FIND_PATH(CEGUI_TOLUA_INCLUDE_DIR tolua++.h
77  PATHS
[8082]78    ${CEGUILUA_INCLUDE_DIR}
[8061]79    # For newer CEGUI versions >= 0.7
[8082]80    ${CEGUILUA_INCLUDE_DIR}/support/tolua++
[8094]81    # For Apples
82    $ENV{CEGUIDIR}
83  PATH_SUFFIXES ceguitolua++.framework/Headers
[8082]84  NO_DEFAULT_PATH # MUST be in CEGUILUA_INCLUDE_DIR somewhere
[8061]85)
[7941]86# Find CEGUI Tolua++ libraries
87FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8094]88  NAMES CEGUItoluapp tolua++ ceguitolua++
[7941]89  PATHS $ENV{CEGUIDIR}
[8094]90  PATH_SUFFIXES lib bin ceguitolua++.framework
[7941]91)
92FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
93  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
94  PATHS $ENV{CEGUIDIR}
95  PATH_SUFFIXES lib bin
96)
97
[7960]98# Newer versions of CEGUI have the renderer for OGRE shipped with them
99COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_compare TRUE)
100IF(_version_compare GREATER -1)
[8082]101  # Find CEGUI OGRE Renderer headers
102  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h
103    PATHS $ENV{CEGUIDIR} ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre
104    PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
105  )
[7960]106  # Find CEGUI OGRE Renderer libraries
107  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
108    NAMES CEGUIOgreRenderer
109    PATHS $ENV{CEGUIDIR}
110    PATH_SUFFIXES lib bin
111  )
112  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
113    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
114    PATHS $ENV{CEGUIDIR}
115    PATH_SUFFIXES lib bin
116  )
[8082]117  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
118    CEGUI_OGRE_RENDERER_INCLUDE_DIR
119    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
120  )
[7960]121ELSE()
[8095]122  SET(CEGUI_OLD_VERSION TRUE)
[7960]123  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
124ENDIF()
[1776]125
[2710]126# Handle the REQUIRED argument and set CEGUI_FOUND
127# Also checks the version requirements if given
128FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
[7941]129  CEGUI_INCLUDE_DIR
[2710]130  CEGUI_LIBRARY_OPTIMIZED
[8082]131  CEGUILUA_INCLUDE_DIR
[7941]132  CEGUILUA_LIBRARY_OPTIMIZED
[8061]133  CEGUI_TOLUA_INCLUDE_DIR
[7941]134  CEGUI_TOLUA_LIBRARY_OPTIMIZED
[8082]135  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
[2710]136)
[1776]137
[2710]138# Collect optimized and debug libraries
139HANDLE_LIBRARY_TYPES(CEGUI)
[7941]140HANDLE_LIBRARY_TYPES(CEGUILUA)
141HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
[7960]142IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
143  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
144ENDIF()
[1776]145
[2710]146MARK_AS_ADVANCED(
147  CEGUI_INCLUDE_DIR
148  CEGUI_LIBRARY_OPTIMIZED
149  CEGUI_LIBRARY_DEBUG
[8082]150  CEGUILUA_INCLUDE_DIR
[7941]151  CEGUILUA_LIBRARY_OPTIMIZED
152  CEGUILUA_LIBRARY_DEBUG
[8061]153  CEGUI_TOLUA_INCLUDE_DIR
[7941]154  CEGUI_TOLUA_LIBRARY_OPTIMIZED
155  CEGUI_TOLUA_LIBRARY_DEBUG
[8082]156  CEGUI_OGRE_RENDERER_INCLUDE_DIR
[7960]157  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
158  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
[2710]159)
Note: See TracBrowser for help on using the repository browser.