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