#------------------------------------------------------------------- # 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. #------------------------------------------------------------------- # - 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_GL3Plus, # RenderSystem_GLES2, # RenderSystem_Direct3D9, RenderSystem_Direct3D11 # Paging, Terrain, Volume, Overlay, MeshLodGenerator, HLMS # # For each of these components, the following variables are defined: # # OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available # OGRE_${COMPONENT}_INCLUDE_DIRS - additional include directories for ${COMPONENT} # OGRE_${COMPONENT}_LIBRARIES - link these to use ${COMPONENT} # OGRE_${COMPONENT}_BINARY_REL - location of the component binary (win32 non-static only, release) # OGRE_${COMPONENT}_BINARY_DBG - location of the component binary (win32 non-static only, debug) # # Finally, the following variables are defined: # # OGRE_PLUGIN_DIR_REL - The directory where the release versions of # the OGRE plugins are located # OGRE_PLUGIN_DIR_DBG - The directory where the debug versions of # the OGRE plugins are located # OGRE_MEDIA_DIR - The directory where the OGRE sample media is # located, if available include(FindPkgMacros) include(PreprocessorUtils) findpkg_begin(OGRE) # Determine whether to search for a dynamic or static build if (OGRE_STATIC) set(OGRE_LIB_SUFFIX "Static") else () set(OGRE_LIB_SUFFIX "") endif () if(APPLE AND NOT OGRE_STATIC) set(OGRE_LIBRARY_NAMES "Ogre${OGRE_LIB_SUFFIX}") else() set(OGRE_LIBRARY_NAMES "OgreMain${OGRE_LIB_SUFFIX}") endif() get_debug_names(OGRE_LIBRARY_NAMES) # construct search paths from environmental hints and # OS specific guesses set(OGRE_PREFIX_GUESSES $ENV{SCOL_DEPENDENCIES_PATH}) set(OGRE_PREFIX_PATH ${OGRE_PREFIX_GUESSES}) create_search_paths(OGRE) set(OGRE_PREFIX_DEPENDENCIES_DIR ${OGRE_DEPENDENCIES_DIR} $ENV{SCOL_DEPENDENCIES_PATH}) if (OGRE_PREFIX_PATH) foreach(dir ${OGRE_PREFIX_PATH}) set(OGRE_INC_SEARCH_PATH ${dir}/include/OgreMain/include ${dir}/include/OgreMain ${dir}/include ${OGRE_INC_SEARCH_PATH}) set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${dir}/lib/OGRE ${OGRE_LIB_SEARCH_PATH}) endforeach(dir) 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}) endif() else() set(OGRE_PREFIX_BUILD "NOTFOUND") endif () # redo search if any of the environmental hints changed set(OGRE_COMPONENTS Paging Terrain Volume Overlay MeshLodGenerator HLMS Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX RenderSystem_Direct3D11 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GL3Plus RenderSystem_GLES2) set(OGRE_RESET_VARS OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR OGRE_FRAMEWORK_INCLUDES OGRE_FRAMEWORK_PATH 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_BUILD}) clear_if_changed(OGRE_PREFIX_WATCH ${OGRE_RESET_VARS}) if(NOT OGRE_STATIC) # try to locate Ogre via pkg-config use_pkgconfig(OGRE_PKGC "OGRE${OGRE_LIB_SUFFIX}") # Set the framework search path for OS X set(OGRE_FRAMEWORK_SEARCH_PATH ${CMAKE_FRAMEWORK_PATH} ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks /Network/Library/Frameworks ${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Release ${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Debug ) else() set(OGRE_LIBRARY_FWK "") endif() # locate Ogre include files find_path(OGRE_CONFIG_INCLUDE_DIR NAMES OgreBuildSettings.h HINTS ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE" NO_CMAKE_FIND_ROOT_PATH) 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" NO_CMAKE_FIND_ROOT_PATH) set(OGRE_INCOMPATIBLE FALSE) if (OGRE_INCLUDE_DIR) if (NOT OGRE_CONFIG_INCLUDE_DIR) set(OGRE_CONFIG_INCLUDE_DIR ${OGRE_INCLUDE_DIR}) endif () # determine Ogre version file(READ ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h OGRE_TEMP_VERSION_CONTENT) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MAJOR OGRE_VERSION_MAJOR) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MINOR OGRE_VERSION_MINOR) get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_PATCH OGRE_VERSION_PATCH) 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}") 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) 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" "${ANDROID_ABI}") 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" "${ANDROID_ABI}") make_library_set(OGRE_LIBRARY) if (OGRE_INCOMPATIBLE) set(OGRE_LIBRARY "NOTFOUND") endif () if("${OGRE_FRAMEWORK_INCLUDES}" STREQUAL NOTFOUND) unset(OGRE_FRAMEWORK_INCLUDES CACHE) endif() set(OGRE_INCLUDE_DIR ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INCLUDE_DIR} ${OGRE_FRAMEWORK_INCLUDES}) list(REMOVE_DUPLICATES OGRE_INCLUDE_DIR) findpkg_finish(OGRE) add_parent_dir(OGRE_INCLUDE_DIRS OGRE_INCLUDE_DIR) if (APPLE AND NOT APPLE_IOS AND NOT ANDROID) set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} "${OGRE_INCLUDE_DIR}/OSX") endif() if (APPLE AND APPLE_IOS) set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} "${OGRE_INCLUDE_DIR}/IOS") endif() 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(DirectX11 QUIET) find_package(Freetype QUIET) find_package(OpenGL QUIET) find_package(OpenGLES QUIET) find_package(Vulkan QUIET) find_package(OpenGLES2 QUIET) if(WIN32 AND NOT ANDROID) find_package(ZLIB QUIET) endif() find_package(ZZip QUIET) find_package(SDL2 QUIET) if (UNIX AND NOT APPLE AND NOT ANDROID) 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 () set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${SDL2_LIBRARY}) if (APPLE AND NOT APPLE_IOS AND NOT ANDROID) set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} ${Carbon_LIBRARIES} ${Cocoa_LIBRARIES}) endif() if(WIN32 AND NOT ANDROID) if (NOT ZLIB_FOUND) set(OGRE_DEPS_FOUND FALSE) message("ZLIB_FOUND error") endif () endif () if (NOT ZZip_FOUND) set(OGRE_DEPS_FOUND FALSE) message("ZZip_FOUND error") endif () if (NOT FREETYPE_FOUND) set(OGRE_DEPS_FOUND FALSE) message("FREETYPE_FOUND error") endif () if (UNIX AND NOT APPLE AND NOT ANDROID) if (NOT X11_FOUND) set(OGRE_DEPS_FOUND FALSE) message("X11_FOUND error") endif () endif () endif() if (OGRE_STATIC) 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 Ogre components ######################################################### set(OGRE_COMPONENT_SEARCH_PATH_REL ${OGRE_LIBRARY_DIR_REL}/.. ${OGRE_LIBRARY_DIR_REL}/../.. ) set(OGRE_COMPONENT_SEARCH_PATH_DBG ${OGRE_LIBRARY_DIR_DBG}/.. ${OGRE_LIBRARY_DIR_DBG}/../.. ) macro(ogre_find_component COMPONENT HEADER) set(OGRE_${COMPONENT}_FIND_QUIETLY ${OGRE_FIND_QUIETLY}) findpkg_begin(OGRE_${COMPONENT}) find_path(OGRE_${COMPONENT}_INCLUDE_DIR NAMES ${HEADER} HINTS ${OGRE_INCLUDE_DIRS} 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} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel" "${ANDROID_ABI}") find_library(OGRE_${COMPONENT}_LIBRARY_DBG NAMES ${OGRE_${COMPONENT}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Debug" "${ANDROID_ABI}") make_library_set(OGRE_${COMPONENT}_LIBRARY) findpkg_finish(OGRE_${COMPONENT}) if (OGRE_${COMPONENT}_FOUND) message("Found ${COMPONENT}") # 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() else() message("Not found ${COMPONENT}") endif() unset(OGRE_${COMPONENT}_FIND_QUIETLY) 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) # look for Volume component ogre_find_component(Volume OgreVolumePrerequisites.h) # look for Overlay component ogre_find_component(Overlay OgreOverlaySystem.h) # look for MeshLodGenerator component ogre_find_component(MeshLodGenerator OgreMeshLodGenerator.h) # look for HLMS component ogre_find_component(HLMS OgreHlmsManager.h) # look for Bites component ogre_find_component(Bites OgreApplicationContext.h) macro(ogre_find_library LIBNAME) set(OGRE_${LIBNAME}_FIND_QUIETLY ${OGRE_FIND_QUIETLY}) findpkg_begin(OGRE_${LIBNAME}) set(OGRE_${LIBNAME}_LIBRARY_NAMES "Ogre${LIBNAME}${OGRE_LIB_SUFFIX}") get_debug_names(OGRE_${LIBNAME}_LIBRARY_NAMES) find_library(OGRE_${LIBNAME}_LIBRARY_REL NAMES ${OGRE_${LIBNAME}_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Release" "RelWithDebInfo" "MinSizeRel" "${ANDROID_ABI}") find_library(OGRE_${LIBNAME}_LIBRARY_DBG NAMES ${OGRE_${LIBNAME}_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" "Debug" "${ANDROID_ABI}") make_library_set(OGRE_${LIBNAME}_LIBRARY) findpkg_finish(OGRE_${LIBNAME}) if (OGRE_${LIBNAME}_FOUND) message("Found Ogre library ${LIBNAME}") # find binaries if (NOT OGRE_STATIC) if (WIN32) find_file(OGRE_${LIBNAME}_BINARY_REL NAMES "Ogre${LIBNAME}.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_REL} PATH_SUFFIXES "" bin bin/Release bin/RelWithDebInfo bin/MinSizeRel Release) find_file(OGRE_${LIBNAME}_BINARY_DBG NAMES "Ogre${LIBNAME}_d.dll" HINTS ${OGRE_COMPONENT_SEARCH_PATH_DBG} PATH_SUFFIXES "" bin bin/Debug Debug) endif() mark_as_advanced(OGRE_${LIBNAME}_BINARY_REL OGRE_${LIBNAME}_BINARY_DBG) endif() else() message("Not found Ogre library ${LIBNAME}") endif() unset(OGRE_${LIBNAME}_FIND_QUIETLY) endmacro() # look for GLsupport ogre_find_library(GLSupport) ######################################################### # Find Ogre plugins ######################################################### macro(ogre_find_plugin PLUGIN HEADER HPATH) # 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}) string(REPLACE "Codec_" "" PLUGIN_NAME ${PLUGIN_NAME}) # header files for plugins are not usually needed, but find them anyway if they are present set(OGRE_PLUGIN_PATH_SUFFIXES Plugins/${HPATH} PlugIns/${HPATH} plugins/${HPATH} Plugins/${HPATH}/include PlugIns/${HPATH}/include plugins/${HPATH}/include 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} PATH_SUFFIXES ${OGRE_PLUGIN_PATH_SUFFIXES} NO_CMAKE_FIND_ROOT_PATH) # 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_BUILD}/lib" ${OGRE_LIBRARY_DIRS} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" OGRE OGRE-${OGRE_VERSION} opt Release Release/opt RelWithDebInfo RelWithDebInfo/opt MinSizeRel MinSizeRel/opt) find_library(OGRE_${PLUGIN}_LIBRARY_DBG NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES_DBG} HINTS "${OGRE_BUILD}/lib" ${OGRE_LIBRARY_DIRS} ${OGRE_FRAMEWORK_PATH} PATH_SUFFIXES "" OGRE OGRE-${OGRE_VERSION} opt Debug Debug/opt) make_library_set(OGRE_${PLUGIN}_LIBRARY) if (OGRE_${PLUGIN}_INCLUDE_DIR) message(STATUS "Found ${PLUGIN} in: ${OGRE_INCLUDE_DIRS}") else() message(STATUS "Missing ${PLUGIN} for: ${HEADER} in > ${OGRE_PLUGIN_PATH_SUFFIXES}") endif() 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 () if (OGRE_${PLUGIN}_FOUND) message(STATUS "Found ${PLUGIN} set as : OGRE_${PLUGIN}_FOUND") 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}/../.. ) set(OGRE_PLUGIN_SEARCH_PATH_DBG ${OGRE_LIBRARY_DIR_DBG}/.. ${OGRE_LIBRARY_DIR_DBG}/../.. ) 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 NO_CMAKE_FIND_ROOT_PATH) 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 PCZSceneManager) ogre_find_plugin(Plugin_OctreeZone OgreOctreeZone.h PCZ OctreeZone) ogre_find_plugin(Plugin_BSPSceneManager OgreBspSceneManager.h BSPSceneManager) ogre_find_plugin(Plugin_CgProgramManager OgreCgProgram.h CgProgramManager) ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h OctreeSceneManager) ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h ParticleFX) ogre_find_plugin(Codec_STBI OgreSTBICodec.h STBICodec) ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL) ogre_find_plugin(RenderSystem_GL3Plus OgreGL3PlusRenderSystem.h RenderSystems/GL3Plus) ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2) ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9) ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11) if (NOT ANDROID) ogre_find_plugin(RenderSystem_Tiny OgreTinyRenderSystem.h RenderSystems/Tiny) ogre_find_plugin(RenderSystem_Vulkan OgreVulkanRenderSystem.h RenderSystems/Vulkan) endif() if (APPLE) ogre_find_plugin(RenderSystem_Metal OgreMetalRenderSystem.h RenderSystems/Metal) endif() if (OGRE_STATIC) # check if dependencies for plugins are met if (NOT DirectX9_FOUND) set(OGRE_RenderSystem_Direct3D9_FOUND FALSE) endif () if (NOT DirectX11_FOUND) set(OGRE_RenderSystem_Direct3D11_FOUND FALSE) endif () if (NOT OPENGL_FOUND) set(OGRE_RenderSystem_GL_FOUND FALSE) endif () if (NOT OPENGL_FOUND) set(OGRE_RenderSystem_GL3Plus_FOUND FALSE) endif () if (NOT OPENGLES2_FOUND) set(OGRE_RenderSystem_GLES2_FOUND FALSE) endif () if (NOT VULKAN_FOUND) set(OGRE_RenderSystem_VULKAN_FOUND FALSE) endif () if (NOT Cg_FOUND) set(OGRE_Plugin_CgProgramManager_FOUND FALSE) endif () set(OGRE_RenderSystem_Direct3D9_LIBRARIES ${OGRE_RenderSystem_Direct3D9_LIBRARIES} ${DirectX9_LIBRARIES} ) set(OGRE_RenderSystem_Direct3D11_LIBRARIES ${OGRE_RenderSystem_Direct3D11_LIBRARIES} ${DirectX_D3D11_LIBRARIES} ) set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES} ${OGRE_GLSupport_LIBRARY} ${OPENGL_LIBRARIES} ) set(OGRE_RenderSystem_GL3Plus_LIBRARIES ${OGRE_RenderSystem_GL3Plus_LIBRARIES} ${OGRE_GLSupport_LIBRARY} ${OPENGL_LIBRARIES} ) set(OGRE_RenderSystem_GLES2_LIBRARIES ${OGRE_RenderSystem_GLES2_LIBRARIES} ${OGRE_GLSupport_LIBRARY} ${OPENGLES2_LIBRARIES} ) set(OGRE_RenderSystem_Vulkan_LIBRARIES ${OGRE_RenderSystem_Vulkan_LIBRARIES} ${VULKAN_LIBRARIES} ) set(OGRE_RenderSystem_Vulkan_INCLUDE_DIRS ${OGRE_RenderSystem_Vulkan_INCLUDE_DIRS} ${VULKAN_INCLUDE_DIR} ) 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}/../.. ) set(OGRE_MEDIA_SEARCH_SUFFIX Samples/Media Media media share/OGRE/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} NO_CMAKE_FIND_ROOT_PATH)