Merge remote branch 'pvdk/cmakeogre' into cmakeogre

actorid
Marc Zinnschlag 13 years ago
commit 00ac2deefb

@ -1,5 +1,5 @@
#include "statsextensions.hpp" #include "controlextensions.hpp"
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
@ -48,7 +48,7 @@ namespace MWScript
bool enabled = context.getWorld().toggleCollisionMode(); bool enabled = context.getWorld().toggleCollisionMode();
context.report (enabled ? "Collsion -> On" : "Collision -> Off"); context.report (enabled ? "Collision -> On" : "Collision -> Off");
} }
}; };

@ -1,110 +1,542 @@
# Find OGRE includes and library #-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
# #
# This module defines # The contents of this file are placed in the public domain. Feel
# OGRE_INCLUDE_DIR # free to make use of it in any way you like.
# OGRE_LIBRARIES, the libraries to link against to use OGRE. #-------------------------------------------------------------------
# OGRE_LIB_DIR, the location of the libraries
# OGRE_FOUND, If false, do not try to use OGRE # - Try to find OGRE
# If you have multiple versions of Ogre installed, use the CMake or
# the environment variable OGRE_HOME to point to the path where the
# desired Ogre version can be found.
# By default this script will look for a dynamic Ogre build. If you
# need to link against static Ogre libraries, set the CMake variable
# OGRE_STATIC to TRUE.
#
# Once done, this will define
#
# OGRE_FOUND - system has OGRE
# OGRE_INCLUDE_DIRS - the OGRE include directories
# OGRE_LIBRARIES - link these to use the OGRE core
# OGRE_BINARY_REL - location of the main Ogre binary (win32 non-static only, release)
# OGRE_BINARY_DBG - location of the main Ogre binaries (win32 non-static only, debug)
#
# Additionally this script searches for the following optional
# parts of the Ogre package:
# Plugin_BSPSceneManager, Plugin_CgProgramManager,
# Plugin_OctreeSceneManager, Plugin_OctreeZone,
# Plugin_ParticleFX, Plugin_PCZSceneManager,
# RenderSystem_GL, RenderSystem_Direct3D9,
# Paging, Terrain
# #
# Copyright © 2007, Matt Williams # For each of these components, the following variables are defined:
# #
# Redistribution and use is allowed according to the terms of the BSD license. # OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. # OGRE_${COMPONENT}_INCLUDE_DIRS - additional include directories for ${COMPONENT}
CMAKE_POLICY(PUSH) # OGRE_${COMPONENT}_LIBRARIES - link these to use ${COMPONENT}
# OGRE_${COMPONENT}_BINARY_REL - location of the component binary (win32 non-static only, release)
IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR AND OGRE_LIB_DIR AND OGRE_PLUGIN_DIR) # OGRE_${COMPONENT}_BINARY_DBG - location of the component binary (win32 non-static only, debug)
SET(OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent #
ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR AND OGRE_LIB_DIR AND OGRE_PLUGIN_DIR) # Finally, the following variables are defined:
#
IF (WIN32) #Windows # OGRE_PLUGIN_DIR_REL - The directory where the release versions of
MESSAGE(STATUS "Looking for OGRE") # the OGRE plugins are located
SET(OGRESDK $ENV{OGRE_HOME}) # OGRE_PLUGIN_DIR_DBG - The directory where the debug versions of
SET(OGRESOURCE $ENV{OGRE_SRC}) # the OGRE plugins are located
IF (OGRESDK) # OGRE_MEDIA_DIR - The directory where the OGRE sample media is
MESSAGE(STATUS "Using OGRE SDK") # located, if available
STRING(REGEX REPLACE "[\\]" "/" OGRESDK "${OGRESDK}")
SET(OGRE_INCLUDE_DIR ${OGRESDK}/include) include(FindPkgMacros)
SET(OGRE_LIB_DIR ${OGRESDK}/lib) include(PreprocessorUtils)
SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain) findpkg_begin(OGRE)
ENDIF (OGRESDK)
IF (OGRESOURCE)
MESSAGE(STATUS "Using OGRE built from source") # Get path, convert backslashes as ${ENV_${var}}
SET(OGRE_INCLUDE_DIR $ENV{OGRE_SRC}/OgreMain/include) getenv_path(OGRE_HOME)
SET(OGRE_LIB_DIR $ENV{OGRE_SRC}/lib) getenv_path(OGRE_SDK)
SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain) getenv_path(OGRE_SOURCE)
ENDIF (OGRESOURCE) getenv_path(OGRE_BUILD)
ENDIF (WIN32) getenv_path(OGRE_DEPENDENCIES_DIR)
getenv_path(PROGRAMFILES)
IF (UNIX AND NOT APPLE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR) # Determine whether to search for a dynamic or static build
FIND_PACKAGE(PkgConfig REQUIRED) if (OGRE_STATIC)
# Don't mark REQUIRED, but use PKG_CHECK_MODULES below (otherwise PkgConfig set(OGRE_LIB_SUFFIX "Static")
# complains even if OGRE_* are set by hand). else ()
PKG_SEARCH_MODULE(OGRE OGRE) set(OGRE_LIB_SUFFIX "")
SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS}) endif ()
SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
PKG_CHECK_MODULES(OGRE OGRE) set(OGRE_LIBRARY_NAMES "OgreMain${OGRE_LIB_SUFFIX}")
ENDIF (UNIX AND NOT APPLE) get_debug_names(OGRE_LIBRARY_NAMES)
# on OS X we need Ogre SDK because framework doesn't include all libs, just Ogre Main lib # construct search paths from environmental hints and
IF (APPLE) # OS specific guesses
IF (OGRESDK) if (WIN32)
MESSAGE(STATUS "Using Ogre SDK") set(OGRE_PREFIX_GUESSES
SET(OGRE_LIB_DIR ${OGRESDK}/lib) ${ENV_PROGRAMFILES}/OGRE
ELSE (OGRESDK) C:/OgreSDK
MESSAGE(FATAL_ERROR "Path to Ogre SDK not specified. Specify OGRESDK.") )
ENDIF (OGRESDK) elseif (UNIX)
set(OGRE_PREFIX_GUESSES
/opt/ogre
FIND_PATH(OGRE_INCLUDE_DIR Ogre.h /opt/OGRE
PATHS /usr/lib${LIB_SUFFIX}/ogre
/Library/Frameworks /usr/lib${LIB_SUFFIX}/OGRE
/opt/local /usr/local/lib${LIB_SUFFIX}/ogre
) /usr/local/lib${LIB_SUFFIX}/OGRE
FIND_LIBRARY(OGRE_LIBRARIES $ENV{HOME}/ogre
NAMES Ogre $ENV{HOME}/OGRE
PATHS )
/Library/Frameworks endif ()
/opt/local set(OGRE_PREFIX_PATH
) ${OGRE_HOME} ${OGRE_SDK} ${ENV_OGRE_HOME} ${ENV_OGRE_SDK}
ENDIF (APPLE) ${OGRE_PREFIX_GUESSES}
)
#Do some preparation create_search_paths(OGRE)
SEPARATE_ARGUMENTS(OGRE_INCLUDE_DIR) # If both OGRE_BUILD and OGRE_SOURCE are set, prepare to find Ogre in a build dir
SEPARATE_ARGUMENTS(OGRE_LIBRARIES) set(OGRE_PREFIX_SOURCE ${OGRE_SOURCE} ${ENV_OGRE_SOURCE})
set(OGRE_PREFIX_BUILD ${OGRE_BUILD} ${ENV_OGRE_BUILD})
SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "") set(OGRE_PREFIX_DEPENDENCIES_DIR ${OGRE_DEPENDENCIES_DIR} ${ENV_OGRE_DEPENDENCIES_DIR})
SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "") if (OGRE_PREFIX_SOURCE AND OGRE_PREFIX_BUILD)
SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "") foreach(dir ${OGRE_PREFIX_SOURCE})
set(OGRE_INC_SEARCH_PATH ${dir}/OgreMain/include ${dir}/Dependencies/include ${dir}/iPhoneDependencies/include ${OGRE_INC_SEARCH_PATH})
if(OGRE_LIB_DIR) set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${dir}/Dependencies/lib ${dir}/iPhoneDependencies/lib ${OGRE_LIB_SEARCH_PATH})
CMAKE_POLICY(SET CMP0009 NEW) set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
IF (NOT APPLE) endforeach(dir)
FILE(GLOB_RECURSE OGRE_PLUGINS "${OGRE_LIB_DIR}/Plugin_*.so") foreach(dir ${OGRE_PREFIX_BUILD})
ENDIF (NOT APPLE) set(OGRE_INC_SEARCH_PATH ${dir}/include ${OGRE_INC_SEARCH_PATH})
IF (APPLE) set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${OGRE_LIB_SEARCH_PATH})
FILE(GLOB_RECURSE OGRE_PLUGINS "${OGRE_LIB_DIR}/Plugin_*.dylib") set(OGRE_BIN_SEARCH_PATH ${dir}/bin ${OGRE_BIN_SEARCH_PATH})
ENDIF (APPLE) set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
FOREACH (OGRE_PLUGINS_FILE ${OGRE_PLUGINS}) endforeach(dir)
STRING(REGEX REPLACE "/[^/]*$" "" OGRE_PLUGIN_DIR ${OGRE_PLUGINS_FILE})
ENDFOREACH(OGRE_PLUGINS_FILE) if (OGRE_PREFIX_DEPENDENCIES_DIR)
set(OGRE_INC_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/include ${OGRE_INC_SEARCH_PATH})
set(OGRE_LIB_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/lib ${OGRE_LIB_SEARCH_PATH})
set(OGRE_BIN_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/bin ${OGRE_BIN_SEARCH_PATH})
endif()
else()
set(OGRE_PREFIX_SOURCE "NOTFOUND")
set(OGRE_PREFIX_BUILD "NOTFOUND")
endif ()
# redo search if any of the environmental hints changed
set(OGRE_COMPONENTS Paging Terrain
Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager
Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX
RenderSystem_Direct3D11 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GLES RenderSystem_GLES2)
set(OGRE_RESET_VARS
OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR
OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
OGRE_PLUGIN_DIR_DBG OGRE_PLUGIN_DIR_REL OGRE_MEDIA_DIR)
foreach (comp ${OGRE_COMPONENTS})
set(OGRE_RESET_VARS ${OGRE_RESET_VARS}
OGRE_${comp}_INCLUDE_DIR OGRE_${comp}_LIBRARY_FWK
OGRE_${comp}_LIBRARY_DBG OGRE_${comp}_LIBRARY_REL
)
endforeach (comp)
set(OGRE_PREFIX_WATCH ${OGRE_PREFIX_PATH} ${OGRE_PREFIX_SOURCE} ${OGRE_PREFIX_BUILD})
clear_if_changed(OGRE_PREFIX_WATCH ${OGRE_RESET_VARS})
# try to locate Ogre via pkg-config
use_pkgconfig(OGRE_PKGC "OGRE${OGRE_LIB_SUFFIX}")
if(NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
# try to find framework on OSX
findpkg_framework(OGRE)
else()
set(OGRE_LIBRARY_FWK "")
endif() endif()
IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES) # locate Ogre include files
SET(OGRE_FOUND TRUE) find_path(OGRE_CONFIG_INCLUDE_DIR NAMES OgreBuildSettings.h HINTS ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES) find_path(OGRE_INCLUDE_DIR NAMES OgreRoot.h HINTS ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
set(OGRE_INCOMPATIBLE FALSE)
IF (OGRE_FOUND)
IF (NOT OGRE_FIND_QUIETLY) if (OGRE_INCLUDE_DIR)
MESSAGE(STATUS " libraries : ${OGRE_LIBRARIES} from ${OGRE_LIB_DIR}") if (NOT OGRE_CONFIG_INCLUDE_DIR)
MESSAGE(STATUS " includes : ${OGRE_INCLUDE_DIR}") set(OGRE_CONFIG_INCLUDE_DIR ${OGRE_INCLUDE_DIR})
MESSAGE(STATUS " plugins : ${OGRE_PLUGIN_DIR}") endif ()
ENDIF (NOT OGRE_FIND_QUIETLY) # determine Ogre version
ELSE (OGRE_FOUND) file(READ ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h OGRE_TEMP_VERSION_CONTENT)
IF (OGRE_FIND_REQUIRED) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MAJOR OGRE_VERSION_MAJOR)
MESSAGE(FATAL_ERROR "Could not find OGRE") get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MINOR OGRE_VERSION_MINOR)
ENDIF (OGRE_FIND_REQUIRED) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_PATCH OGRE_VERSION_PATCH)
ENDIF (OGRE_FOUND) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_NAME OGRE_VERSION_NAME)
set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}")
CMAKE_POLICY(POP) pkg_message(OGRE "Found Ogre ${OGRE_VERSION_NAME} (${OGRE_VERSION})")
# determine configuration settings
set(OGRE_CONFIG_HEADERS
${OGRE_CONFIG_INCLUDE_DIR}/OgreBuildSettings.h
${OGRE_CONFIG_INCLUDE_DIR}/OgreConfig.h
)
foreach(CFG_FILE ${OGRE_CONFIG_HEADERS})
if (EXISTS ${CFG_FILE})
set(OGRE_CONFIG_HEADER ${CFG_FILE})
break()
endif()
endforeach()
if (OGRE_CONFIG_HEADER)
file(READ ${OGRE_CONFIG_HEADER} OGRE_TEMP_CONFIG_CONTENT)
has_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_STATIC_LIB OGRE_CONFIG_STATIC)
get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_THREAD_SUPPORT OGRE_CONFIG_THREADS)
get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_THREAD_PROVIDER OGRE_CONFIG_THREAD_PROVIDER)
get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_NO_FREEIMAGE OGRE_CONFIG_FREEIMAGE)
if (OGRE_CONFIG_STATIC AND OGRE_STATIC)
elseif (OGRE_CONFIG_STATIC OR OGRE_STATIC)
pkg_message(OGRE "Build type (static, dynamic) does not match the requested one.")
set(OGRE_INCOMPATIBLE TRUE)
endif ()
else ()
pkg_message(OGRE "Could not determine Ogre build configuration.")
set(OGRE_INCOMPATIBLE TRUE)
endif ()
else ()
set(OGRE_INCOMPATIBLE FALSE)
endif ()
find_library(OGRE_LIBRARY_REL NAMES ${OGRE_LIBRARY_NAMES} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(OGRE_LIBRARY_DBG NAMES ${OGRE_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "debug")
make_library_set(OGRE_LIBRARY)
if(APPLE)
set(OGRE_LIBRARY_DBG ${OGRE_LIB_SEARCH_PATH})
endif()
if (OGRE_INCOMPATIBLE)
set(OGRE_LIBRARY "NOTFOUND")
endif ()
set(OGRE_INCLUDE_DIR ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INCLUDE_DIR})
list(REMOVE_DUPLICATES OGRE_INCLUDE_DIR)
findpkg_finish(OGRE)
add_parent_dir(OGRE_INCLUDE_DIRS OGRE_INCLUDE_DIR)
if (OGRE_SOURCE)
# If working from source rather than SDK, add samples include
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} "${OGRE_SOURCE}/Samples/Common/include")
endif()
mark_as_advanced(OGRE_CONFIG_INCLUDE_DIR OGRE_MEDIA_DIR OGRE_PLUGIN_DIR_REL OGRE_PLUGIN_DIR_DBG)
if (NOT OGRE_FOUND)
return()
endif ()
# look for required Ogre dependencies in case of static build and/or threading
if (OGRE_STATIC)
set(OGRE_DEPS_FOUND TRUE)
find_package(Cg QUIET)
find_package(DirectX QUIET)
find_package(FreeImage QUIET)
find_package(Freetype QUIET)
find_package(OpenGL QUIET)
find_package(OpenGLES QUIET)
find_package(OpenGLES2 QUIET)
find_package(ZLIB QUIET)
find_package(ZZip QUIET)
if (UNIX AND NOT APPLE)
find_package(X11 QUIET)
find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
set(X11_FOUND FALSE)
endif ()
endif ()
if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
find_package(Cocoa QUIET)
find_package(Carbon QUIET)
find_package(CoreVideo QUIET)
if (NOT Cocoa_FOUND OR NOT Carbon_FOUND OR NOT CoreVideo_FOUND)
set(OGRE_DEPS_FOUND FALSE)
endif ()
endif ()
if (APPLE AND OGRE_BUILD_PLATFORM_APPLE_IOS)
find_package(iPhoneSDK QUIET)
if (NOT iPhoneSDK_FOUND)
set(OGRE_DEPS_FOUND FALSE)
endif ()
endif ()
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES} ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES} )
if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} ${Carbon_LIBRARIES} ${Cocoa_LIBRARIES})
endif()
if (NOT ZLIB_FOUND OR NOT ZZip_FOUND)
set(OGRE_DEPS_FOUND FALSE)
endif ()
if (NOT FreeImage_FOUND AND NOT OGRE_CONFIG_FREEIMAGE)
set(OGRE_DEPS_FOUND FALSE)
endif ()
if (NOT FREETYPE_FOUND)
set(OGRE_DEPS_FOUND FALSE)
endif ()
if (UNIX AND NOT APPLE)
if (NOT X11_FOUND)
set(OGRE_DEPS_FOUND FALSE)
endif ()
endif ()
if (OGRE_CONFIG_THREADS)
if (OGRE_CONFIG_THREAD_PROVIDER EQUAL 1)
find_package(Boost COMPONENTS thread QUIET)
if (NOT Boost_THREAD_FOUND)
set(OGRE_DEPS_FOUND FALSE)
else ()
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
endif ()
elseif (OGRE_CONFIG_THREAD_PROVIDER EQUAL 2)
find_package(POCO QUIET)
if (NOT POCO_FOUND)
set(OGRE_DEPS_FOUND FALSE)
else ()
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${POCO_LIBRARIES})
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${POCO_INCLUDE_DIRS})
endif ()
elseif (OGRE_CONFIG_THREAD_PROVIDER EQUAL 3)
find_package(TBB QUIET)
if (NOT TBB_FOUND)
set(OGRE_DEPS_FOUND FALSE)
else ()
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${TBB_LIBRARIES})
set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS})
endif ()
endif ()
endif ()
if (NOT OGRE_DEPS_FOUND)
pkg_message(OGRE "Could not find all required dependencies for the Ogre package.")
set(OGRE_FOUND FALSE)
endif ()
endif ()
if (NOT OGRE_FOUND)
return()
endif ()
get_filename_component(OGRE_LIBRARY_DIR_REL "${OGRE_LIBRARY_REL}" PATH)
get_filename_component(OGRE_LIBRARY_DIR_DBG "${OGRE_LIBRARY_DBG}" PATH)
set(OGRE_LIBRARY_DIRS ${OGRE_LIBRARY_DIR_REL} ${OGRE_LIBRARY_DIR_DBG})
# find binaries
if (NOT OGRE_STATIC)
if (WIN32)
find_file(OGRE_BINARY_REL NAMES "OgreMain.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
PATH_SUFFIXES "" release relwithdebinfo minsizerel)
find_file(OGRE_BINARY_DBG NAMES "OgreMain_d.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
PATH_SUFFIXES "" debug )
endif()
mark_as_advanced(OGRE_BINARY_REL OGRE_BINARY_DBG)
endif()
#########################################################
# Find Ogre components
#########################################################
set(OGRE_COMPONENT_SEARCH_PATH_REL
${OGRE_LIBRARY_DIR_REL}/..
${OGRE_LIBRARY_DIR_REL}/../..
${OGRE_BIN_SEARCH_PATH}
)
set(OGRE_COMPONENT_SEARCH_PATH_DBG
${OGRE_LIBRARY_DIR_DBG}/..
${OGRE_LIBRARY_DIR_DBG}/../..
${OGRE_BIN_SEARCH_PATH}
)
macro(ogre_find_component COMPONENT HEADER)
findpkg_begin(OGRE_${COMPONENT})
find_path(OGRE_${COMPONENT}_INCLUDE_DIR NAMES ${HEADER} HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES ${COMPONENT} OGRE/${COMPONENT} Components/${COMPONENT}/include)
set(OGRE_${COMPONENT}_LIBRARY_NAMES "Ogre${COMPONENT}${OGRE_LIB_SUFFIX}")
get_debug_names(OGRE_${COMPONENT}_LIBRARY_NAMES)
find_library(OGRE_${COMPONENT}_LIBRARY_REL NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
find_library(OGRE_${COMPONENT}_LIBRARY_DBG NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
make_library_set(OGRE_${COMPONENT}_LIBRARY)
findpkg_finish(OGRE_${COMPONENT})
if (OGRE_${COMPONENT}_FOUND)
# find binaries
if (NOT OGRE_STATIC)
if (WIN32)
find_file(OGRE_${COMPONENT}_BINARY_REL NAMES "Ogre${COMPONENT}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/release bin/relwithdebinfo bin/minsizerel release)
find_file(OGRE_${COMPONENT}_BINARY_DBG NAMES "Ogre${COMPONENT}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/debug debug)
endif()
mark_as_advanced(OGRE_${COMPONENT}_BINARY_REL OGRE_${COMPONENT}_BINARY_DBG)
endif()
endif()
endmacro()
# look for Paging component
ogre_find_component(Paging OgrePaging.h)
# look for Terrain component
ogre_find_component(Terrain OgreTerrain.h)
# look for Property component
ogre_find_component(Property OgreProperty.h)
# look for RTShaderSystem component
ogre_find_component(RTShaderSystem OgreRTShaderSystem.h)
#########################################################
# Find Ogre plugins
#########################################################
macro(ogre_find_plugin PLUGIN HEADER)
# On Unix, the plugins might have no prefix
if (CMAKE_FIND_LIBRARY_PREFIXES)
set(TMP_CMAKE_LIB_PREFIX ${CMAKE_FIND_LIBRARY_PREFIXES})
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
endif()
# strip RenderSystem_ or Plugin_ prefix from plugin name
string(REPLACE "RenderSystem_" "" PLUGIN_TEMP ${PLUGIN})
string(REPLACE "Plugin_" "" PLUGIN_NAME ${PLUGIN_TEMP})
# header files for plugins are not usually needed, but find them anyway if they are present
set(OGRE_PLUGIN_PATH_SUFFIXES
PlugIns PlugIns/${PLUGIN_NAME} Plugins Plugins/${PLUGIN_NAME} ${PLUGIN}
RenderSystems RenderSystems/${PLUGIN_NAME} ${ARGN})
find_path(OGRE_${PLUGIN}_INCLUDE_DIR NAMES ${HEADER}
HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE}
PATH_SUFFIXES ${OGRE_PLUGIN_PATH_SUFFIXES})
# find link libraries for plugins
set(OGRE_${PLUGIN}_LIBRARY_NAMES "${PLUGIN}${OGRE_LIB_SUFFIX}")
get_debug_names(OGRE_${PLUGIN}_LIBRARY_NAMES)
set(OGRE_${PLUGIN}_LIBRARY_FWK ${OGRE_LIBRARY_FWK})
find_library(OGRE_${PLUGIN}_LIBRARY_REL NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES}
HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt release release/opt relwithdebinfo relwithdebinfo/opt minsizerel minsizerel/opt)
find_library(OGRE_${PLUGIN}_LIBRARY_DBG NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES_DBG}
HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt debug debug/opt)
make_library_set(OGRE_${PLUGIN}_LIBRARY)
if (OGRE_${PLUGIN}_LIBRARY OR OGRE_${PLUGIN}_INCLUDE_DIR)
set(OGRE_${PLUGIN}_FOUND TRUE)
if (OGRE_${PLUGIN}_INCLUDE_DIR)
set(OGRE_${PLUGIN}_INCLUDE_DIRS ${OGRE_${PLUGIN}_INCLUDE_DIR})
endif()
set(OGRE_${PLUGIN}_LIBRARIES ${OGRE_${PLUGIN}_LIBRARY})
endif ()
mark_as_advanced(OGRE_${PLUGIN}_INCLUDE_DIR OGRE_${PLUGIN}_LIBRARY_REL OGRE_${PLUGIN}_LIBRARY_DBG OGRE_${PLUGIN}_LIBRARY_FWK)
# look for plugin dirs
if (OGRE_${PLUGIN}_FOUND)
if (NOT OGRE_PLUGIN_DIR_REL OR NOT OGRE_PLUGIN_DIR_DBG)
if (WIN32)
set(OGRE_PLUGIN_SEARCH_PATH_REL
${OGRE_LIBRARY_DIR_REL}/..
${OGRE_LIBRARY_DIR_REL}/../..
${OGRE_BIN_SEARCH_PATH}
)
set(OGRE_PLUGIN_SEARCH_PATH_DBG
${OGRE_LIBRARY_DIR_DBG}/..
${OGRE_LIBRARY_DIR_DBG}/../..
${OGRE_BIN_SEARCH_PATH}
)
find_path(OGRE_PLUGIN_DIR_REL NAMES "${PLUGIN}.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_REL}
PATH_SUFFIXES "" bin bin/release bin/relwithdebinfo bin/minsizerel release)
find_path(OGRE_PLUGIN_DIR_DBG NAMES "${PLUGIN}_d.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_DBG}
PATH_SUFFIXES "" bin bin/debug debug)
elseif (UNIX)
get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_REL} PATH)
set(OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (release)" FORCE)
get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_DBG} PATH)
set(OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (debug)" FORCE)
endif ()
endif ()
# find binaries
if (NOT OGRE_STATIC)
if (WIN32)
find_file(OGRE_${PLUGIN}_REL NAMES "${PLUGIN}.dll" HINTS ${OGRE_PLUGIN_DIR_REL})
find_file(OGRE_${PLUGIN}_DBG NAMES "${PLUGIN}_d.dll" HINTS ${OGRE_PLUGIN_DIR_DBG})
endif()
mark_as_advanced(OGRE_${PLUGIN}_REL OGRE_${PLUGIN}_DBG)
endif()
endif ()
if (TMP_CMAKE_LIB_PREFIX)
set(CMAKE_FIND_LIBRARY_PREFIXES ${TMP_CMAKE_LIB_PREFIX})
endif ()
endmacro(ogre_find_plugin)
ogre_find_plugin(Plugin_PCZSceneManager OgrePCZSceneManager.h PCZ PlugIns/PCZSceneManager/include)
ogre_find_plugin(Plugin_OctreeZone OgreOctreeZone.h PCZ PlugIns/OctreeZone/include)
ogre_find_plugin(Plugin_BSPSceneManager OgreBspSceneManager.h PlugIns/BSPSceneManager/include)
ogre_find_plugin(Plugin_CgProgramManager OgreCgProgram.h PlugIns/CgProgramManager/include)
ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h PlugIns/OctreeSceneManager/include)
ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
ogre_find_plugin(RenderSystem_GLES OgreGLESRenderSystem.h RenderSystems/GLES/include)
ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9/include)
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
if (OGRE_STATIC)
# check if dependencies for plugins are met
if (NOT DirectX_FOUND)
set(OGRE_RenderSystem_Direct3D9_FOUND FALSE)
endif ()
if (NOT DirectX_D3D11_FOUND)
set(OGRE_RenderSystem_Direct3D11_FOUND FALSE)
endif ()
if (NOT OPENGL_FOUND)
set(OGRE_RenderSystem_GL_FOUND FALSE)
endif ()
if (NOT OPENGLES_FOUND)
set(OGRE_RenderSystem_GLES_FOUND FALSE)
endif ()
if (NOT OPENGLES2_FOUND)
set(OGRE_RenderSystem_GLES2_FOUND FALSE)
endif ()
if (NOT Cg_FOUND)
set(OGRE_Plugin_CgProgramManager_FOUND FALSE)
endif ()
set(OGRE_RenderSystem_Direct3D9_LIBRARIES ${OGRE_RenderSystem_Direct3D9_LIBRARIES}
${DirectX_LIBRARIES}
)
set(OGRE_RenderSystem_Direct3D11_LIBRARIES ${OGRE_RenderSystem_Direct3D11_LIBRARIES}
${DirectX_D3D11_LIBRARIES}
)
set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES}
${OPENGL_LIBRARIES}
)
set(OGRE_RenderSystem_GLES_LIBRARIES ${OGRE_RenderSystem_GLES_LIBRARIES}
${OPENGLES_LIBRARIES}
)
set(OGRE_RenderSystem_GLES2_LIBRARIES ${OGRE_RenderSystem_GLES2_LIBRARIES}
${OPENGLES2_LIBRARIES}
)
set(OGRE_Plugin_CgProgramManager_LIBRARIES ${OGRE_Plugin_CgProgramManager_LIBRARIES}
${Cg_LIBRARIES}
)
endif ()
# look for the media directory
set(OGRE_MEDIA_SEARCH_PATH
${OGRE_SOURCE}
${OGRE_LIBRARY_DIR_REL}/..
${OGRE_LIBRARY_DIR_DBG}/..
${OGRE_LIBRARY_DIR_REL}/../..
${OGRE_LIBRARY_DIR_DBG}/../..
${OGRE_PREFIX_SOURCE}
)
set(OGRE_MEDIA_SEARCH_SUFFIX
Samples/Media
Media
media
share/OGRE/media
)
clear_if_changed(OGRE_PREFIX_WATCH OGRE_MEDIA_DIR)
find_path(OGRE_MEDIA_DIR NAMES packs/cubemapsJS.zip HINTS ${OGRE_MEDIA_SEARCH_PATH}
PATHS ${OGRE_PREFIX_PATH} PATH_SUFFIXES ${OGRE_MEDIA_SEARCH_SUFFIX})

