[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. |
---|
[8351] | 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 | |
---|
[8351] | 28 | INCLUDE(CompareVersionStrings) |
---|
[2710] | 29 | INCLUDE(DetermineVersion) |
---|
| 30 | INCLUDE(FindPackageHandleAdvancedArgs) |
---|
| 31 | INCLUDE(HandleLibraryTypes) |
---|
[1505] | 32 | |
---|
[9675] | 33 | # Determine CEGUI's version |
---|
[11118] | 34 | FIND_FILE(CEGUI_VERSION_FILE Version.h |
---|
[2710] | 35 | PATHS $ENV{CEGUIDIR} |
---|
[11118] | 36 | PATH_SUFFIXES include include/CEGUI include/cegui-0.8/CEGUI |
---|
[2710] | 37 | ) |
---|
[9675] | 38 | DETERMINE_VERSION(CEGUI ${CEGUI_VERSION_FILE}) |
---|
[11118] | 39 | message("${CEGUI_VERSION}") |
---|
[8351] | 40 | |
---|
[9675] | 41 | # Find CEGUI headers |
---|
| 42 | COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.8" _version_0_8_compare TRUE) |
---|
[11118] | 43 | message("CEGUI Version: ${_version_0_8_compare}") |
---|
[9675] | 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} |
---|
[11118] | 49 | PATH_SUFFIXES include/cegui-0.8/ |
---|
[9675] | 50 | ) |
---|
| 51 | ELSE() |
---|
[11101] | 52 | # 0.7 and older |
---|
[9675] | 53 | FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h |
---|
| 54 | PATHS $ENV{CEGUIDIR} |
---|
| 55 | PATH_SUFFIXES include include/CEGUI |
---|
| 56 | ) |
---|
| 57 | ENDIF() |
---|
[8351] | 58 | |
---|
| 59 | # Find CEGUI library |
---|
[2710] | 60 | FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED |
---|
[9675] | 61 | NAMES CEGUIBase CEGUI CEGUIBase-0 |
---|
[2710] | 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 |
---|
[10208] | 68 | CEGUId CEGUI_d CEGUID CEGUI_D CEGUIBase-0_d |
---|
[2710] | 69 | PATHS $ENV{CEGUIDIR} |
---|
| 70 | PATH_SUFFIXES lib bin |
---|
| 71 | ) |
---|
[1776] | 72 | |
---|
[8351] | 73 | # Find CEGUILua headers |
---|
[9675] | 74 | FIND_PATH(CEGUILUA_INCLUDE_DIR CEGUILua.h Functor.h |
---|
[8351] | 75 | PATHS |
---|
| 76 | $ENV{CEGUIDIR} |
---|
| 77 | $ENV{CEGUILUADIR} |
---|
| 78 | ${CEGUI_INCLUDE_DIR}/ScriptingModules/LuaScriptModule |
---|
[9675] | 79 | ${CEGUI_INCLUDE_DIR}/CEGUI/ScriptModules/Lua |
---|
[8351] | 80 | PATH_SUFFIXES include include/CEGUI |
---|
| 81 | ) |
---|
| 82 | # Find CEGUILua libraries |
---|
| 83 | FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED |
---|
[9675] | 84 | NAMES CEGUILua CEGUILuaScriptModule CEGUILuaScriptModule-0 |
---|
[8351] | 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 |
---|
[10208] | 90 | CEGUILuaScriptModule-0_d |
---|
[8351] | 91 | PATHS $ENV{CEGUIDIR} $ENV{CEGUILUADIR} |
---|
| 92 | PATH_SUFFIXES lib bin |
---|
| 93 | ) |
---|
[1776] | 94 | |
---|
[8351] | 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++ |
---|
[9675] | 103 | ${DEP_INCLUDE_DIR}/tolua++/include |
---|
[8351] | 104 | # For Mac OS X, tolua++ is a separate framework in the dependency package |
---|
| 105 | ${DEP_FRAMEWORK_DIR} |
---|
[11118] | 106 | #NO_DEFAULT_PATH # Don't attempt to find tolua++ installed on the system |
---|
[8351] | 107 | ) |
---|
| 108 | # Find CEGUI Tolua++ libraries |
---|
| 109 | FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED |
---|
[9163] | 110 | NAMES CEGUItoluapp tolua++ ceguitolua++ tolua++5.1 |
---|
[8351] | 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 |
---|
[9675] | 121 | COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_0_7_compare TRUE) |
---|
[11118] | 122 | message("another version: ${CEGUI_INCLUDE_DIR}/RendererModules/Ogre") |
---|
[9675] | 123 | IF(_version_0_7_compare GREATER -1) |
---|
[8351] | 124 | # Find CEGUI OGRE Renderer headers |
---|
[9675] | 125 | FIND_PATH(CEGUI_OGRE_RENDERER_INCLUDE_DIR CEGUIOgreRenderer.h Renderer.h |
---|
[8351] | 126 | PATHS |
---|
| 127 | $ENV{CEGUIDIR} |
---|
| 128 | $ENV{CEGUIOGRERENDERERDIR} |
---|
[11118] | 129 | ${CEGUI_INCLUDE_DIR}/CEGUI/RendererModules/Ogre |
---|
[8351] | 130 | PATH_SUFFIXES include include/CEGUI |
---|
| 131 | ) |
---|
| 132 | # Find CEGUI OGRE Renderer libraries |
---|
| 133 | FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED |
---|
[9675] | 134 | NAMES CEGUIOgreRenderer CEGUIOgreRenderer-0 |
---|
[8351] | 135 | PATHS $ENV{CEGUIDIR} $ENV{CEGUIOGRERENDERERDIR} |
---|
| 136 | PATH_SUFFIXES lib bin |
---|
| 137 | ) |
---|
| 138 | FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG |
---|
[10208] | 139 | NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d CEGUIOgreRenderer-0_d |
---|
[8351] | 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 | |
---|
[2710] | 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}" |
---|
[8351] | 155 | CEGUI_INCLUDE_DIR |
---|
[2710] | 156 | CEGUI_LIBRARY_OPTIMIZED |
---|
[8351] | 157 | CEGUILUA_INCLUDE_DIR |
---|
| 158 | CEGUILUA_LIBRARY_OPTIMIZED |
---|
| 159 | CEGUI_TOLUA_INCLUDE_DIR |
---|
| 160 | CEGUI_TOLUA_LIBRARY_OPTIMIZED |
---|
| 161 | ${CEGUI_OGRE_RENDERER_REQUIRED_VARIABLES} |
---|
[2710] | 162 | ) |
---|
[1776] | 163 | |
---|
[2710] | 164 | # Collect optimized and debug libraries |
---|
| 165 | HANDLE_LIBRARY_TYPES(CEGUI) |
---|
[8351] | 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() |
---|
[1776] | 171 | |
---|
[2710] | 172 | MARK_AS_ADVANCED( |
---|
| 173 | CEGUI_INCLUDE_DIR |
---|
| 174 | CEGUI_LIBRARY_OPTIMIZED |
---|
| 175 | CEGUI_LIBRARY_DEBUG |
---|
[8351] | 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 |
---|
[2710] | 185 | ) |
---|