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