@ -50,6 +50,11 @@ endmacro(create_search_paths)
# clear cache variables if a certain variable changed # clear cache variables if a certain variable changed
macro(clear_if_changed TESTVAR) macro(clear_if_changed TESTVAR)
# test against internal check variable # test against internal check variable
# HACK: Apparently, adding a variable to the cache cleans up the list
# a bit. We need to also remove any empty strings from the list, but
# at the same time ensure that we are actually dealing with a list.
list(APPEND ${TESTVAR} "")
list(REMOVE_ITEM ${TESTVAR} "")
if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}") if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
message(STATUS "${TESTVAR} changed.") message(STATUS "${TESTVAR} changed.")
foreach(var ${ARGN}) foreach(var ${ARGN})
@ -129,9 +134,18 @@ MACRO(findpkg_framework fwk)
/System/Library/Frameworks /System/Library/Frameworks
/Network/Library/Frameworks /Network/Library/Frameworks
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
${CMAKE_CURRENT_SOURCE_DIR}/../lib/Release ${CMAKE_CURRENT_SOURCE_DIR}/lib/Release
${CMAKE_CURRENT_SOURCE_DIR}/../lib/Debug ${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug
) )
# These could be arrays of paths, add each individually to the search paths
foreach(i ${OGRE_PREFIX_PATH})
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug)
endforeach(i)
foreach(i ${OGRE_PREFIX_BUILD})
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug)
endforeach(i)
FOREACH(dir ${${fwk}_FRAMEWORK_PATH}) FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
SET(fwkpath ${dir}/${fwk}.framework) SET(fwkpath ${dir}/${fwk}.framework)
IF(EXISTS ${fwkpath}) IF(EXISTS ${fwkpath})

