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/CEGUI |
---|
37 | ) |
---|
38 | DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE}) |
---|
39 | message("${CEGUI_VERSION}") |
---|
40 | |
---|
41 | # Find CEGUI headers |
---|
42 | COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare TRUE) |
---|
43 | message("CEGUI Version: ${_version_0_8_compare}") |
---|
44 | # Version 0.8 introduced a new directory and file naming convention |
---|
45 | IF(_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 | ) |
---|
51 | ELSE() |
---|
52 | # 0.7 and older |
---|
53 | FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h |
---|
54 | PATHS $ENV{CEGUIDIR} |
---|
55 | PATH_SUFFIXES include include/CEGUI |
---|
56 | ) |
---|
57 | ENDIF() |
---|
58 | |
---|
59 | # Find CEGUI library |
---|
60 | FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED |
---|
61 | NAMES CEGUIBase CEGUI CEGUIBase-0 |
---|
62 | PATHS $ENV{CEGUIDIR} |
---|
63 | PATH_SUFFIXES lib bin |
---|
64 | ) |
---|
65 | FIND_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 |
---|
74 | FIND_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 |
---|
83 | FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED |
---|
84 | NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0 |
---|
85 | PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR} |
---|
86 | PATH_SUFFIXES lib bin |
---|
87 | ) |
---|
88 | FIND_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. |
---|
98 | FIND_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 |
---|
109 | FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED |
---|
110 | NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1 |
---|
111 | PATHS $ENV{CEGUIDIR} ${CEGUITOLUADIR} |
---|
112 | PATH_SUFFIXES lib bin |
---|
113 | ) |
---|
114 | FIND_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 |
---|
121 | COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE) |
---|
122 | message("another version: ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre") |
---|
123 | IF(_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 | ) |
---|
147 | ELSE() |
---|
148 | SET(CEGUI_OLD_VERSION TRUE) |
---|
149 | SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE) |
---|
150 | ENDIF() |
---|
151 | |
---|
152 | # Handle the REQUIRED argument and set CEGUI_FOUND |
---|
153 | # Also checks the version requirements if given |
---|
154 | FIND_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 |
---|
165 | HANDLE_LIBRARY_TYPES(CEGUI) |
---|
166 | HANDLE_LIBRARY_TYPES(CEGUILUA) |
---|
167 | HANDLE_LIBRARY_TYPES(CEGUI_TOLUA) |
---|
168 | IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED) |
---|
169 | HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER) |
---|
170 | ENDIF() |
---|
171 | |
---|
172 | MARK_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 | ) |
---|