Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/cegui0.8/cmake/tools/FindCEGUI.cmake @ 11324

Last change on this file since 11324 was 11118, checked in by bknecht, 9 years ago

initial commit to get orxonox to find and compile and start with cegui0.8. doesn't work yet

  • Property svn:eol-style set to native
File size: 5.7 KB
Line 
1# Find CEGUI includes and library
2#
3# This module defines
4#  CEGUI_INCLUDE_DIR
5#  CEGUI_LIBRARY, the library to link against to use CEGUI.
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++.
8#  CEGUI_FOUND, If false, do not try to use CEGUI
9#  CEGUI_VERSION, the version as string "x.y.z"
10#
11# Input:
12#  ENV{CEGUIDIR}, CEGUI path, optional
13#
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.
22#
23# Several changes and additions by Fabian 'x3n' Landau
24# Lots of simplifications by Adrian Friedli and Reto Grieder
25# Version checking and CEGUILua finding by Reto Grieder
26#                 > www.orxonox.net <
27
28INCLUDE(CompareVersionStrings)
29INCLUDE(DetermineVersion)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
32
33# Determine CEGUI's version
34FIND_FILE(CEGUI_VERSION_FILE Version.h
35  PATHS $ENV{CEGUIDIR}
36  PATH_SUFFIXES include include/CEGUI include/cegui-0.8/CEGUI
37)
38DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE})
39message("${CEGUI_VERSION}")
40
41# Find CEGUI headers
42COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare TRUE)
43message("CEGUI Version: ${_version_0_8_compare}")
44# Version 0.8 introduced a new directory and file naming convention
45IF(_version_0_8_compare GREATER -1)
46  # 0.8 and newer
47  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI/CEGUI.h
48    PATHS $ENV{CEGUIDIR}
49    PATH_SUFFIXES include/cegui-0.8/
50  )
51ELSE()
52  # 0.7 and older
53  FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
54    PATHS $ENV{CEGUIDIR}
55    PATH_SUFFIXES include include/CEGUI
56  )
57ENDIF()
58
59# Find CEGUI library
60FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
61  NAMES CEGUIBase CEGUI CEGUIBase-0
62  PATHS $ENV{CEGUIDIR}
63  PATH_SUFFIXES lib bin
64)
65FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
66  NAMES
67    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
68    CEGUId CEGUI_d CEGUID CEGUI_D CEGUIBase-0_d
69  PATHS $ENV{CEGUIDIR}
70  PATH_SUFFIXES lib bin
71)
72
73# Find CEGUILua headers
74FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h Functor.h
75  PATHS
76    $ENV{CEGUIDIR}
77    $ENV{CEGUILUADIR}
78    ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule
79    ${CEGUI_INCLUDE_DIR}/CEGUI/ScriptModules/Lua
80  PATH_SUFFIXES include include/CEGUI
81)
82# Find CEGUILua libraries
83FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
84  NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0
85  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
86  PATH_SUFFIXES lib bin
87)
88FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
89  NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
90  CEGUILuaScriptModule-0_d
91  PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR}
92  PATH_SUFFIXES lib bin
93)
94
95# Find CEGUI Tolua++ include file
96# We only need to add this path since we use tolua++ like a normal
97# dependency but it is shipped with CEGUILua.
98FIND_PATH(CEGUI_TOLUA_INCLUDE_DIR tolua++.h
99  PATHS
100    ${CEGUILUA_INCLUDE_DIR}
101    # For newer CEGUI versions >= 0.7
102    ${CEGUILUA_INCLUDE_DIR}/support/tolua++
103    ${DEP_INCLUDE_DIR}/tolua++/include
104    # For Mac OS X, tolua++ is a separate framework in the dependency package
105    ${DEP_FRAMEWORK_DIR}
106    #NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system
107)
108# Find CEGUI Tolua++ libraries
109FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
110  NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1
111  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
112  PATH_SUFFIXES lib bin
113)
114FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
115  NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
116  PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR}
117  PATH_SUFFIXES lib bin
118)
119
120# Newer versions of CEGUI have the renderer for OGRE shipped with them
121COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE)
122message("another version: ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre")
123IF(_version_0_7_compare GREATER -1)
124  # Find CEGUI OGRE Renderer headers
125  FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h Renderer.h
126    PATHS
127      $ENV{CEGUIDIR}
128      $ENV{CEGUIOGRERENDERERDIR}
129      ${CEGUI_INCLUDE_DIR}/CEGUI/RendererModules/Ogre
130    PATH_SUFFIXES include include/CEGUI
131  )
132  # Find CEGUI OGRE Renderer libraries
133  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
134    NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0
135    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
136    PATH_SUFFIXES lib bin
137  )
138  FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
139    NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRenderer-0_d
140    PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR}
141    PATH_SUFFIXES lib bin
142  )
143  SET(CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES
144    CEGUI_OGRE_RENDERER_INCLUDE_DIR
145    CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
146  )
147ELSE()
148  SET(CEGUI_OLD_VERSION TRUE)
149  SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
150ENDIF()
151
152# Handle the REQUIRED argument and set CEGUI_FOUND
153# Also checks the version requirements if given
154FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
155  CEGUI_INCLUDE_DIR
156  CEGUI_LIBRARY_OPTIMIZED
157  CEGUILUA_INCLUDE_DIR
158  CEGUILUA_LIBRARY_OPTIMIZED
159  CEGUI_TOLUA_INCLUDE_DIR
160  CEGUI_TOLUA_LIBRARY_OPTIMIZED
161  ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES}
162)
163
164# Collect optimized and debug libraries
165HANDLE_LIBRARY_TYPES(CEGUI)
166HANDLE_LIBRARY_TYPES(CEGUILUA)
167HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
168IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
169  HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
170ENDIF()
171
172MARK_AS_ADVANCED(
173  CEGUI_INCLUDE_DIR
174  CEGUI_LIBRARY_OPTIMIZED
175  CEGUI_LIBRARY_DEBUG
176  CEGUILUA_INCLUDE_DIR
177  CEGUILUA_LIBRARY_OPTIMIZED
178  CEGUILUA_LIBRARY_DEBUG
179  CEGUI_TOLUA_INCLUDE_DIR
180  CEGUI_TOLUA_LIBRARY_OPTIMIZED
181  CEGUI_TOLUA_LIBRARY_DEBUG
182  CEGUI_OGRE_RENDERER_INCLUDE_DIR
183  CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
184  CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
185)
Note: See TracBrowser for help on using the repository browser.