@ -0,0 +1,60 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE)
string(REGEX MATCH
"# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))"
PREPROC_TEMP_VAR
${${CONTENTS}}
)
if (CMAKE_MATCH_3)
set(${VARIABLE} ${CMAKE_MATCH_3})
else ()
set(${VARIABLE} ${CMAKE_MATCH_4})
endif ()
endmacro()
macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE)
string(REGEX MATCH
"\n *# *define +(${KEYWORD})"
PREPROC_TEMP_VAR
${${CONTENTS}}
)
if (CMAKE_MATCH_1)
set(${VARIABLE} TRUE)
else ()
set(${VARIABLE} FALSE)
endif ()
endmacro()
macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE)
string(REGEX REPLACE
"(// *)?# *define +${KEYWORD} +[^ \n]*"
"#define ${KEYWORD} ${NEW_VALUE}"
${VARIABLE}_TEMP
${${VARIABLE}}
)
set(${VARIABLE} ${${VARIABLE}_TEMP})
endmacro()
macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE)
if (${ENABLE})
set(TMP_REPLACE_STR "#define ${KEYWORD}")
else ()
set(TMP_REPLACE_STR "// #define ${KEYWORD}")
endif ()
string(REGEX REPLACE
"(// *)?# *define +${KEYWORD} *\n"
${TMP_REPLACE_STR}
${VARIABLE}_TEMP
${${VARIABLE}}
)
set(${VARIABLE} ${${VARIABLE}_TEMP})
endmacro()

@ -1,7 +1,7 @@
# Defines plugins to load # Defines plugins to load
# Define plugin folder # Define plugin folder
PluginFolder=${OGRE_PLUGIN_DIR} PluginFolder=${OGRE_PLUGIN_DIR_REL}
# Define plugins # Define plugins
Plugin=RenderSystem_GL Plugin=RenderSystem_GL

Loading…
Cancel
Save