Vendor Magnum and Corrade sources

This commit is contained in:
2026-03-10 19:55:20 +08:00
parent c382cfc3df
commit 5638714000
1156 changed files with 426233 additions and 3 deletions
+59
View File
@@ -0,0 +1,59 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
set(MagnumIntegration_MODULES
FindMagnumIntegration.cmake
MagnumIntegrationConfig.cmake)
# IMPORTANT: When adding a new module here, be sure to update the
# find_path(_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR ...) list in
# FindMagnumIntegration.cmake to avoid breakages when the directory contains
# only that new module.
set(MagnumIntegration_DEPENDENCY_MODULES )
if(MAGNUM_WITH_BULLETINTEGRATION)
list(APPEND MagnumIntegration_DEPENDENCY_MODULES
FindBullet.cmake)
endif()
if(MAGNUM_WITH_GLMINTEGRATION)
list(APPEND MagnumIntegration_DEPENDENCY_MODULES
FindGLM.cmake)
endif()
if(MAGNUM_WITH_IMGUIINTEGRATION)
list(APPEND MagnumIntegration_DEPENDENCY_MODULES
FindImGui.cmake)
endif()
if(MAGNUM_WITH_OVRINTEGRATION)
list(APPEND MagnumIntegration_DEPENDENCY_MODULES
FindOVR.cmake)
endif()
install(FILES ${MagnumIntegration_MODULES} DESTINATION ${MAGNUMINTEGRATION_CMAKE_MODULE_INSTALL_DIR})
if(MagnumIntegration_DEPENDENCY_MODULES)
install(FILES ${MagnumIntegration_DEPENDENCY_MODULES} DESTINATION ${MAGNUMINTEGRATION_CMAKE_MODULE_INSTALL_DIR}/dependencies)
endif()
# Magnum Integration dependency module dir for superprojects
set(_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
+261
View File
@@ -0,0 +1,261 @@
#.rst:
# Find Bullet
# -----------
#
# Finds the Bullet libraries. This module defines:
#
# Bullet_FOUND - True if Bullet is found
# Bullet::Dynamics - Bullet Dynamics imported target. Depends on
# Bullet::Collision and Bullet::LinearMath.
# Bullet::Collision - Bullet Collision imported target. Depends on
# Bullet::LinearMath.
# Bullet::LinearMath - Bullet Linear Math imported target
# Bullet::SoftBody - Bullet Soft Body imported target. Depends on
# Bullet::Dynamics, Bullet::Collision and Bullet::LinearMath.
#
# Additionally these variables are defined for internal usage:
#
# Bullet_Dynamics_LIBRARY_{DEBUG,RELEASE} - Bullet Dynamics library location
# Bullet_Collision_LIBRARY_{DEBUG,RELEASE} - Bullet Collision library location
# Bullet_LinearMath_LIBRARY_{DEBUG,RELEASE} - Bullet Linear Math library
# location
# Bullet_SoftBody_LIBRARY_{DEBUG,RELEASE} - Bullet SoftBody library location
# Bullet_INCLUDE_DIR - Include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# In case we have Bullet as a CMake subproject, BulletCollision should be
# defined (as opposed to Bullet3Common, which can be disabled with
# BUILD_BULLET3). If it's not, try to find the Bullet config file -- under
# Vcpkg at least, it defines imported targets that we can use. Vanilla Bullet
# also installs a config file, however that file is rather unhelpful since it
# doesn't expose any imported targets that I could rely on. And instead of
# extracting everything out of BULLET_LIBRARIES I'd rather just search for it
# myself.
# TODO: builtin support for Bullet from Emscripten Ports (-s USE_BULLET=1)
#
if(TARGET BulletCollision)
# Double-check that we actually have Bullet as a CMake subproject by
# checking its BUILD_BULLET3 option. If we do and we're building static
# libs, Bullet's own targets don't express inter-library dependencies
# correctly, causing linker errors on our side. If we're on CMake 3.13, we
# can fix that from outside, otherwise unfortunately bad luck.
# TODO: this will probably blow up in Vcpkg as well, the patch there should
# get expanded to remove the if(BUILD_SHARED_LIBS) around
# target_link_libraries(). Ideally, such patch should be pushed to Bullet
# upstream.
get_target_property(_BULLET_LIBRARY_TYPE BulletCollision TYPE)
if(DEFINED BUILD_BULLET3 AND _BULLET_LIBRARY_TYPE STREQUAL STATIC_LIBRARY)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(SEND_ERROR "Statically-built Bullet as a CMake subproject requires CMake 3.13 in order to patch in correct inter-library dependencies and avoid linker errors. To continue, either upgrade CMake, enable BUILD_SHARED_LIBS to build Bullet as shared, or use an external Bullet installation.")
else()
cmake_policy(PUSH)
cmake_policy(SET CMP0079 NEW)
# Not using PUBLIC to avoid a potential conflict between an
# all-plain and all-keyword signature.
target_link_libraries(BulletCollision LinearMath)
target_link_libraries(BulletDynamics BulletCollision)
target_link_libraries(BulletSoftBody BulletDynamics)
cmake_policy(POP)
endif()
endif()
else()
find_package(Bullet CONFIG QUIET)
endif()
# Bullet's math library has a special name, so it has to be handled separately.
# Sigh. TODO: other libs such as Bullet3Common, Robotics, InverseDynamics?
set(_BULLET_SANE_LIBRARIES Dynamics Collision SoftBody)
set(_BULLET_LIBRARIES LinearMath ${_BULLET_SANE_LIBRARIES})
# We have a CMake subproject or a Vcpkg package, base our targets on those.
# That's all needed, so exit right after.
if(TARGET BulletCollision)
foreach(_library ${_BULLET_SANE_LIBRARIES})
if(NOT TARGET Bullet::${_library})
# Aliases of (global) targets are only supported in CMake 3.11, so
# we work around it by this. This is easier than fetching all
# possible properties (which are impossible to track of) and then
# attempting to rebuild them into a new target.
add_library(Bullet::${_library} INTERFACE IMPORTED)
set_target_properties(Bullet::${_library} PROPERTIES
INTERFACE_LINK_LIBRARIES Bullet${_library})
endif()
endforeach()
# Bullet3Common doesn't have an INTERFACE_INCLUDE_DIRECTORIES property as
# bullet only uses include_directories(), not the target_*() variant. This
# means that linking to any of the targets will not drag along any include
# directory, which we have to fix -- and since everything depends on
# LinearMath, we can add it just for that target.
#
# In case of a CMake subproject, we derive the include directory from the
# target SOURCE_DIR.
#
# In case of Vcpkg, SOURCE_DIR is likely meaningless, but because the Vcpkg
# package uses a patched config file, we can use BULLET_INCLUDE_DIR.
if(BULLET_INCLUDE_DIR)
set(_BULLET_INTERFACE_INCLUDE_DIRECTORIES ${BULLET_INCLUDE_DIR})
else()
get_target_property(_BULLET_INTERFACE_INCLUDE_DIRECTORIES BulletCollision SOURCE_DIR)
get_filename_component(_BULLET_INTERFACE_INCLUDE_DIRECTORIES ${_BULLET_INTERFACE_INCLUDE_DIRECTORIES} DIRECTORY)
endif()
# Compile definitions, which is basically just USE_DOUBLE_PRECISION. If
# Bullet was found externally, this is contained in the BULLET_DEFINITIONS
# variable (which might be empty). If the variable isn't defined, it means
# we have a Bullet subproject. OF COURSE this isn't propagated in
# INTERFACE_COMPILE_DEFINITIONS, we can't expect any modicum of usability
# there, so we have to fetch that from the CMake option instead.
if(NOT DEFINED BULLET_DEFINITIONS AND USE_DOUBLE_PRECISION)
set(BULLET_DEFINITIONS "-DBT_USE_DOUBLE_PRECISION")
endif()
# Why, Bullet, why this library has to have such a different name?
if(NOT TARGET Bullet::LinearMath)
# Aliases of (global) targets [..] CMake 3.11 [...], as above
add_library(Bullet::LinearMath INTERFACE IMPORTED)
set_target_properties(Bullet::LinearMath PROPERTIES
INTERFACE_LINK_LIBRARIES LinearMath
INTERFACE_INCLUDE_DIRECTORIES ${_BULLET_INTERFACE_INCLUDE_DIRECTORIES}
# This might define BT_USE_DOUBLE_PRECISION, or not
INTERFACE_COMPILE_OPTIONS "${BULLET_DEFINITIONS}")
endif()
# Just to make FPHSA print some meaningful location, nothing else. Luckily
# we can just reuse what we had to find above.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("Bullet" DEFAULT_MSG
_BULLET_INTERFACE_INCLUDE_DIRECTORIES)
return()
endif()
include(SelectLibraryConfigurations)
# The vanilla FindBullet.cmake in addition searches in lib/{Debug,Release} and
# out/{debug,release}8/libs. The former seems Windows-specific (see
# https://gitlab.kitware.com/cmake/cmake/-/commit/f180b24ef43d48fcec265656ee73ab9130fe39bd
# ) but I don't see such paths being used anymore -- the install on Windows
# just puts everything directly into lib/ and bin/. The weird path with 8 in it
# is there unchanged since the beginning (2009) and without any comment, I'll
# assume that's just obsolete.
foreach(_library ${_BULLET_SANE_LIBRARIES})
find_library(Bullet_${_library}_LIBRARY_RELEASE NAMES Bullet${_library})
find_library(Bullet_${_library}_LIBRARY_DEBUG
NAMES
# Vanilla Bullet adds the _Debug suffix to Debug libraries
# https://github.com/bulletphysics/bullet3/blob/ad931b8c392d8dd5e4472121c9b5dc23a2efcec2/CMakeLists.txt#L206
Bullet${_library}_Debug
# ... however in many cases the packages override that to just _d
# https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-bullet/PKGBUILD
Bullet${_library}_d)
select_library_configurations(Bullet_${_library})
endforeach()
# Why, Bullet, why?
find_library(Bullet_LinearMath_LIBRARY_RELEASE NAMES LinearMath)
find_library(Bullet_LinearMath_LIBRARY_DEBUG
NAMES
LinearMath_Debug
LinearMath_d)
select_library_configurations(Bullet_LinearMath)
# Include dir
find_path(Bullet_INCLUDE_DIR NAMES btBulletCollisionCommon.h
PATH_SUFFIXES bullet)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Bullet DEFAULT_MSG
# Those are the default set searched for by vanilla FindBullet, so assume
# those are essential and everything else is optional(?)
Bullet_Dynamics_LIBRARY
Bullet_Collision_LIBRARY
Bullet_LinearMath_LIBRARY
Bullet_SoftBody_LIBRARY
Bullet_INCLUDE_DIR)
mark_as_advanced(FORCE Bullet_INCLUDE_DIR)
foreach(_library ${_BULLET_LIBRARIES})
# Usually other Find modules (such as FindSDL2) add an extra step for
# handling macOS frameworks, but vanilla FindBullet doesn't so it's not
# needed? https://cmake.org/pipermail/cmake/2016-April/063179.html
# TODO: When extra optional libraries are added, this needs to check for
# their presence as well
if(NOT TARGET Bullet::${_library})
add_library(Bullet::${_library} UNKNOWN IMPORTED)
if(Bullet_${_library}_LIBRARY_RELEASE)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Bullet::${_library} PROPERTIES
IMPORTED_LOCATION_RELEASE ${Bullet_${_library}_LIBRARY_RELEASE})
endif()
if(Bullet_${_library}_LIBRARY_DEBUG)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Bullet::${_library} PROPERTIES
IMPORTED_LOCATION_DEBUG ${Bullet_${_library}_LIBRARY_DEBUG})
endif()
# Everything depends on LinearMath, so put the include dir as well as
# compile definitions (such as BT_USE_DOUBLE_PRECISION) there
if(_library STREQUAL LinearMath)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Bullet_INCLUDE_DIR})
# BULLET_DEFINITIONS gets defined by BulletConfig from the
# find_package() we did at first. That's also the only useful
# thing from it, the rest we can find by hand as well.
if(BULLET_DEFINITIONS)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "${BULLET_DEFINITIONS}")
endif()
# Collision depends on LinearMath
elseif(_library STREQUAL Collision)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Bullet::LinearMath)
# Dynamics depends on Collision and LinearMath
elseif(_library STREQUAL Dynamics)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Bullet::Collision Bullet::LinearMath)
# SoftBody depends on Dynamics, Collision and LinearMath (according to
# ldd at least, not sure what's the real dependency chain)
elseif(_library STREQUAL SoftBody)
set_property(TARGET Bullet::${_library} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Bullet::Dynamics Bullet::Collision Bullet::LinearMath)
# Sanity check in case we expand the library list
else()
message(FATAL_ERROR "Unhandled dependencies of Bullet::${_library}")
endif()
endif()
endforeach()
+812
View File
@@ -0,0 +1,812 @@
#.rst:
# Find Corrade
# ------------
#
# Finds the Corrade library. Basic usage::
#
# find_package(Corrade REQUIRED)
#
# This module tries to find the base Corrade library and then defines the
# following:
#
# Corrade_FOUND - Whether the base library was found
# CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module
#
# This command will try to find only the base library, not the optional
# components, which are:
#
# Containers - Containers library
# Interconnect - Interconnect library
# Main - Main library
# PluginManager - PluginManager library
# TestSuite - TestSuite library
# Utility - Utility library
# rc - corrade-rc executable
#
# Example usage with specifying additional components is::
#
# find_package(Corrade REQUIRED Utility TestSuite)
#
# For each component is then defined:
#
# Corrade_*_FOUND - Whether the component was found
# Corrade::* - Component imported target
#
# The package is found if either debug or release version of each library is
# found. If both debug and release libraries are found, proper version is
# chosen based on actual build configuration of the project (i.e. Debug build
# is linked to debug libraries, Release build to release libraries).
#
# Corrade conditionally defines ``CORRADE_IS_DEBUG_BUILD`` preprocessor
# variable in case build configuration is ``Debug`` (not Corrade itself, but
# build configuration of the project using it). Useful e.g. for selecting
# proper plugin directory.
#
# Corrade defines the following custom target properties:
#
# CORRADE_CXX_STANDARD - C++ standard to require when compiling given
# target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains
# particular standard setting flag or if given target contains
# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17.
# INTERFACE_CORRADE_CXX_STANDARD - C++ standard to require when using given
# target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains
# particular standard setting flag or if given target contains
# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17.
# CORRADE_USE_PEDANTIC_FLAGS - Enable additional compiler/linker flags.
# Boolean.
#
# These properties are inherited from directory properties, meaning that if you
# set them on directories, they get implicitly set on all targets in given
# directory (with a possibility to do target-specific overrides). All Corrade
# libraries have the :prop_tgt:`INTERFACE_CORRADE_CXX_STANDARD` property set to
# 11, meaning that you will always have at least C++11 enabled once you link to
# any Corrade library.
#
# Features of found Corrade library are exposed in these variables:
#
# CORRADE_MSVC_COMPATIBILITY - Defined if compiled with compatibility
# mode for MSVC 2019+ without the /permissive- flag set
# CORRADE_MSVC2017_COMPATIBILITY - Defined if compiled with compatibility
# mode for MSVC 2017
# CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility
# mode for MSVC 2015
# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated features
# included
# CORRADE_BUILD_STATIC - Defined if compiled as static libraries.
# Default are shared libraries.
# CORRADE_BUILD_STATIC_UNIQUE_GLOBALS - Defined if static libraries keep their
# globals unique even across different shared libraries. Enabled by default
# for static builds.
# CORRADE_BUILD_MULTITHREADED - Defined if compiled in a way that makes it
# possible to safely use certain Corrade features simultaneously in multiple
# threads
# CORRADE_BUILD_CPU_RUNTIME_DISPATCH - Defined if built with code paths
# optimized for multiple architectres with the best matching variant selected
# at runtime based on detected CPU features
# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor
# (Linux, BSD, macOS)
# CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms
# CORRADE_TARGET_IOS - Defined if compiled for iOS (device or
# simulator)
# CORRADE_TARGET_IOS_SIMULATOR - Defined if compiled for iOS Simulator
# CORRADE_TARGET_WINDOWS - Defined if compiled for Windows
# CORRADE_TARGET_WINDOWS_RT - Defined if compiled for Windows RT
# CORRADE_TARGET_EMSCRIPTEN - Defined if compiled for Emscripten
# CORRADE_TARGET_ANDROID - Defined if compiled for Android
# CORRADE_TARGET_GCC - Defined if compiling with GCC or GCC-
# compatible Clang
# CORRADE_TARGET_CLANG - Defined if compiling with Clang or any of its
# variants
# CORRADE_TARGET_APPLE_CLANG - Defined if compiling with Apple's Clang
# CORRADE_TARGET_CLANG_CL - Defined if compiling with Clang-CL (Clang
# with a MSVC frontend)
# CORRADE_TARGET_MSVC - Defined if compiling with MSVC or Clang with
# a MSVC frontend
# CORRADE_TARGET_MINGW - Defined if compiling under MinGW
# CORRADE_CPU_USE_IFUNC - Defined if GNU IFUNC is allowed to be used
# for runtime dispatch in the Cpu library
# CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - Defined if PluginManager
# doesn't support dynamic plugin loading due to platform limitations
# CORRADE_TESTSUITE_TARGET_XCTEST - Defined if TestSuite is targeting Xcode
# XCTest
# CORRADE_UTILITY_USE_ANSI_COLORS - Defined if ANSI escape sequences are used
# for colored output with Utility::Debug on Windows
#
# Additionally these variables are defined for internal usage:
#
# CORRADE_INCLUDE_DIR - Root include dir
# CORRADE_*_LIBRARY_DEBUG - Debug version of given library, if found
# CORRADE_*_LIBRARY_RELEASE - Release version of given library, if found
# CORRADE_*_EXECUTABLE - Location of given executable, if found
# CORRADE_*_EXECUTABLE_EMULATOR - Emulator to run CORRADE_*_EXECUTABLE, if a
# non-native version was found when cross-compiling
# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included
# automatically)
# CORRADE_DEPENDENCY_MODULE_DIR - Path to Find modules for dependencies used
# internally by Corrade. Defined only if any such modules are expected to
# exist on given platform.
# CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file
# CORRADE_TESTSUITE_ADB_RUNNER - Path to AdbRunner.sh file
# CORRADE_UTILITY_JS - Path to CorradeUtility.js file
# CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used
# for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled
# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler
# definitions used for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS`
# enabled
# CORRADE_CXX{11,14,17,20}_STANDARD_FLAG - Compiler flag to use for targeting
# C++11, 14, 17 or 20 in cases where it's not possible to use
# :prop_tgt:`CORRADE_CXX_STANDARD`. Not defined if a standard switch is
# already present in :variable:`CMAKE_CXX_FLAGS`.
#
# Corrade provides these macros and functions:
#
# .. command:: corrade_add_test
#
# Add unit test using Corrade's TestSuite::
#
# corrade_add_test(<test name>
# <sources>...
# [LIBRARIES <libraries>...]
# [FILES <files>...]
# [ARGUMENTS <arguments>...])
#
# Test name is also executable name. You can use ``LIBRARIES`` to specify
# libraries to link with instead of using :command:`target_link_libraries()`.
# The ``Corrade::TestSuite`` target is linked automatically to each test. Note
# that the :command:`enable_testing()` function must be called explicitly.
# Arguments passed after ``ARGUMENTS`` will be appended to the test
# command line. ``ARGUMENTS`` are supported everywhere except when
# ``CORRADE_TESTSUITE_TARGET_XCTEST`` is enabled.
#
# You can list files needed by the test in the ``FILES`` section. If given
# filename is relative, it is treated relatively to `CMAKE_CURRENT_SOURCE_DIR`.
# The files are added to the :prop_test:`REQUIRED_FILES` target property. On
# Emscripten they are bundled to the executable and available in the virtual
# filesystem root. On Android they are copied along the executable to the
# target. In case of Emscripten and Android, if the file is absolute or
# contains ``..``, only the leaf name is used. Alternatively you can have a
# filename formatted as ``<input>@<output>``, in which case the ``<input>`` is
# treated as local filesystem location and ``<output>`` as remote/virtual
# filesystem location. The remote location can't be absolute or contain ``..``
# / ``@`` characters.
#
# Unless :variable:`CORRADE_TESTSUITE_TARGET_XCTEST` is set, test cases on iOS
# targets are created as bundles with bundle identifier set to CMake project
# name by default. Use the cache variable :variable:`CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX`
# to change it to something else.
#
# .. command:: corrade_add_resource
#
# Compile data resources into application binary::
#
# corrade_add_resource(<name> <resources.conf>)
#
# Depends on ``Corrade::rc``, which is part of Corrade utilities. This command
# generates resource data using given configuration file in current build
# directory. Argument name is name under which the resources can be explicitly
# loaded. Variable ``<name>`` contains compiled resource filename, which is
# then used for compiling library / executable. On CMake >= 3.1 the
# `resources.conf` file can contain UTF-8-encoded filenames. Example usage::
#
# corrade_add_resource(app_resources resources.conf)
# add_executable(app source1 source2 ... ${app_resources})
#
# .. command:: corrade_add_plugin
#
# Add dynamic plugin::
#
# corrade_add_plugin(<plugin name>
# "<debug binary install dir>;<debug library install dir>"
# "<release binary install dir>;<release library install dir>"
# <metadata file>
# <sources>...)
#
# The macro adds a preprocessor directive ``CORRADE_DYNAMIC_PLUGIN`` when
# compiling ``<sources>``. Additional libraries can be linked in via
# :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# On DLL platforms, the plugin DLLs and metadata files are put into
# ``<debug binary install dir>`` / ``<release binary install dir>`` and the
# ``*.lib`` files into ``<debug library install dir>`` /
# ``<release library install dir>``. On non-DLL platforms everything is put
# into ``<debug library install dir>`` / ``<release library install dir>``.
#
# If the plugin interface disables plugin metadata files, the
# ``<metadata file>`` can be set to ``""``, in which case no metadata file is
# copied anywhere. Otherwise the metadata file is copied and renamed to
# ``<plugin name>``, retaining its original extension.
#
# corrade_add_plugin(<plugin name>
# <debug install dir>
# <release install dir>
# <metadata file>
# <sources>...)
#
# Unlike the above version this puts everything into ``<debug install dir>`` on
# both DLL and non-DLL platforms. If ``<debug install dir>`` is set to
# :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for testing purposes), the files
# are copied directly, without the need to perform install step. Note that the
# files are actually put into configuration-based subdirectory, i.e.
# ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}``. See documentation of
# :variable:`CMAKE_CFG_INTDIR` variable for more information.
#
# .. command:: corrade_add_static_plugin
#
# Add static plugin::
#
# corrade_add_static_plugin(<plugin name>
# "<binary install dir>;<library install dir>"
# <metadata file>
# <sources>...)
#
# The macro adds a preprocessor directive ``CORRADE_STATIC_PLUGIN`` when
# compiling ``<sources>``. Additional libraries can be linked in via
# :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# The ``<binary install dir>`` is ignored and included just for compatibility
# with the :command:`corrade_add_plugin` command, everything is installed into
# ``<library install dir>``. Note that plugins built in debug configuration
# (e.g. with :variable:`CMAKE_BUILD_TYPE` set to ``Debug``) have ``"-d"``
# suffix to make it possible to have both debug and release plugins installed
# alongside each other.
#
# If the plugin interface disables plugin metadata files, the
# ``<metadata file>`` can be set to ``""``, in which case no metadata file is
# used. Otherwise the metadata file is bundled and renamed to
# ``<plugin name>``, retaining its original extension.
#
# corrade_add_static_plugin(<plugin name>
# <install dir>
# <metadata file>
# <sources>...)
#
# Equivalent to the above with ``<library install dir>`` set to ``<install dir>``.
# If ``<install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for
# testing purposes), no installation rules are added.
#
# .. command:: corrade_find_dlls_for_libs
#
# Find corresponding DLLs for library files::
#
# corrade_find_dlls_for_libs(<output variable> <libs>...)
#
# Available only on Windows, for all ``*.lib`` files tries to find
# corresponding DLL file. Useful for bundling dependencies for e.g. WinRT
# packages.
#
#
# This file is part of Corrade.
#
# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
# 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Root include dir
find_path(CORRADE_INCLUDE_DIR
NAMES Corrade/Corrade.h)
mark_as_advanced(CORRADE_INCLUDE_DIR)
# Configuration file
find_file(_CORRADE_CONFIGURE_FILE configure.h
HINTS ${CORRADE_INCLUDE_DIR}/Corrade/)
mark_as_advanced(_CORRADE_CONFIGURE_FILE)
# We need to open configure.h file from CORRADE_INCLUDE_DIR before we check for
# the components. Bail out with proper error message if it wasn't found. The
# complete check with all components is further below.
if(NOT CORRADE_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Corrade
REQUIRED_VARS CORRADE_INCLUDE_DIR _CORRADE_CONFIGURE_FILE)
endif()
# Read flags from configuration
file(READ ${_CORRADE_CONFIGURE_FILE} _corradeConfigure)
string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}")
string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}")
set(_corradeFlags
MSVC2015_COMPATIBILITY
MSVC2017_COMPATIBILITY
MSVC_COMPATIBILITY
BUILD_DEPRECATED
BUILD_STATIC
BUILD_STATIC_UNIQUE_GLOBALS
BUILD_MULTITHREADED
BUILD_CPU_RUNTIME_DISPATCH
TARGET_UNIX
TARGET_APPLE
TARGET_IOS
TARGET_IOS_SIMULATOR
TARGET_WINDOWS
TARGET_WINDOWS_RT
TARGET_EMSCRIPTEN
TARGET_ANDROID
# TARGET_X86 etc, TARGET_32BIT, TARGET_BIG_ENDIAN and TARGET_LIBCXX etc.
# are not exposed to CMake as the meaning is unclear on platforms with
# multi-arch binaries or when mixing different STL implementations.
# TARGET_GCC etc are figured out via UseCorrade.cmake, as the compiler can
# be different when compiling the lib & when using it.
CPU_USE_IFUNC
PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
TESTSUITE_TARGET_XCTEST
UTILITY_USE_ANSI_COLORS)
foreach(_corradeFlag ${_corradeFlags})
list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag})
if(NOT _corrade_${_corradeFlag} EQUAL -1)
set(CORRADE_${_corradeFlag} 1)
endif()
endforeach()
# CMake module dir
find_path(_CORRADE_MODULE_DIR
NAMES UseCorrade.cmake CorradeLibSuffix.cmake
PATH_SUFFIXES share/cmake/Corrade)
mark_as_advanced(_CORRADE_MODULE_DIR)
if(CORRADE_TARGET_EMSCRIPTEN)
find_path(CORRADE_DEPENDENCY_MODULE_DIR
NAMES FindNodeJs.cmake
PATH_SUFFIXES share/cmake/Corrade/dependencies)
mark_as_advanced(CORRADE_DEPENDENCY_MODULE_DIR)
endif()
set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake)
set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake)
# Component distinction (listing them explicitly to avoid mistakes with finding
# unknown components)
set(_CORRADE_LIBRARY_COMPONENTS
Containers Interconnect Main PluginManager TestSuite Utility)
# These libraries are excluded from DLL detection if Corrade is built as shared
set(_CORRADE_LIBRARY_COMPONENTS_ALWAYS_STATIC
Main)
set(_CORRADE_HEADER_ONLY_COMPONENTS Containers)
if(NOT CORRADE_TARGET_WINDOWS)
# CorradeMain is a real library only on windows, a dummy target elsewhere
list(APPEND _CORRADE_HEADER_ONLY_COMPONENTS Main)
endif()
set(_CORRADE_EXECUTABLE_COMPONENTS rc)
# Currently everything is enabled implicitly. Keep in sync with Corrade's root
# CMakeLists.txt.
set(_CORRADE_IMPLICITLY_ENABLED_COMPONENTS
Containers Interconnect Main PluginManager TestSuite Utility rc)
# Inter-component dependencies
set(_CORRADE_Containers_DEPENDENCIES Utility)
set(_CORRADE_Interconnect_DEPENDENCIES Containers Utility)
set(_CORRADE_PluginManager_DEPENDENCIES Containers Utility rc)
set(_CORRADE_TestSuite_DEPENDENCIES Containers Utility Main) # see below
set(_CORRADE_Utility_DEPENDENCIES Containers rc)
# Ensure that all inter-component dependencies are specified as well
foreach(_component ${Corrade_FIND_COMPONENTS})
# Mark the dependencies as required if the component is also required
if(Corrade_FIND_REQUIRED_${_component})
foreach(_dependency ${_CORRADE_${_component}_DEPENDENCIES})
set(Corrade_FIND_REQUIRED_${_dependency} TRUE)
endforeach()
endif()
list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_component}_DEPENDENCIES})
endforeach()
# Main is linked only in corrade_add_test(), not to everything that depends on
# TestSuite, so remove it from the list again once we filled the above
# variables
set(_CORRADE_TestSuite_DEPENDENCIES Containers Utility)
# Join the lists, remove duplicate components
set(_CORRADE_ORIGINAL_FIND_COMPONENTS ${Corrade_FIND_COMPONENTS})
if(_CORRADE_ADDITIONAL_COMPONENTS)
list(INSERT Corrade_FIND_COMPONENTS 0 ${_CORRADE_ADDITIONAL_COMPONENTS})
endif()
if(Corrade_FIND_COMPONENTS)
list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS)
endif()
# Special cases of include paths. Libraries not listed here have a path suffix
# and include name derived from the library name in the loop below.
set(_CORRADE_MAIN_INCLUDE_PATH_SUFFIX Corrade)
set(_CORRADE_MAIN_INCLUDE_PATH_NAMES Corrade.h)
# Find all components
foreach(_component ${Corrade_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET "Corrade::${_component}") # Quotes to "fix" KDE's higlighter
set(Corrade_${_component}_FOUND TRUE)
else()
# Default include path names to look for for library / header-only
# components, unless set above already
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS)
if(NOT _CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX)
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade/${_component})
endif()
if(NOT _CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES)
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h)
endif()
endif()
# The Main library consists of two libraries on MinGW to be able to
# handle both console and windows apps, special-case it before any
# other libraries. The CORRADE_MAIN{CONSOLE,WINDOWS}_LIBRARY_<CONFIG>
# variables then get subsequently used below.
if(MINGW AND _component STREQUAL Main)
foreach(_mainComponent Console Windows)
string(TOUPPER ${_mainComponent} _MAIN_COMPONENT)
find_library(CORRADE_MAIN${_MAIN_COMPONENT}_LIBRARY_DEBUG CorradeMain${_mainComponent}-d)
find_library(CORRADE_MAIN${_MAIN_COMPONENT}_LIBRARY_RELEASE CorradeMain${_mainComponent})
mark_as_advanced(CORRADE_MAIN${_MAIN_COMPONENT}_LIBRARY_DEBUG
CORRADE_MAIN${_MAIN_COMPONENT}_LIBRARY_RELEASE)
endforeach()
# Library (and not header-only) components
elseif(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS)
# Try to find both debug and release version
find_library(CORRADE_${_COMPONENT}_LIBRARY_DEBUG Corrade${_component}-d)
find_library(CORRADE_${_COMPONENT}_LIBRARY_RELEASE Corrade${_component})
mark_as_advanced(CORRADE_${_COMPONENT}_LIBRARY_DEBUG
CORRADE_${_COMPONENT}_LIBRARY_RELEASE)
# On Windows, if we have a dynamic build of given library, find the
# DLLs as well. Abuse find_program() since the DLLs should be
# alongside usual executables. On MinGW they however have a lib
# prefix.
if(CORRADE_TARGET_WINDOWS AND NOT CORRADE_BUILD_STATIC AND NOT _component IN_LIST _CORRADE_LIBRARY_COMPONENTS_ALWAYS_STATIC)
find_program(CORRADE_${_COMPONENT}_DLL_DEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}Corrade${_component}-d.dll)
find_program(CORRADE_${_COMPONENT}_DLL_RELEASE ${CMAKE_SHARED_LIBRARY_PREFIX}Corrade${_component}.dll)
mark_as_advanced(CORRADE_${_COMPONENT}_DLL_DEBUG
CORRADE_${_COMPONENT}_DLL_RELEASE)
# If not on Windows or on a static build, unset the DLL variables
# to avoid leaks when switching shared and static builds
else()
unset(CORRADE_${_COMPONENT}_DLL_DEBUG CACHE)
unset(CORRADE_${_COMPONENT}_DLL_RELEASE CACHE)
endif()
# Executable components
elseif(_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS)
find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component})
mark_as_advanced(CORRADE_${_COMPONENT}_EXECUTABLE)
# If the executable wasn't found, we're cross-compiling, an
# emulator is set and we're on CMake 3.6+ that actually uses
# CMAKE_CROSSCOMPILING_EMULATOR in add_custom_command((), try to
# find the cross-compiled version as a (slower) fallback. This
# assumes the toolchain sets CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to
# NEVER, i.e. that the search is restricted to native executables
# by default.
if(NOT CORRADE_${_COMPONENT}_EXECUTABLE AND CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR AND NOT CMAKE_VERSION VERSION_LESS 3.6)
# Additionally, there are no CMAKE_FIND_PROGRAM_SUFFIXES akin
# to CMAKE_FIND_LIBRARY_SUFFIXES for libraries, so we have to
# try manually.
if(CORRADE_TARGET_EMSCRIPTEN)
set(_CORRADE_PROGRAM_EXTENSION .js)
endif()
find_program(CORRADE_${_COMPONENT}_EXECUTABLE
NAMES
corrade-${_component}
corrade-${_component}${_CORRADE_PROGRAM_EXTENSION}
ONLY_CMAKE_FIND_ROOT_PATH)
if(CORRADE_${_COMPONENT}_EXECUTABLE)
set(CORRADE_${_COMPONENT}_EXECUTABLE_EMULATOR ${CMAKE_CROSSCOMPILING_EMULATOR} CACHE PATH "Emulator for running a cross-compiled corrade-${_component} executable")
mark_as_advanced(CORRADE_${_COMPONENT}_EXECUTABLE_EMULATOR)
endif()
endif()
# If not a header-only component it's something unknown, skip. FPHSA
# will take care of handling this below.
elseif(NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS)
continue()
endif()
# Find library includes
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS)
find_path(_CORRADE_${_COMPONENT}_INCLUDE_DIR
NAMES ${_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES}
HINTS ${CORRADE_INCLUDE_DIR}/${_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX})
mark_as_advanced(_CORRADE_${_COMPONENT}_INCLUDE_DIR)
endif()
# Decide if the component was found. If not, skip the rest, which
# creates and populates the target and finds additional dependencies.
# If found, the _FOUND variable may still get reset by something below.
#
# The Main library consists of two libraries on MinGW to be able to
# handle both console and windows apps. See
# src/Corrade/CMakeLists.txt for a lengthy explanation. On non-MinGW
# it's handled as a regular library or a header-only library.
if(MINGW AND _component STREQUAL Main)
if((CORRADE_MAINCONSOLE_LIBRARY_DEBUG AND CORRADE_MAINWINDOWS_LIBRARY_DEBUG) OR (CORRADE_MAINCONSOLE_LIBRARY_RELEASE AND CORRADE_MAINWINDOWS_LIBRARY_RELEASE))
set(Corrade_Main_FOUND TRUE)
else()
set(Corrade_Main_FOUND FALSE)
continue()
endif()
elseif(
# If the component is a library, it should have the include dir
(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (
# And it should be either header-only
_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR
# Or have a debug library, and a DLL found if expected
(CORRADE_${_COMPONENT}_LIBRARY_DEBUG AND (
NOT DEFINED CORRADE_${_COMPONENT}_DLL_DEBUG OR
CORRADE_${_COMPONENT}_DLL_DEBUG)) OR
# Or have a release library, and a DLL found if expected
(CORRADE_${_COMPONENT}_LIBRARY_RELEASE AND (
NOT DEFINED CORRADE_${_COMPONENT}_DLL_RELEASE OR
CORRADE_${_COMPONENT}_DLL_RELEASE)))) OR
# If the component is an executable, it should have just the
# location
(_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS AND CORRADE_${_COMPONENT}_EXECUTABLE)
)
set(Corrade_${_component}_FOUND TRUE)
else()
set(Corrade_${_component}_FOUND FALSE)
continue()
endif()
# Target for header-only library components. The Main library consists
# of two libraries on MinGW to be able to handle both console and
# windows apps, so there the target is INTERFACE as well, and is filled
# with INTERFACE_LINK_LIBRARIES later below.
if(_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR (MINGW AND _component STREQUAL Main))
add_library(Corrade::${_component} INTERFACE IMPORTED)
# Target and location for (non-header-only) libraries
elseif(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS)
if(CORRADE_BUILD_STATIC OR _component IN_LIST _CORRADE_LIBRARY_COMPONENTS_ALWAYS_STATIC)
add_library(Corrade::${_component} STATIC IMPORTED)
else()
add_library(Corrade::${_component} SHARED IMPORTED)
endif()
foreach(_CONFIG DEBUG RELEASE)
if(NOT CORRADE_${_COMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET Corrade::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
# Unfortunately for a DLL the two properties are swapped out,
# *.lib goes to IMPLIB, so it's duplicated like this
if(DEFINED CORRADE_${_COMPONENT}_DLL_${_CONFIG})
# Quotes to "fix" KDE's higlighter
set_target_properties("Corrade::${_component}" PROPERTIES
IMPORTED_LOCATION_${_CONFIG} ${CORRADE_${_COMPONENT}_DLL_${_CONFIG}}
IMPORTED_IMPLIB_${_CONFIG} ${CORRADE_${_COMPONENT}_LIBRARY_${_CONFIG}})
else()
set_property(TARGET Corrade::${_component} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${CORRADE_${_COMPONENT}_LIBRARY_${_CONFIG}})
endif()
endforeach()
# Target and location for executable components
elseif(_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS)
add_executable(Corrade::${_component} IMPORTED)
set_property(TARGET Corrade::${_component} PROPERTY
IMPORTED_LOCATION ${CORRADE_${_COMPONENT}_EXECUTABLE})
endif()
# No special setup for Containers library
# Interconnect library
if(_component STREQUAL Interconnect)
# Disable /OPT:ICF on MSVC, which merges functions with identical
# contents and thus breaks signal comparison. Same case is for
# clang-cl which uses the MSVC linker by default.
if(CORRADE_TARGET_WINDOWS AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
if(CMAKE_VERSION VERSION_LESS 3.13)
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_LINK_LIBRARIES "-OPT:NOICF,REF")
else()
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_LINK_OPTIONS "/OPT:NOICF,REF")
endif()
endif()
# Main library
elseif(_component STREQUAL Main)
# On non-Windows platforms Main is a no-op interface target
if(CORRADE_TARGET_WINDOWS)
# On MinGW the library consists of two libraries, for which we
# need to add two extra targets to delegate to. See
# src/Corrade/CMakeLists.txt for a lengthy explanation.
if(MINGW)
foreach(_mainComponent Console Windows)
string(TOUPPER ${_mainComponent} _MAINCOMPONENT)
# Similarly as with _CORRADE_LIBRARY_COMPONENTS above,
# just specialized for the Main library (and without
# DLL handling, as the library is always static)
add_library(Corrade::Main${_mainComponent} STATIC IMPORTED)
foreach(_CONFIG DEBUG RELEASE)
if(NOT CORRADE_MAIN${_MAINCOMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET Corrade::Main${_mainComponent} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
set_property(TARGET Corrade::Main${_mainComponent} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${CORRADE_MAIN${_MAINCOMPONENT}_LIBRARY_${_CONFIG}})
endforeach()
endforeach()
# See src/Corrade/CMakeLists.txt for why -lmingw32 has to
# be linked this way
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "-municode;$<$<NOT:$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>>:Corrade::MainConsole>$<$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>:-lmingw32;Corrade::MainWindows>")
# On MSVC and clang-cl it's simple, there's just a single
# library that was already added above. Add just the /ENTRY
# flag.
else()
# Abusing INTERFACE_LINK_LIBRARIES because
# INTERFACE_LINK_OPTIONS is only since 3.13. They treat
# things with `-` in front as linker flags and fortunately
# I can use `-ENTRY` instead of `/ENTRY`.
# https://gitlab.kitware.com/cmake/cmake/issues/16543
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "-ENTRY:$<$<NOT:$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>>:wmainCRTStartup>$<$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>:wWinMainCRTStartup>")
endif()
endif()
# PluginManager library
elseif(_component STREQUAL PluginManager)
# -ldl is handled by Utility now
# TestSuite library has some additional files. If those are not found,
# set the component _FOUND variable to false so it works properly both
# when the component is required and when it's optional.
elseif(_component STREQUAL TestSuite)
# XCTest runner file
if(CORRADE_TESTSUITE_TARGET_XCTEST)
find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in
PATH_SUFFIXES share/corrade/TestSuite)
if(NOT CORRADE_TESTSUITE_XCTEST_RUNNER)
set(Corrade_${_component}_FOUND FALSE)
endif()
# ADB runner file
elseif(CORRADE_TARGET_ANDROID)
find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh
PATH_SUFFIXES share/corrade/TestSuite)
if(NOT CORRADE_TESTSUITE_ADB_RUNNER)
set(Corrade_${_component}_FOUND FALSE)
endif()
# Emscripten runner file
elseif(CORRADE_TARGET_EMSCRIPTEN)
find_file(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER EmscriptenRunner.html.in
PATH_SUFFIXES share/corrade/TestSuite)
if(NOT CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER)
set(Corrade_${_component}_FOUND FALSE)
endif()
endif()
# Utility library (contains all setup that is used by others)
elseif(_component STREQUAL Utility)
# Top-level include directory
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${CORRADE_INCLUDE_DIR})
# Require (at least) C++11 for users
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD)
# -fno-strict-aliasing is set in UseCorrade.cmake for everyone who
# enables CORRADE_USE_PEDANTIC_FLAGS. Not all projects linking to
# Corrade enable it (or can't enable it), but this flag is
# essential to prevent insane bugs and random breakages, so force
# it for anyone linking to Corrade::Utility. Similar code is in
# Corrade/Utility/CMakeLists.txt.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang" AND NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") OR CORRADE_TARGET_EMSCRIPTEN)
set_property(TARGET Corrade::${_component} APPEND PROPERTY INTERFACE_COMPILE_OPTIONS -fno-strict-aliasing)
endif()
# Path::libraryLocation() needs this
if(CORRADE_TARGET_UNIX)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
endif()
# AndroidLogStreamBuffer class needs to be linked to log library
if(CORRADE_TARGET_ANDROID)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "log")
endif()
# Emscripten has various stuff implemented in JS
if(CORRADE_TARGET_EMSCRIPTEN)
find_file(CORRADE_UTILITY_JS CorradeUtility.js
PATH_SUFFIXES lib)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
# TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once we
# require CMake 3.13 unconditionally
INTERFACE_LINK_LIBRARIES "--js-library ${CORRADE_UTILITY_JS}")
endif()
endif()
# Add inter-library dependencies
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS OR _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS)
foreach(_dependency ${_CORRADE_${_component}_DEPENDENCIES})
if(_dependency IN_LIST _CORRADE_LIBRARY_COMPONENTS OR _dependency IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::${_dependency})
endif()
endforeach()
endif()
endif()
endforeach()
# For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially
# useful info about the failed components.
if(NOT CMAKE_VERSION VERSION_LESS 3.16)
set(_CORRADE_REASON_FAILURE_MESSAGE )
# Go only through the originally specified find_package() components, not
# the dependencies added by us afterwards
foreach(_component ${_CORRADE_ORIGINAL_FIND_COMPONENTS})
if(Corrade_${_component}_FOUND)
continue()
endif()
# If it's not known at all, tell the user -- it might be a new library
# and an old Find module, or something platform-specific.
if(NOT _component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS)
list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not a known component on this platform.")
# Otherwise, if it's not among implicitly built components, hint that
# the user may need to enable it.
# TODO: currently, the _FOUND variable doesn't reflect if dependencies
# were found. When it will, this needs to be updated to avoid
# misleading messages.
elseif(NOT _component IN_LIST _CORRADE_IMPLICITLY_ENABLED_COMPONENTS)
string(TOUPPER ${_component} _COMPONENT)
list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled CORRADE_WITH_${_COMPONENT} when building Corrade.")
# Otherwise we have no idea. Better be silent than to print something
# misleading.
else()
endif()
endforeach()
string(REPLACE ";" " " _CORRADE_REASON_FAILURE_MESSAGE "${_CORRADE_REASON_FAILURE_MESSAGE}")
set(_CORRADE_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_CORRADE_REASON_FAILURE_MESSAGE}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Corrade REQUIRED_VARS
CORRADE_INCLUDE_DIR
_CORRADE_MODULE_DIR
_CORRADE_CONFIGURE_FILE
HANDLE_COMPONENTS
${_CORRADE_REASON_FAILURE_MESSAGE})
# Finalize the finding process
include(${CORRADE_USE_MODULE})
set(CORRADE_INCLUDE_INSTALL_DIR include/Corrade)
if(CORRADE_BUILD_DEPRECATED AND CORRADE_INCLUDE_INSTALL_PREFIX AND NOT CORRADE_INCLUDE_INSTALL_PREFIX STREQUAL ".")
message(DEPRECATION "CORRADE_INCLUDE_INSTALL_PREFIX is obsolete as its primary use was for old Android NDK versions. Please switch to the NDK r19+ layout instead of using this variable and recreate your build directory to get rid of this warning.")
set(CORRADE_INCLUDE_INSTALL_DIR ${CORRADE_INCLUDE_INSTALL_PREFIX}/${CORRADE_INCLUDE_INSTALL_DIR})
endif()
+55
View File
@@ -0,0 +1,55 @@
#.rst:
# Find GLM
# -------------
#
# Finds the GLM library. This module defines:
#
# GLM_FOUND - True if GLM library is found
# GLM::GLM - GLM imported target
#
# Additionally these variables are defined for internal usage:
#
# GLM_INCLUDE_DIR - Include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Include dir
find_path(GLM_INCLUDE_DIR
NAMES glm/glm.hpp)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLM DEFAULT_MSG
GLM_INCLUDE_DIR)
mark_as_advanced(FORCE GLM_INCLUDE_DIR)
if(NOT TARGET GLM::GLM)
add_library(GLM::GLM INTERFACE IMPORTED)
set_target_properties(GLM::GLM PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GLM_INCLUDE_DIR})
endif()
+233
View File
@@ -0,0 +1,233 @@
#.rst:
# Find ImGui
# -------------
#
# Finds the ImGui library. This module defines:
#
# ImGui_FOUND - True if ImGui is found
# ImGui::ImGui - ImGui interface target
# ImGui::Sources - ImGui source target for core functionality
# ImGui::SourcesMiscCpp - ImGui source target for misc/cpp
#
# Additionally these variables are defined for internal usage:
#
# ImGui_INCLUDE_DIR - Include dir
#
# The find module first tries to find ``imgui`` via a CMake config file (which
# is distributed this way via Vcpkg, for example). If that's found, the
# ``ImGui::ImGui`` target is an alias to it and the ``ImGui::Sources`` target
# is empty except for having ``ImGui::ImGui`` as a dependency.
#
# If ``imgui`` is not found, as a fallback it tries to find the C++ sources.
# You can supply their location via an ``IMGUI_DIR`` variable. Once found, the
# ``ImGui::ImGui`` target contains just the header file, while
# ``ImGui::Sources`` contains the source files in ``INTERFACE_SOURCES``.
#
# The ``ImGui::SourcesMiscCpp`` component, if requested, is always searched for
# in the form of C++ sources. Vcpkg doesn't distribute these.
#
# The desired usage that covers both cases is to link ``ImGui::Sources``
# ``PRIVATE``\ ly to a *single* target, which will then contain either the
# sources or be linked to the imgui library from Vcpkg; and linking
# ``ImGui::ImGui`` to this target ``PUBLIC``\ ly.
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2018 Jonathan Hale <squareys@googlemail.com>
# Copyright © 2020 Tracy Ma <1991md@gmail.com>
# Copyright © 2024 Pablo Escobar <mail@rvrs.in>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# In 1.71 ImGui depends on the ApplicationServices framework for macOS
# clipboard support. Since 1.72 the dependency is optional and used only if
# IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS is enabled, but link to it
# always to be nice to users.
if(CORRADE_TARGET_APPLE)
find_library(_IMGUI_ApplicationServices_LIBRARY ApplicationServices)
mark_as_advanced(_IMGUI_ApplicationServices_LIBRARY)
set(_IMGUI_EXTRA_LIBRARIES ${_IMGUI_ApplicationServices_LIBRARY})
# Since 1.82, ImGui on MinGW needs the imm32 library. For MSVC the library
# seems to be linked implicitly so this is not needed.
elseif(CORRADE_TARGET_WINDOWS AND CORRADE_TARGET_MINGW)
set(_IMGUI_EXTRA_LIBRARIES imm32)
endif()
# Vcpkg distributes imgui as a library with a config file, so try that first --
# but only if IMGUI_DIR wasn't explicitly passed, in which case we'll look
# there instead
if(NOT IMGUI_DIR AND NOT TARGET imgui::imgui)
find_package(imgui CONFIG QUIET)
endif()
if(NOT IMGUI_DIR AND TARGET imgui::imgui)
if(NOT TARGET ImGui::ImGui)
add_library(ImGui::ImGui INTERFACE IMPORTED)
set_property(TARGET ImGui::ImGui APPEND PROPERTY
INTERFACE_LINK_LIBRARIES imgui::imgui ${_IMGUI_EXTRA_LIBRARIES})
# Retrieve include directory for FindPackageHandleStandardArgs later
get_target_property(ImGui_INCLUDE_DIR imgui::imgui
INTERFACE_INCLUDE_DIRECTORIES)
add_library(ImGui::Sources INTERFACE IMPORTED)
set_property(TARGET ImGui::Sources APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ImGui::ImGui)
# Vcpkg also always builds imgui as static, to "fix" users that don't
# properly define IMGUI_API on Windows to dllimport the symbols. Magnum
# implicitly assumes that ImGui is dynamic if ImGuiIntegration is
# dynamic, so here we need to define IMGUI_API to empty if it's static
# to not have the library try to dllimport the symbols.
get_target_property(ImGui_LIBRARY_TYPE imgui::imgui TYPE)
if(ImGui_LIBRARY_TYPE STREQUAL STATIC_LIBRARY)
set_property(TARGET ImGui::ImGui APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "IMGUI_API=")
elseif(ImGui_LIBRARY_TYPE STREQUAL SHARED_LIBRARY)
# Not doing anything if imgui is dynamic, as that's handled by the
# implicit behavior (i.e., with vcpkg's default shared build both
# ImGui and ImGuiIntegration integration would be dynamic).
# Moreover, vcpkg seems to hardcode imgui to be static always, so
# this should be never taken. Unless someone else creates its own
# ImGui CMake config that excercises this other scenario, which is
# (I think) rather unlikely.
endif()
endif()
# Otherwise find the source files and compile them as part of the library they
# get linked to
else()
# Disable the find root path here, it overrides the
# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE setting potentially set in
# toolchains.
find_path(ImGui_INCLUDE_DIR NAMES imgui.h
HINTS ${IMGUI_DIR}
PATH_SUFFIXES MagnumExternal/ImGui
NO_CMAKE_FIND_ROOT_PATH)
mark_as_advanced(ImGui_INCLUDE_DIR)
if(NOT TARGET ImGui::ImGui)
add_library(ImGui::ImGui INTERFACE IMPORTED)
set_property(TARGET ImGui::ImGui APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${ImGui_INCLUDE_DIR})
if(_IMGUI_EXTRA_LIBRARIES)
set_property(TARGET ImGui::ImGui APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${_IMGUI_EXTRA_LIBRARIES})
endif()
# Handle export and import of imgui symbols via IMGUI_API definition
# in visibility.h of Magnum ImGuiIntegration.
set_property(TARGET ImGui::ImGui APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS
"IMGUI_USER_CONFIG=\"Magnum/ImGuiIntegration/visibility.h\"")
endif()
endif()
macro(_imgui_setup_source_file source_var)
# Handle export and import of imgui symbols via IMGUI_API
# definition in visibility.h of Magnum ImGuiIntegration.
set_property(SOURCE ${${source_var}} APPEND PROPERTY COMPILE_DEFINITIONS
"IMGUI_USER_CONFIG=\"Magnum/ImGuiIntegration/visibility.h\"")
# Hide warnings from imgui source files
# GCC- and Clang-specific flags
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang"
AND NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") OR CORRADE_TARGET_EMSCRIPTEN)
set_property(SOURCE ${${source_var}} APPEND_STRING PROPERTY COMPILE_FLAGS
" -Wno-old-style-cast")
endif()
# GCC-specific flags
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_property(SOURCE ${${source_var}} APPEND_STRING PROPERTY COMPILE_FLAGS
" -Wno-double-promotion -Wno-zero-as-null-pointer-constant")
endif()
mark_as_advanced(${source_var})
endmacro()
# Find components
foreach(_component IN LISTS ImGui_FIND_COMPONENTS)
if(_component STREQUAL "Sources")
if(NOT TARGET ImGui::Sources)
set(ImGui_Sources_FOUND TRUE)
set(ImGui_SOURCES )
foreach(_file imgui imgui_widgets imgui_draw imgui_demo imgui_tables)
# Disable the find root path here, it overrides the
# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE setting potentially set in
# toolchains.
find_file(ImGui_${_file}_SOURCE NAMES ${_file}.cpp
HINTS ${IMGUI_DIR} NO_CMAKE_FIND_ROOT_PATH)
if(NOT ImGui_${_file}_SOURCE)
set(ImGui_Sources_FOUND FALSE)
break()
endif()
list(APPEND ImGui_SOURCES ${ImGui_${_file}_SOURCE})
_imgui_setup_source_file(ImGui_${_file}_SOURCE)
endforeach()
add_library(ImGui::Sources INTERFACE IMPORTED)
set_property(TARGET ImGui::Sources APPEND PROPERTY
INTERFACE_SOURCES "${ImGui_SOURCES}")
set_property(TARGET ImGui::Sources APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ImGui::ImGui)
else()
set(ImGui_Sources_FOUND TRUE)
endif()
elseif(_component STREQUAL "SourcesMiscCpp")
set(ImGui_SourcesMiscCpp_FOUND TRUE)
set(ImGui_MISC_CPP_SOURCES )
foreach(_file imgui_stdlib)
# Disable the find root path here, it overrides the
# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE setting potentially set in
# toolchains.
find_file(ImGui_${_file}_MISC_CPP_SOURCE NAMES ${_file}.cpp
HINTS ${IMGUI_DIR}/misc/cpp NO_CMAKE_FIND_ROOT_PATH)
list(APPEND ImGui_MISC_CPP_SOURCES ${ImGui_${_file}_MISC_CPP_SOURCE})
if(NOT ImGui_${_file}_MISC_CPP_SOURCE)
set(ImGui_SourcesMiscCpp_FOUND FALSE)
break()
endif()
_imgui_setup_source_file(ImGui_${_file}_MISC_CPP_SOURCE)
endforeach()
if(NOT TARGET ImGui::SourcesMiscCpp)
add_library(ImGui::SourcesMiscCpp INTERFACE IMPORTED)
set_property(TARGET ImGui::SourcesMiscCpp APPEND PROPERTY
INTERFACE_SOURCES "${ImGui_MISC_CPP_SOURCES}")
set_property(TARGET ImGui::SourcesMiscCpp APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ImGui::ImGui)
endif()
endif()
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ImGui
REQUIRED_VARS ImGui_INCLUDE_DIR HANDLE_COMPONENTS)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,353 @@
#.rst:
# Find Magnum extras
# ------------------
#
# Finds Magnum extras. Basic usage::
#
# find_package(MagnumExtras REQUIRED)
#
# This command tries to find Magnum extras and then defines the following:
#
# MagnumExtras_FOUND - Whether Magnum extras were found
#
# This command alone is useless without specifying the components:
#
# Ui - Ui library
# ui-gallery - magnum-ui-gallery executable
# player - magnum-player executable
#
# Example usage with specifying additional components is:
#
# find_package(MagnumExtras REQUIRED Ui)
#
# For each component is then defined:
#
# MagnumExtras_*_FOUND - Whether the component was found
# MagnumExtras::* - Component imported target
#
# The package is found if either debug or release version of each requested
# library is found. If both debug and release libraries are found, proper
# version is chosen based on actual build configuration of the project (i.e.
# Debug build is linked to debug libraries, Release build to release
# libraries).
#
# Additionally these variables are defined for internal usage:
#
# MAGNUMEXTRAS_INCLUDE_DIR - Magnum extras include dir (w/o
# dependencies)
# MAGNUMEXTRAS_*_LIBRARY_DEBUG - Debug version of given library, if found
# MAGNUMEXTRAS_*_LIBRARY_RELEASE - Release version of given library, if
# found
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Corrade library dependencies
set(_MAGNUMEXTRAS_CORRADE_DEPENDENCIES )
foreach(_component ${MagnumExtras_FIND_COMPONENTS})
list(APPEND _MAGNUMEXTRAS_CORRADE_DEPENDENCIES ${_MAGNUMEXTRAS_${_component}_CORRADE_DEPENDENCIES})
endforeach()
find_package(Corrade REQUIRED ${_MAGNUMEXTRAS_CORRADE_DEPENDENCIES})
# Magnum library dependencies
set(_MAGNUMEXTRAS_MAGNUM_DEPENDENCIES )
foreach(_component ${MagnumExtras_FIND_COMPONENTS})
if(_component STREQUAL Ui)
set(_MAGNUMEXTRAS_${_component}_MAGNUM_DEPENDENCIES Text GL Trade)
endif()
list(APPEND _MAGNUMEXTRAS_MAGNUM_DEPENDENCIES ${_MAGNUMEXTRAS_${_component}_MAGNUM_DEPENDENCIES})
endforeach()
find_package(Magnum REQUIRED ${_MAGNUMEXTRAS_MAGNUM_DEPENDENCIES})
# Global include dir that's unique to Magnum Extras. Often it will be installed
# alongside Magnum, which is why the hint, but if not, it shouldn't just pick
# MAGNUM_INCLUDE_DIR because then _MAGNUMEXTRAS_*_INCLUDE_DIR will fail to be
# found. In case of CMake subprojects the versionExtras.h is generated inside
# the build dir so this won't find it, instead src/CMakeLists.txt forcibly sets
# MAGNUMEXTRAS_INCLUDE_DIR as an internal cache value to make that work.
find_path(MAGNUMEXTRAS_INCLUDE_DIR Magnum/versionExtras.h
HINTS ${MAGNUM_INCLUDE_DIR})
mark_as_advanced(MAGNUMEXTRAS_INCLUDE_DIR)
# CMake module dir for dependencies. It might not be present at all if no
# feature that needs them is enabled, in which case it'll be left at NOTFOUND.
# But in that case it should also not be subsequently needed for any
# find_package(). If this is called from a superproject, the
# _MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR is already set by modules/CMakeLists.txt.
#
# There's no dependency Find modules so far. Once there are, uncomment this and
# list the modules in NAMES.
#find_path(_MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR
# NAMES
# PATH_SUFFIXES share/cmake/MagnumExtras/dependencies)
#mark_as_advanced(_MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR)
# If the module dir is found and is not present in CMAKE_MODULE_PATH already
# (such as when someone explicitly added it, or if it's the Magnum's modules/
# dir in case of a superproject), add it as the first before all other. Set a
# flag to remove it again at the end, so the modules don't clash with Find
# modules of the same name from other projects.
if(_MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR AND NOT _MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR IN_LIST CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH ${_MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR} ${CMAKE_MODULE_PATH})
set(_MAGNUMEXTRAS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH ON)
else()
unset(_MAGNUMEXTRAS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set(_MAGNUMEXTRAS_LIBRARY_COMPONENTS Ui)
set(_MAGNUMEXTRAS_EXECUTABLE_COMPONENTS player ui-gallery)
# Nothing is enabled by default right now
set(_MAGNUMEXTRAS_IMPLICITLY_ENABLED_COMPONENTS )
# Inter-component dependencies
set(_MAGNUMEXTRAS_ui-gallery_DEPENDENCIES Ui)
# Ensure that all inter-component dependencies are specified as well
set(_MAGNUMEXTRAS_ADDITIONAL_COMPONENTS )
foreach(_component ${MagnumExtras_FIND_COMPONENTS})
# Mark the dependencies as required if the component is also required
if(MagnumExtras_FIND_REQUIRED_${_component})
foreach(_dependency ${_MAGNUMEXTRAS_${_component}_DEPENDENCIES})
set(MagnumExtras_FIND_REQUIRED_${_dependency} TRUE)
endforeach()
endif()
list(APPEND _MAGNUMEXTRAS_ADDITIONAL_COMPONENTS ${_MAGNUMEXTRAS_${_component}_DEPENDENCIES})
endforeach()
# Join the lists, remove duplicate components
set(_MAGNUMEXTRAS_ORIGINAL_FIND_COMPONENTS ${MagnumExtras_FIND_COMPONENTS})
if(_MAGNUMEXTRAS_ADDITIONAL_COMPONENTS)
list(INSERT MagnumExtras_FIND_COMPONENTS 0 ${_MAGNUMEXTRAS_ADDITIONAL_COMPONENTS})
endif()
if(MagnumExtras_FIND_COMPONENTS)
list(REMOVE_DUPLICATES MagnumExtras_FIND_COMPONENTS)
endif()
# Additional components
foreach(_component ${MagnumExtras_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET "MagnumExtras::${_component}") # Quotes to "fix" KDE's higlighter
set(MagnumExtras_${_component}_FOUND TRUE)
else()
# Find library includes. Each has a configure.h file so there doesn't
# need to be any specialized per-library handling.
if(_component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS)
find_file(_MAGNUMEXTRAS_${_COMPONENT}_CONFIGURE_FILE configure.h
HINTS ${MAGNUMEXTRAS_INCLUDE_DIR}/Magnum/${_component})
mark_as_advanced(_MAGNUMEXTRAS_${_COMPONENT}_CONFIGURE_FILE)
endif()
# Library components
if(_component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS)
# Try to find both debug and release version
find_library(MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_DEBUG Magnum${_component}-d)
find_library(MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_RELEASE Magnum${_component})
mark_as_advanced(MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_DEBUG
MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_RELEASE)
# Determine if the library is static or dynamic by reading the
# per-library config file. If the file wasn't found, skip this so
# it fails on the FPHSA below and not right here.
if(_MAGNUMEXTRAS_${_COMPONENT}_CONFIGURE_FILE)
file(READ ${_MAGNUMEXTRAS_${_COMPONENT}_CONFIGURE_FILE} _magnumExtrasConfigure)
string(REGEX REPLACE ";" "\\\\;" _magnumExtrasConfigure "${_magnumExtrasConfigure}")
string(REGEX REPLACE "\n" ";" _magnumExtrasConfigure "${_magnumExtrasConfigure}")
list(FIND _magnumExtrasConfigure "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnumExtrasBuildStatic)
if(NOT _magnumExtrasBuildStatic EQUAL -1)
# The variable is inconsistently named between C++ and
# CMake, so keep it underscored / private
set(_MAGNUMEXTRAS_${_COMPONENT}_BUILD_STATIC ON)
endif()
endif()
# On Windows, if we have a dynamic build of given library, find the
# DLLs as well. Abuse find_program() since the DLLs should be
# alongside usual executables. On MinGW they however have a lib
# prefix.
if(CORRADE_TARGET_WINDOWS AND NOT _MAGNUMEXTRAS_${_COMPONENT}_BUILD_STATIC)
find_program(MAGNUMEXTRAS_${_COMPONENT}_DLL_DEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}-d.dll)
find_program(MAGNUMEXTRAS_${_COMPONENT}_DLL_RELEASE ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}.dll)
mark_as_advanced(MAGNUMEXTRAS_${_COMPONENT}_DLL_DEBUG
MAGNUMEXTRAS_${_COMPONENT}_DLL_RELEASE)
# If not on Windows or on a static build, unset the DLL variables
# to avoid leaks when switching shared and static builds
else()
unset(MAGNUMEXTRAS_${_COMPONENT}_DLL_DEBUG CACHE)
unset(MAGNUMEXTRAS_${_COMPONENT}_DLL_RELEASE CACHE)
endif()
# Executables
elseif(_component IN_LIST _MAGNUMEXTRAS_EXECUTABLE_COMPONENTS)
find_program(MAGNUMEXTRAS_${_COMPONENT}_EXECUTABLE magnum-${_component})
mark_as_advanced(MAGNUMEXTRAS_${_COMPONENT}_EXECUTABLE)
# Something unknown, skip. FPHSA will take care of handling this below.
else()
continue()
endif()
# Decide if the library was found. If not, skip the rest, which
# populates the target properties and finds additional dependencies.
# This means that the rest can also rely on that some FindXYZ.cmake is
# present in _MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR -- given that the
# library needing XYZ was found, it likely also installed FindXYZ for
# itself.
if(
# If the component is a library, it should have the configure file
(_component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS AND _MAGNUMEXTRAS_${_COMPONENT}_CONFIGURE_FILE AND (
# And it should have a debug library, and a DLL found if
# expected
(MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_DEBUG AND (
NOT DEFINED MAGNUMEXTRAS_${_COMPONENT}_DLL_DEBUG OR
MAGNUMEXTRAS_${_COMPONENT}_DLL_DEBUG)) OR
# Or have a release library, and a DLL found if expected
(MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_RELEASE AND (
NOT DEFINED MAGNUMEXTRAS_${_COMPONENT}_DLL_RELEASE OR
MAGNUMEXTRAS_${_COMPONENT}_DLL_RELEASE)))) OR
# If the component is an executable, it should have just the
# location
(_component IN_LIST _MAGNUMEXTRAS_EXECUTABLE_COMPONENTS AND MAGNUMEXTRAS_${_COMPONENT}_EXECUTABLE)
)
set(MagnumExtras_${_component}_FOUND TRUE)
else()
set(MagnumExtras_${_component}_FOUND FALSE)
continue()
endif()
# Target and location for libraries
if(_component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS)
if(_MAGNUMEXTRAS_${_COMPONENT}_BUILD_STATIC)
add_library(MagnumExtras::${_component} STATIC IMPORTED)
else()
add_library(MagnumExtras::${_component} SHARED IMPORTED)
endif()
foreach(_CONFIG DEBUG RELEASE)
if(NOT MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET MagnumExtras::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
# Unfortunately for a DLL the two properties are swapped out,
# *.lib goes to IMPLIB, so it's duplicated like this
if(DEFINED MAGNUMEXTRAS_${_COMPONENT}_DLL_${_CONFIG})
# Quotes to "fix" KDE's higlighter
set_target_properties("MagnumExtras::${_component}" PROPERTIES
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMEXTRAS_${_COMPONENT}_DLL_${_CONFIG}}
IMPORTED_IMPLIB_${_CONFIG} ${MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_${_CONFIG}})
else()
set_property(TARGET MagnumExtras::${_component} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMEXTRAS_${_COMPONENT}_LIBRARY_${_CONFIG}})
endif()
endforeach()
# Target and location for executable components
elseif(_component IN_LIST _MAGNUMEXTRAS_EXECUTABLE_COMPONENTS)
add_executable(MagnumExtras::${_component} IMPORTED)
set_property(TARGET MagnumExtras::${_component} PROPERTY
IMPORTED_LOCATION ${MAGNUMEXTRAS_${_COMPONENT}_EXECUTABLE})
endif()
# No special setup required for Ui library
if(_component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS)
# Link to core Magnum library, add inter-library dependencies
foreach(_dependency ${_MAGNUMEXTRAS_${_component}_CORRADE_DEPENDENCIES})
set_property(TARGET MagnumExtras::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::${_dependency})
endforeach()
set_property(TARGET MagnumExtras::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum)
foreach(_dependency ${_MAGNUMEXTRAS_${_component}_MAGNUM_DEPENDENCIES})
set_property(TARGET MagnumExtras::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::${_dependency})
endforeach()
# Add inter-project dependencies
foreach(_dependency ${_MAGNUMEXTRAS_${_component}_DEPENDENCIES})
set_property(TARGET MagnumExtras::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES MagnumExtras::${_dependency})
endforeach()
endif()
endif()
endforeach()
# For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially
# useful info about the failed components.
if(NOT CMAKE_VERSION VERSION_LESS 3.16)
set(_MAGNUMEXTRAS_REASON_FAILURE_MESSAGE )
# Go only through the originally specified find_package() components, not
# the dependencies added by us afterwards
foreach(_component ${_MAGNUMEXTRAS_ORIGINAL_FIND_COMPONENTS})
if(MagnumExtras_${_component}_FOUND)
continue()
endif()
# If it's not known at all, tell the user -- it might be a new library
# and an old Find module, or something platform-specific.
if(NOT _component IN_LIST _MAGNUMEXTRAS_LIBRARY_COMPONENTS AND NOT _component IN_LIST _MAGNUMEXTRAS_EXECUTABLE_COMPONENTS)
list(APPEND _MAGNUMEXTRAS_REASON_FAILURE_MESSAGE "${_component} is not a known component on this platform.")
# Otherwise, if it's not among implicitly built components, hint that
# the user may need to enable it
# TODO: currently, the _FOUND variable doesn't reflect if dependencies
# were found. When it will, this needs to be updated to avoid
# misleading messages.
elseif(NOT _component IN_LIST _MAGNUMEXTRAS_IMPLICITLY_ENABLED_COMPONENTS)
string(TOUPPER ${_component} _COMPONENT)
list(APPEND _MAGNUMEXTRAS_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum Extras.")
# Otherwise we have no idea. Better be silent than to print something
# misleading.
else()
endif()
endforeach()
string(REPLACE ";" " " _MAGNUMEXTRAS_REASON_FAILURE_MESSAGE "${_MAGNUMEXTRAS_REASON_FAILURE_MESSAGE}")
set(_MAGNUMEXTRAS_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_MAGNUMEXTRAS_REASON_FAILURE_MESSAGE}")
endif()
# Remove Magnum Extras dependency module dir from CMAKE_MODULE_PATH again. Do
# it before the FPHSA call which may exit early in case of a failure.
if(_MAGNUMEXTRAS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
list(REMOVE_ITEM CMAKE_MODULE_PATH ${_MAGNUMEXTRAS_DEPENDENCY_MODULE_DIR})
unset(_MAGNUMEXTRAS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MagnumExtras
REQUIRED_VARS MAGNUMEXTRAS_INCLUDE_DIR
HANDLE_COMPONENTS
${_MAGNUMEXTRAS_REASON_FAILURE_MESSAGE})
@@ -0,0 +1,456 @@
#.rst:
# Find Magnum integration library
# -------------------------------
#
# Finds the Magnum integration library. Basic usage::
#
# find_package(MagnumIntegration REQUIRED)
#
# This command tries to find Magnum integration library and then defines the
# following:
#
# MagnumIntegration_FOUND - Whether the library was found
#
# This command alone is useless without specifying the components:
#
# Bullet - Bullet Physics integration library
# Dart - Dart Physics integration library
# Eigen - Eigen integration library
# Glm - GLM integration library
# ImGui - ImGui integration library
# Ovr - Oculus SDK integration library
# Yoga - Yoga Layout integration library
#
# Example usage with specifying additional components is:
#
# find_package(MagnumIntegration REQUIRED Bullet)
#
# For each component is then defined:
#
# MagnumIntegration_*_FOUND - Whether the component was found
# MagnumIntegration::* - Component imported target
#
# The package is found if either debug or release version of each requested
# library is found. If both debug and release libraries are found, proper
# version is chosen based on actual build configuration of the project (i.e.
# Debug build is linked to debug libraries, Release build to release
# libraries).
#
# Additionally these variables are defined for internal usage:
#
# MAGNUMINTEGRATION_INCLUDE_DIR - Magnum integration include dir (w/o
# dependencies)
# MAGNUMINTEGRATION_*_LIBRARY_DEBUG - Debug version of given library, if found
# MAGNUMINTEGRATION_*_LIBRARY_RELEASE - Release version of given library, if
# found
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2018 Konstantinos Chatzilygeroudis <costashatz@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Magnum library dependencies
set(_MAGNUMINTEGRATION_MAGNUM_DEPENDENCIES )
set(_MAGNUMINTEGRATION_MAGNUMEXTRAS_DEPENDENCIES )
foreach(_component ${MagnumIntegration_FIND_COMPONENTS})
if(_component STREQUAL Bullet)
set(_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES SceneGraph Shaders GL)
elseif(_component STREQUAL Dart)
set(_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES SceneGraph Primitives MeshTools GL)
elseif(_component STREQUAL ImGui)
set(_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES GL Shaders)
elseif(_component STREQUAL Yoga)
set(_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES GL Shaders)
set(_MAGNUMINTEGRATION_${_component}_MAGNUMEXTRAS_DEPENDENCIES Ui)
endif()
list(APPEND _MAGNUMINTEGRATION_MAGNUM_DEPENDENCIES ${_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES})
list(APPEND _MAGNUMINTEGRATION_MAGNUMEXTRAS_DEPENDENCIES ${_MAGNUMINTEGRATION_${_component}_MAGNUMEXTRAS_DEPENDENCIES})
endforeach()
find_package(Magnum REQUIRED ${_MAGNUMINTEGRATION_MAGNUM_DEPENDENCIES})
if(_MAGNUMINTEGRATION_MAGNUMEXTRAS_DEPENDENCIES)
find_package(MagnumExtras REQUIRED ${_MAGNUMINTEGRATION_MAGNUMEXTRAS_DEPENDENCIES})
endif()
# Global include dir that's unique to Magnum Integration. Often it will be
# installed alongside Magnum, which is why the hint, but if not, it shouldn't
# just pick MAGNUM_INCLUDE_DIR because then _MAGNUMINTEGRATION_*_INCLUDE_DIR
# will fail to be found. In case of CMake subprojects the versionIntegration.h
# is generated inside the build dir so this won't find it, instead
# src/CMakeLists.txt forcibly sets MAGNUMINTEGRATION_INCLUDE_DIR as an internal
# cache value to make that work.
find_path(MAGNUMINTEGRATION_INCLUDE_DIR Magnum/versionIntegration.h
HINTS ${MAGNUM_INCLUDE_DIR})
mark_as_advanced(MAGNUMINTEGRATION_INCLUDE_DIR)
# CMake module dir for dependencies. It might not be present at all if no
# feature that needs them is enabled, in which case it'll be left at NOTFOUND.
# But in that case it should also not be subsequently needed for any
# find_package(). If this is called from a superproject, the
# _MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR is already set by
# modules/CMakeLists.txt.
find_path(_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR
NAMES
FindBullet.cmake FindGLM.cmake FindImGui.cmake FindOVR.cmake
PATH_SUFFIXES share/cmake/MagnumIntegration/dependencies)
mark_as_advanced(_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR)
# If the module dir is found and is not present in CMAKE_MODULE_PATH already
# (such as when someone explicitly added it, or if it's the Magnum's modules/
# dir in case of a superproject), add it as the first before all other. Set a
# flag to remove it again at the end, so the modules don't clash with Find
# modules of the same name from other projects.
if(_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR AND NOT _MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR IN_LIST CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH ${_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR} ${CMAKE_MODULE_PATH})
set(_MAGNUMINTEGRATION_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH ON)
else()
unset(_MAGNUMINTEGRATION_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set(_MAGNUMINTEGRATION_LIBRARY_COMPONENTS Bullet Dart Eigen ImGui Glm Yoga)
if(CORRADE_TARGET_WINDOWS)
list(APPEND _MAGNUMINTEGRATION_LIBRARY_COMPONENTS Ovr)
endif()
set(_MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS Eigen)
# Nothing is enabled by default right now
set(_MAGNUMINTEGRATION_IMPLICITLY_ENABLED_COMPONENTS )
# Inter-component dependencies (none yet)
# set(_MAGNUMINTEGRATION_Component_DEPENDENCIES Dependency)
# Ensure that all inter-component dependencies are specified as well
set(_MAGNUMINTEGRATION_ADDITIONAL_COMPONENTS )
foreach(_component ${MagnumIntegration_FIND_COMPONENTS})
# Mark the dependencies as required if the component is also required
if(MagnumIntegration_FIND_REQUIRED_${_component})
foreach(_dependency ${_MAGNUMINTEGRATION_${_component}_DEPENDENCIES})
set(MagnumIntegration_FIND_REQUIRED_${_dependency} TRUE)
endforeach()
endif()
list(APPEND _MAGNUMINTEGRATION_ADDITIONAL_COMPONENTS ${_MAGNUMINTEGRATION_${_component}_DEPENDENCIES})
endforeach()
# Join the lists, remove duplicate components
set(_MAGNUMINTEGRATION_ORIGINAL_FIND_COMPONENTS ${MagnumIntegration_FIND_COMPONENTS})
if(_MAGNUMINTEGRATION_ADDITIONAL_COMPONENTS)
list(INSERT MagnumIntegration_FIND_COMPONENTS 0 ${_MAGNUMINTEGRATION_ADDITIONAL_COMPONENTS})
endif()
if(MagnumIntegration_FIND_COMPONENTS)
list(REMOVE_DUPLICATES MagnumIntegration_FIND_COMPONENTS)
endif()
# Special cases of include paths for header-only libraries. Libraries not
# listed here have a path suffix and include name derived from the library name
# in the loop below. Non-header-only libraries have a configure.h file.
set(_MAGNUMINTEGRATION_EIGEN_INCLUDE_PATH_NAMES GeometryIntegration.h)
# Find all components
foreach(_component ${MagnumIntegration_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET "MagnumIntegration::${_component}") # Quotes to fix KDE's hiliter
set(MagnumIntegration_${_component}_FOUND TRUE)
else()
# Find library include dir for header-only libraries
if(_component IN_LIST _MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS)
# Include path names to find, unless specified above
if(NOT _MAGNUMINTEGRATION_${_COMPONENT}_INCLUDE_PATH_NAMES)
set(_MAGNUMINTEGRATION_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}Integration.h)
endif()
find_path(_MAGNUMINTEGRATION_${_COMPONENT}_INCLUDE_DIR
NAMES ${_MAGNUMINTEGRATION_${_COMPONENT}_INCLUDE_PATH_NAMES}
HINTS ${MAGNUMINTEGRATION_INCLUDE_DIR}/Magnum/${_component}Integration)
mark_as_advanced(_MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE)
# Non-header-only libraries have a configure file which we need to
# subsequently read, so find that one directly
elseif(_component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS)
find_file(_MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE configure.h
HINTS ${MAGNUMINTEGRATION_INCLUDE_DIR}/Magnum/${_component}Integration)
mark_as_advanced(_MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE)
endif()
# Library components
if(_component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS AND NOT _component IN_LIST _MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS)
# Try to find both debug and release version
find_library(MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_DEBUG Magnum${_component}Integration-d)
find_library(MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_RELEASE Magnum${_component}Integration)
mark_as_advanced(MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_DEBUG
MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_RELEASE)
# Determine if the library is static or dynamic by reading the
# per-library config file. If the file wasn't found, skip this so
# it fails on the FPHSA below and not right here.
if(_MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE)
file(READ ${_MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE} _magnumIntegrationConfigure)
string(REGEX REPLACE ";" "\\\\;" _magnumIntegrationConfigure "${_magnumIntegrationConfigure}")
string(REGEX REPLACE "\n" ";" _magnumIntegrationConfigure "${_magnumIntegrationConfigure}")
list(FIND _magnumIntegrationConfigure "#define MAGNUM_${_COMPONENT}INTEGRATION_BUILD_STATIC" _magnumIntegrationBuildStatic)
if(NOT _magnumIntegrationBuildStatic EQUAL -1)
# The variable is inconsistently named between C++ and
# CMake, so keep it underscored / private
set(_MAGNUMINTEGRATION_${_COMPONENT}_BUILD_STATIC ON)
endif()
endif()
# On Windows, if we have a dynamic build of given library, find the
# DLLs as well. Abuse find_program() since the DLLs should be
# alongside usual executables. On MinGW they however have a lib
# prefix.
if(CORRADE_TARGET_WINDOWS AND NOT _MAGNUMINTEGRATION_${_COMPONENT}_BUILD_STATIC)
find_program(MAGNUMINTEGRATION_${_COMPONENT}_DLL_DEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}Integration-d.dll)
find_program(MAGNUMINTEGRATION_${_COMPONENT}_DLL_RELEASE ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}Integration.dll)
mark_as_advanced(MAGNUMINTEGRATION_${_COMPONENT}_DLL_DEBUG
MAGNUMINTEGRATION_${_COMPONENT}_DLL_RELEASE)
# If not on Windows or on a static build, unset the DLL variables
# to avoid leaks when switching shared and static builds
else()
unset(MAGNUMINTEGRATION_${_COMPONENT}_DLL_DEBUG CACHE)
unset(MAGNUMINTEGRATION_${_COMPONENT}_DLL_RELEASE CACHE)
endif()
# If not a header-only component it's something unknown, skip. FPHSA
# will take care of handling this below.
elseif(NOT _component IN_LIST _MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS)
continue()
endif()
# Decide if the library was found. If not, skip the rest, which
# populates the target properties and finds additional dependencies.
# This means that the rest can also rely on that e.g. FindGLM.cmake is
# present in _MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR -- given that the
# library needing GLM was found, it likely also installed FindGLM for
# itself.
if(
# If the component is a header-only library it should have an
# include dir
(_component IN_LIST _MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS AND _MAGNUMINTEGRATION_${_COMPONENT}_INCLUDE_DIR) OR
# Or, if it's a real library, it should have a configure file
(_component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS AND _MAGNUMINTEGRATION_${_COMPONENT}_CONFIGURE_FILE AND (
# Or have a debug library, and a DLL found if expected
(MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_DEBUG AND (
NOT DEFINED MAGNUMINTEGRATION_${_COMPONENT}_DLL_DEBUG OR
MAGNUMINTEGRATION_${_COMPONENT}_DLL_DEBUG)) OR
# Or have a release library, and a DLL found if expected
(MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_RELEASE AND (
NOT DEFINED MAGNUMINTEGRATION_${_COMPONENT}_DLL_RELEASE OR
MAGNUMINTEGRATION_${_COMPONENT}_DLL_RELEASE))))
)
set(MagnumIntegration_${_component}_FOUND TRUE)
else()
set(MagnumIntegration_${_component}_FOUND FALSE)
continue()
endif()
# Target for header-only library components
if(_component IN_LIST _MAGNUMINTEGRATION_HEADER_ONLY_COMPONENTS)
add_library(MagnumIntegration::${_component} INTERFACE IMPORTED)
# Target and location for libraries
elseif(_component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS)
if(_MAGNUMINTEGRATION_${_COMPONENT}_BUILD_STATIC)
add_library(MagnumIntegration::${_component} STATIC IMPORTED)
else()
add_library(MagnumIntegration::${_component} SHARED IMPORTED)
endif()
foreach(_CONFIG DEBUG RELEASE)
if(NOT MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
# Unfortunately for a DLL the two properties are swapped out,
# *.lib goes to IMPLIB, so it's duplicated like this
if(DEFINED MAGNUMINTEGRATION_${_COMPONENT}_DLL_${_CONFIG})
# Quotes to "fix" KDE's higlighter
set_target_properties("MagnumIntegration::${_component}" PROPERTIES
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMINTEGRATION_${_COMPONENT}_DLL_${_CONFIG}}
IMPORTED_IMPLIB_${_CONFIG} ${MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_${_CONFIG}})
else()
set_property(TARGET MagnumIntegration::${_component} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMINTEGRATION_${_COMPONENT}_LIBRARY_${_CONFIG}})
endif()
endforeach()
endif()
# Bullet integration library
if(_component STREQUAL Bullet)
# On Emscripten, Bullet could be taken from ports. If that's the
# case, propagate proper compiler flag.
if(CORRADE_TARGET_EMSCRIPTEN)
# The library-specific configure file was read above already
list(FIND _magnumIntegrationConfigure "#define MAGNUM_USE_EMSCRIPTEN_PORTS_BULLET" _magnum${_component}Integration_USE_EMSCRIPTEN_PORTS_BULLET)
if(NOT _magnum${_component}Integration_USE_EMSCRIPTEN_PORTS_BULLET EQUAL -1)
set(MAGNUM_USE_EMSCRIPTEN_PORTS_BULLET 1)
endif()
endif()
if(MAGNUM_USE_EMSCRIPTEN_PORTS_BULLET)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "${_component}Integration was compiled against an emscripten-ports version of Bullet but linking to it requires CMake 3.13 at least")
endif()
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_BULLET=1")
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_BULLET=1")
else()
find_package(Bullet)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Bullet::LinearMath)
endif()
# Eigen integration library
elseif(_component STREQUAL Eigen)
find_package(Eigen3)
# We could drop this once we can use at least 3.3.1 (Ubuntu 16.04
# has only 3.3 beta, which doesn't have this target yet), however
# for Travis and AppVeyor we're using FindEigen3.cmake from the
# downloaded sources (because the Eigen3Config.cmake, which
# produces the actual targets, is not there -- only
# Eigen3Config.cmake.in). See the YML files for an extended rant.
# Also, FindEigen3 only defines EIGEN3_INCLUDE_DIR, not even
# EIGEN3_INCLUDE_DIRS, so be extra careful.
# https://eigen.tuxfamily.org/index.php?title=ChangeLog#Eigen_3.3.1
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR})
# ImGui integration library
elseif(_component STREQUAL ImGui)
find_package(ImGui)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ImGui::ImGui)
# GLM integration library
elseif(_component STREQUAL Glm)
find_package(GLM)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES GLM::GLM)
# Dart integration library
elseif(_component STREQUAL Dart)
find_package(DART 6.0.0 CONFIG REQUIRED)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES dart)
# Oculus SDK integration library
elseif(_component STREQUAL Ovr)
find_package(OVR)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OVR::OVR)
# Yoga integration library
elseif(_component STREQUAL Yoga)
# Since 2.0.0 the project provides a CMake config file, force it.
# Before 2.0 it didn't even have an install target, so assume those
# versions just aren't used at all.
find_package(yoga CONFIG REQUIRED)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES yoga::yogacore)
endif()
if(_component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS)
# Link to core Magnum library, add other Magnum required and
# optional dependencies
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum)
foreach(_dependency ${_MAGNUMINTEGRATION_${_component}_MAGNUM_DEPENDENCIES})
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::${_dependency})
endforeach()
foreach(_dependency ${_MAGNUMINTEGRATION_${_component}_MAGNUMEXTRAS_DEPENDENCIES})
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES MagnumExtras::${_dependency})
endforeach()
foreach(_dependency ${_MAGNUMINTEGRATION_${_component}_MAGNUM_OPTIONAL_DEPENDENCIES})
if(Magnum_${_dependency}_FOUND)
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::${_dependency})
endif()
endforeach()
# Add inter-project dependencies
foreach(_dependency ${_MAGNUMINTEGRATION_${_component}_DEPENDENCIES})
set_property(TARGET MagnumIntegration::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES MagnumIntegration::${_dependency})
endforeach()
endif()
endif()
endforeach()
# For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially
# useful info about the failed components.
if(NOT CMAKE_VERSION VERSION_LESS 3.16)
set(_MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE )
# Go only through the originally specified find_package() components, not
# the dependencies added by us afterwards
foreach(_component ${_MAGNUMINTEGRATION_ORIGINAL_FIND_COMPONENTS})
if(MagnumIntegration_${_component}_FOUND)
continue()
endif()
# If it's not known at all, tell the user -- it might be a new library
# and an old Find module, or something platform-specific.
if(NOT _component IN_LIST _MAGNUMINTEGRATION_LIBRARY_COMPONENTS)
list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not a known component on this platform.")
# Otherwise, if it's not among implicitly built components, hint that
# the user may need to enable it
# TODO: currently, the _FOUND variable doesn't reflect if dependencies
# were found. When it will, this needs to be updated to avoid
# misleading messages.
elseif(NOT _component IN_LIST _MAGNUMINTEGRATION_IMPLICITLY_ENABLED_COMPONENTS)
string(TOUPPER ${_component} _COMPONENT)
list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT}INTEGRATION when building Magnum Integration.")
# Otherwise we have no idea. Better be silent than to print something
# misleading.
else()
endif()
endforeach()
string(REPLACE ";" " " _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE}")
set(_MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE}")
endif()
# Remove Magnum Integration dependency module dir from CMAKE_MODULE_PATH again.
# Do it before the FPHSA call which may exit early in case of a failure.
if(_MAGNUMINTEGRATION_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
list(REMOVE_ITEM CMAKE_MODULE_PATH ${_MAGNUMINTEGRATION_DEPENDENCY_MODULE_DIR})
unset(_MAGNUMINTEGRATION_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MagnumIntegration
REQUIRED_VARS MAGNUMINTEGRATION_INCLUDE_DIR
HANDLE_COMPONENTS
${_MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE})
@@ -0,0 +1,837 @@
#.rst:
# Find Magnum plugins
# -------------------
#
# Finds the Magnum plugins library. Basic usage::
#
# find_package(MagnumPlugins REQUIRED)
#
# This command tries to find Magnum plugins and then defines the following:
#
# MagnumPlugins_FOUND - Whether Magnum plugins were found
#
# This command will not try to find any actual plugin. The plugins are:
#
# AssimpImporter - Assimp importer
# AstcImporter - ASTC importer
# AvifImporter - AVIF importer
# BasisImageConverter - Basis image converter
# BasisImporter - Basis importer
# BcDecImageConverter - BCn image decoder using bcdec
# DdsImporter - DDS importer
# DevIlImageImporter - Image importer using DevIL
# DrFlacAudioImporter - FLAC audio importer using dr_flac
# DrMp3AudioImporter - MP3 audio importer using dr_mp3
# DrWavAudioImporter - WAV audio importer using dr_wav
# EtcDecImageConverter - ETC/EAC image decoder using etcdec
# Faad2AudioImporter - AAC audio importer using FAAD2
# FreeTypeFont - FreeType font
# GlslangShaderConverter - Glslang shader converter
# GltfImporter - glTF importer
# GltfSceneConverter - glTF converter
# HarfBuzzFont - HarfBuzz font
# IcoImporter - ICO importer
# JpegImageConverter - JPEG image converter
# JpegImporter - JPEG importer
# KtxImageConverter - KTX image converter
# KtxImporter - KTX importer
# LunaSvgImporter - SVG importer using LunaSVG
# MeshOptimizerSceneConverter - MeshOptimizer scene converter
# MiniExrImageConverter - OpenEXR image converter using miniexr
# OpenGexImporter - OpenGEX importer
# PlutoSvgImporter - SVG importer using PlutoSVG
# PngImageConverter - PNG image converter
# PngImporter - PNG importer
# PrimitiveImporter - Primitive importer
# ResvgImporter - SVG importer using resvg
# SpirvToolsShaderConverter - SPIR-V Tools shader converter
# SpngImporter - PNG importer using libspng
# StanfordImporter - Stanford PLY importer
# StanfordSceneConverter - Stanford PLY converter
# StbDxtImageConverter - BC1/BC3 image compressor using stb_dxt
# StbImageConverter - Image converter using stb_image_write
# StbImageImporter - Image importer using stb_image
# StbResizeImageConverter - Image resizing using stb_image_resize
# StbTrueTypeFont - TrueType font using stb_truetype
# StbVorbisAudioImporter - OGG audio importer using stb_vorbis
# StlImporter - STL importer
# UfbxImporter - FBX and OBJ importer using ufbx
# WebPImageConverter - WebP image converter
# WebPImporter - WebP importer
#
# If Magnum is built with MAGNUM_BUILD_DEPRECATED enabled, these additional
# plugins are available for backwards compatibility purposes:
#
# CgltfImporter - glTF importer using cgltf
# TinyGltfImporter - GLTF importer using tiny_gltf
#
# Some plugins expose their internal state through separate libraries. The
# libraries are:
#
# OpenDdl - OpenDDL parser, used as a base for the
# OpenGexImporter plugin
#
# Example usage with specifying the plugins is::
#
# find_package(MagnumPlugins REQUIRED FreeTypeFont PngImporter)
#
# For each plugin is then defined:
#
# MagnumPlugins_*_FOUND - Whether the plugin was found
# MagnumPlugins::* - Plugin imported target
#
# The package is found if either debug or release version of each requested
# plugin is found. If both debug and release plugins are found, proper version
# is chosen based on actual build configuration of the project (i.e. ``Debug``
# build is linked to debug plugins, ``Release`` build to release plugins). See
# ``FindMagnum.cmake`` for more information about autodetection of
# ``MAGNUM_PLUGINS_DIR``.
#
# Additionally these variables are defined for internal usage:
#
# MAGNUMPLUGINS_INCLUDE_DIR - Magnum plugins include dir (w/o dependencies)
# MAGNUMPLUGINS_*_LIBRARY - Plugin library (w/o dependencies)
# MAGNUMPLUGINS_*_LIBRARY_DEBUG - Debug version of given library, if found
# MAGNUMPLUGINS_*_LIBRARY_RELEASE - Release version of given library, if found
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2019 Jonathan Hale <squareys@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Magnum library dependencies
set(_MAGNUMPLUGINS_DEPENDENCIES )
foreach(_component ${MagnumPlugins_FIND_COMPONENTS})
if(_component MATCHES ".+AudioImporter$")
set(_MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES Audio)
elseif(_component MATCHES ".+(Importer|ImageConverter|SceneConverter)")
set(_MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES Trade)
elseif(_component MATCHES ".+(Font|FontConverter)$")
set(_MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES Text)
endif()
if(_component STREQUAL AssimpImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
elseif(_component STREQUAL CgltfImporter)
# TODO remove when the deprecated plugin is gone
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
elseif(_component STREQUAL GltfImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
elseif(_component STREQUAL MeshOptimizerSceneConverter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES MeshTools)
elseif(_component STREQUAL OpenGexImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
elseif(_component STREQUAL PrimitiveImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES Primitives)
elseif(_component STREQUAL StanfordImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES MeshTools)
elseif(_component STREQUAL StanfordSceneConverter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES MeshTools)
elseif(_component STREQUAL UfbxImporter)
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
elseif(_component STREQUAL TinyGltfImporter)
# TODO remove when the deprecated plugin is gone
list(APPEND _MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES AnyImageImporter)
endif()
list(APPEND _MAGNUMPLUGINS_DEPENDENCIES ${_MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES})
endforeach()
find_package(Magnum REQUIRED ${_MAGNUMPLUGINS_DEPENDENCIES})
# Global include dir that's unique to Magnum Plugins. Often they will be
# installed alongside Magnum, which is why the hint, but if not, it shouldn't
# just pick MAGNUM_INCLUDE_DIR because then _MAGNUMPLUGINS_*_INCLUDE_DIR will
# fail to be found. In case of CMake subprojects the versionPlugins.h is
# generated inside the build dir so this won't find it, instead
# src/CMakeLists.txt forcibly sets MAGNUMPLUGINS_INCLUDE_DIR as an internal
# cache value to make that work.
find_path(MAGNUMPLUGINS_INCLUDE_DIR Magnum/versionPlugins.h
HINTS ${MAGNUM_INCLUDE_DIR})
mark_as_advanced(MAGNUMPLUGINS_INCLUDE_DIR)
# CMake module dir for dependencies. It might not be present at all if no
# feature that needs them is enabled, in which case it'll be left at NOTFOUND.
# But in that case it should also not be subsequently needed for any
# find_package(). If this is called from a superproject, the
# _MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR is already set by
# modules/CMakeLists.txt.
find_path(_MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR
NAMES
FindAssimp.cmake FindBasisUniversal.cmake FindDevIL.cmake
FindFAAD2.cmake FindGlslang.cmake FindHarfBuzz.cmake
FindOpenEXR.cmake FindResvg.cmake FindSpirvTools.cmake FindSpng.cmake
FindWebP.cmake FindZstd.cmake
PATH_SUFFIXES share/cmake/MagnumPlugins/dependencies)
mark_as_advanced(_MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR)
# If the module dir is found and is not present in CMAKE_MODULE_PATH already
# (such as when someone explicitly added it, or if it's the Magnum's modules/
# dir in case of a superproject), add it as the first before all other. Set a
# flag to remove it again at the end, so the modules don't clash with Find
# modules of the same name from other projects.
if(_MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR AND NOT _MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR IN_LIST CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH ${_MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR} ${CMAKE_MODULE_PATH})
set(_MAGNUMPLUGINS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH ON)
else()
unset(_MAGNUMPLUGINS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set(_MAGNUMPLUGINS_LIBRARY_COMPONENTS OpenDdl)
set(_MAGNUMPLUGINS_PLUGIN_COMPONENTS
AssimpImporter AstcImporter AvifImporter BasisImageConverter BasisImporter
BcDecImageConverter DdsImporter DevIlImageImporter DrFlacAudioImporter
DrMp3AudioImporter DrWavAudioImporter EtcDecImageConverter
Faad2AudioImporter FreeTypeFont GlslangShaderConverter GltfImporter
GltfSceneConverter HarfBuzzFont IcoImporter JpegImageConverter JpegImporter
KtxImageConverter KtxImporter LunaSvgImporter MeshOptimizerSceneConverter
MiniExrImageConverter OpenExrImageConverter OpenExrImporter
OpenGexImporter PlutoSvgImporter PngImageConverter PngImporter
PrimitiveImporter ResvgImporter SpirvToolsShaderConverter SpngImporter
StanfordImporter StanfordSceneConverter StbDxtImageConverter
StbImageConverter StbImageImporter StbResizeImageConverter StbTrueTypeFont
StbVorbisAudioImporter StlImporter UfbxImporter WebPImageConverter
WebPImporter)
# Nothing is enabled by default right now
set(_MAGNUMPLUGINS_IMPLICITLY_ENABLED_COMPONENTS )
# Inter-component dependencies
set(_MAGNUMPLUGINS_HarfBuzzFont_DEPENDENCIES FreeTypeFont)
set(_MAGNUMPLUGINS_OpenGexImporter_DEPENDENCIES OpenDdl)
# CgltfImporter and TinyGltfImporter, available only on a deprecated build
if(MAGNUM_BUILD_DEPRECATED)
list(APPEND _MAGNUMPLUGINS_PLUGIN_COMPONENTS CgltfImporter TinyGltfImporter)
set(_MAGNUMPLUGINS_CgltfImporter_DEPENDENCIES GltfImporter)
endif()
# Ensure that all inter-component dependencies are specified as well
set(_MAGNUMPLUGINS_ADDITIONAL_COMPONENTS )
foreach(_component ${MagnumPlugins_FIND_COMPONENTS})
# Mark the dependencies as required if the component is also required
if(MagnumPlugins_FIND_REQUIRED_${_component})
foreach(_dependency ${_MAGNUMPLUGINS_${_component}_DEPENDENCIES})
set(MagnumPlugins_FIND_REQUIRED_${_dependency} TRUE)
endforeach()
endif()
list(APPEND _MAGNUMPLUGINS_ADDITIONAL_COMPONENTS ${_MAGNUMPLUGINS_${_component}_DEPENDENCIES})
endforeach()
# Join the lists, remove duplicate components
set(_MAGNUMPLUGINS_ORIGINAL_FIND_COMPONENTS ${MagnumPlugins_FIND_COMPONENTS})
if(_MAGNUMPLUGINS_ADDITIONAL_COMPONENTS)
list(INSERT MagnumPlugins_FIND_COMPONENTS 0 ${_MAGNUMPLUGINS_ADDITIONAL_COMPONENTS})
endif()
if(MagnumPlugins_FIND_COMPONENTS)
list(REMOVE_DUPLICATES MagnumPlugins_FIND_COMPONENTS)
endif()
# Special cases of include paths. Libraries not listed here have a path suffix
# and include name derived from the library name in the loop below. (So far no
# special cases.)
# Find all components
foreach(_component ${MagnumPlugins_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET "MagnumPlugins::${_component}") # Quotes to fix KDE's higlighter
set(MagnumPlugins_${_component}_FOUND TRUE)
else()
# Find plugin/library includes. Each has a configure.h file so there
# doesn't need to be any specialized per-library handling.
if(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS OR _component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS)
if(_component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS)
set(_include_path_directory Magnum)
else()
set(_include_path_directory MagnumPlugins)
endif()
find_file(_MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE configure.h
HINTS ${MAGNUMPLUGINS_INCLUDE_DIR}/${_include_path_directory}/${_component})
mark_as_advanced(_MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE)
# Determine if the plugin/library is static or dynamic by reading
# the per-library config file. Plugins use this for automatic
# import if static, libraries for finding a DLL location if shared.
# If the file wasn't found, skip this so it fails on the FPHSA
# below and not right here.
if(_MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE)
file(READ ${_MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE} _magnumPluginsConfigure)
string(REGEX REPLACE ";" "\\\\;" _magnumPluginsConfigure "${_magnumPluginsConfigure}")
string(REGEX REPLACE "\n" ";" _magnumPluginsConfigure "${_magnumPluginsConfigure}")
list(FIND _magnumPluginsConfigure "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnumPluginsBuildStatic)
if(NOT _magnumPluginsBuildStatic EQUAL -1)
# The variable is inconsistently named between C++ and
# CMake, so keep it underscored / private
set(_MAGNUMPLUGINS_${_COMPONENT}_BUILD_STATIC ON)
endif()
endif()
endif()
# Library components
if(_component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS)
# Try to find both debug and release version
find_library(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG Magnum${_component}-d)
find_library(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_RELEASE Magnum${_component})
mark_as_advanced(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG
MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_RELEASE)
# On Windows, if we have a dynamic build of given library, find the
# DLLs as well. Abuse find_program() since the DLLs should be
# alongside usual executables. On MinGW they however have a lib
# prefix.
if(CORRADE_TARGET_WINDOWS AND NOT _MAGNUMPLUGINS_${_COMPONENT}_BUILD_STATIC)
find_program(MAGNUMPLUGINS_${_COMPONENT}_DLL_DEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}-d.dll)
find_program(MAGNUMPLUGINS_${_COMPONENT}_DLL_RELEASE ${CMAKE_SHARED_LIBRARY_PREFIX}Magnum${_component}.dll)
mark_as_advanced(MAGNUMPLUGINS_${_COMPONENT}_DLL_DEBUG
MAGNUMPLUGINS_${_COMPONENT}_DLL_RELEASE)
# If not on Windows or on a static build, unset the DLL variables
# to avoid leaks when switching shared and static builds
else()
unset(MAGNUMPLUGINS_${_COMPONENT}_DLL_DEBUG CACHE)
unset(MAGNUMPLUGINS_${_COMPONENT}_DLL_RELEASE CACHE)
endif()
# Plugin components
elseif(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS)
# AudioImporter plugin specific name suffixes
if(_component MATCHES ".+AudioImporter$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX audioimporters)
# Importer plugin specific name suffixes
elseif(_component MATCHES ".+Importer$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX importers)
# Font plugin specific name suffixes
elseif(_component MATCHES ".+Font$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX fonts)
# ImageConverter plugin specific name suffixes
elseif(_component MATCHES ".+ImageConverter$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX imageconverters)
# SceneConverter plugin specific name suffixes
elseif(_component MATCHES ".+SceneConverter$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX sceneconverters)
# FontConverter plugin specific name suffixes
elseif(_component MATCHES ".+FontConverter$")
set(_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX fontconverters)
endif()
# Dynamic plugins don't have any prefix (e.g. `lib` on Linux),
# search with empty prefix and then reset that back so we don't
# accidentally break something else
set(_tmp_prefixes "${CMAKE_FIND_LIBRARY_PREFIXES}")
set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};")
# Try to find both debug and release version. Dynamic and static
# debug libraries are in different places. Static debug plugins are
# in magnum/ with a -d suffix while dynamic debug plugins are in
# magnum-d/ with no suffix. Problem is that Vcpkg's library linking
# automagic needs the static libs to be in the root library
# directory along with everything else and so we need to search for
# the -d suffixed version *before* the unsuffixed so it doesn't
# pick the release library for both debug and release.
find_library(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG ${_component}-d
PATH_SUFFIXES magnum/${_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX})
find_library(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG ${_component}
PATH_SUFFIXES magnum-d/${_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX})
find_library(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_RELEASE ${_component}
PATH_SUFFIXES magnum/${_MAGNUMPLUGINS_${_COMPONENT}_PATH_SUFFIX})
mark_as_advanced(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG
MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_RELEASE)
# Reset back
set(CMAKE_FIND_LIBRARY_PREFIXES "${_tmp_prefixes}")
# Something unknown, skip. FPHSA will take care of handling this below.
else()
continue()
endif()
# Decide if the plugin/library was found. If not, skip the rest, which
# populates the target properties and finds additional dependencies.
# This means that the rest can also rely on that e.g. FindZstd.cmake is
# present in _MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR -- given that the
# library needing Zstd was found, it likely also installed FindZstd for
# itself.
if(
# If the component is a library or a plugin, it should have the
# configure file
(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS OR _component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS) AND _MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE AND (
# And it should have a debug library, and a DLL found if
# expected
(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_DEBUG AND (
NOT DEFINED MAGNUMPLUGINS_${_COMPONENT}_DLL_DEBUG OR
MAGNUMPLUGINS_${_COMPONENT}_DLL_DEBUG)) OR
# Or have a release library, and a DLL found if expected
(MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_RELEASE AND (
NOT DEFINED MAGNUMPLUGINS_${_COMPONENT}_DLL_RELEASE OR
MAGNUMPLUGINS_${_COMPONENT}_DLL_RELEASE)))
)
set(MagnumPlugins_${_component}_FOUND TRUE)
else()
set(MagnumPlugins_${_component}_FOUND FALSE)
continue()
endif()
# Target and location for libraries
if(_component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS)
if(_MAGNUMPLUGINS_${_COMPONENT}_BUILD_STATIC)
add_library(MagnumPlugins::${_component} STATIC IMPORTED)
else()
add_library(MagnumPlugins::${_component} SHARED IMPORTED)
endif()
foreach(_CONFIG DEBUG RELEASE)
if(NOT MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
# Unfortunately for a DLL the two properties are swapped out,
# *.lib goes to IMPLIB, so it's duplicated like this
if(DEFINED MAGNUMPLUGINS_${_COMPONENT}_DLL_${_CONFIG})
# Quotes to "fix" KDE's higlighter
set_target_properties("MagnumPlugins::${_component}" PROPERTIES
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMPLUGINS_${_COMPONENT}_DLL_${_CONFIG}}
IMPORTED_IMPLIB_${_CONFIG} ${MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_${_CONFIG}})
else()
set_property(TARGET MagnumPlugins::${_component} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_${_CONFIG}})
endif()
endforeach()
# Target and location for plugins. Not dealing with DLL locations for
# those.
elseif(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS)
add_library(MagnumPlugins::${_component} UNKNOWN IMPORTED)
foreach(_CONFIG DEBUG RELEASE)
if(NOT MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_${_CONFIG})
continue()
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS ${_CONFIG})
set_property(TARGET MagnumPlugins::${_component} PROPERTY
IMPORTED_LOCATION_${_CONFIG} ${MAGNUMPLUGINS_${_COMPONENT}_LIBRARY_${_CONFIG}})
endforeach()
endif()
# AssimpImporter plugin dependencies
if(_component STREQUAL AssimpImporter)
find_package(Assimp)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Assimp::Assimp)
# AstcImporter has no dependencies
# AvifImporter plugin dependencies
elseif(_component STREQUAL AvifImporter)
find_package(libavif CONFIG)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
# ffs, can't you fools namespace the target, at least?!
INTERFACE_LINK_LIBRARIES avif)
# BasisImageConverter / BasisImporter has only compiled-in
# dependencies, except in case of vcpkg, then we need to link to a
# library. Use a similar logic as in FindBasisUniversal, so in case an
# user wants to disable this, they can point BASIS_UNIVERSAL_DIR to
# something else (or just anything, because in that case it'll be a
# no-op.
elseif(_component STREQUAL BasisImageConverter)
find_package(basisu CONFIG QUIET)
if(basisu_FOUND AND NOT BASIS_UNIVERSAL_DIR)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES basisu_encoder)
else()
# Our own build may depend on Zstd, as we replace the bundled
# files with an external library. Include it if present,
# otherwise assume it's compiled without.
find_package(Zstd)
if(Zstd_FOUND)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Zstd::Zstd)
endif()
endif()
elseif(_component STREQUAL BasisImporter)
find_package(basisu CONFIG QUIET)
if(basisu_FOUND AND NOT BASIS_UNIVERSAL_DIR)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES basisu_transcoder)
else()
# Our own build may depend on Zstd, as we replace the bundled
# files with an external library. Include it if present,
# otherwise assume it's compiled without.
find_package(Zstd)
if(Zstd_FOUND)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Zstd::Zstd)
endif()
endif()
# BcDecImageConverter has no dependencies
# CgltfImporter has no dependencies
# DdsImporter has no dependencies
# DevIlImageImporter plugin dependencies
elseif(_component STREQUAL DevIlImageImporter)
find_package(DevIL)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${IL_LIBRARIES} ${ILU_LIBRARIES})
# DrFlacAudioImporter has no dependencies
# DrMp3AudioImporter has no dependencies
# DrWavAudioImporter has no dependencies
# EtcDecImageConverter has no dependencies
# Faad2AudioImporter plugin dependencies
elseif(_component STREQUAL Faad2AudioImporter)
find_package(FAAD2)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES FAAD2::FAAD2)
# FreeTypeFont plugin dependencies
elseif(_component STREQUAL FreeTypeFont)
# On Emscripten, FreeType could be taken from ports. If that's the
# case, propagate proper compiler flag.
if(CORRADE_TARGET_EMSCRIPTEN)
# The library-specific configure file was read above already
list(FIND _magnumPluginsConfigure "#define MAGNUM_USE_EMSCRIPTEN_PORTS_FREETYPE" _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_FREETYPE)
if(NOT _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_FREETYPE EQUAL -1)
set(MAGNUM_USE_EMSCRIPTEN_PORTS_FREETYPE 1)
endif()
endif()
if(MAGNUM_USE_EMSCRIPTEN_PORTS_FREETYPE)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "${_component} was compiled against emscripten-ports version of FreeType but linking to it requires CMake 3.13 at least")
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_FREETYPE=1")
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_FREETYPE=1")
else()
find_package(Freetype)
# Need to handle special cases where both debug and release
# libraries are available (in form of debug;A;optimized;B in
# FREETYPE_LIBRARIES), thus appending them one by one
# TODO use imported target when 3.10+ is the minimum
if(FREETYPE_LIBRARY_DEBUG AND FREETYPE_LIBRARY_RELEASE)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:Debug>>:${FREETYPE_LIBRARY_RELEASE}>;$<$<CONFIG:Debug>:${FREETYPE_LIBRARY_DEBUG}>")
else()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${FREETYPE_LIBRARIES})
endif()
endif()
# GlslangShaderConverter plugin dependencies
elseif(_component STREQUAL GlslangShaderConverter)
find_package(Glslang REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Glslang::Glslang)
# GltfImporter has no dependencies
# GltfSceneConverter has no dependencies
# HarfBuzzFont plugin dependencies. It additionally depends on FreeType
# but that one should be brought in transitively by the FreeTypeFont
# dependency.
elseif(_component STREQUAL HarfBuzzFont)
# On Emscripten, HarfBuzz could be taken from ports. If that's the
# case, propagate proper compiler flag.
if(CORRADE_TARGET_EMSCRIPTEN)
list(FIND _magnumPluginsConfigure "#define MAGNUM_USE_EMSCRIPTEN_PORTS_HARFBUZZ" _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_HARFBUZZ)
if(NOT _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_HARFBUZZ EQUAL -1)
set(MAGNUM_USE_EMSCRIPTEN_PORTS_HARFBUZZ 1)
endif()
endif()
if(MAGNUM_USE_EMSCRIPTEN_PORTS_HARFBUZZ)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "${_component} was compiled against an emscripten-ports version of HarfBuzz but linking to it requires CMake 3.13 at least")
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_HARFBUZZ=1")
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_HARFBUZZ=1")
else()
find_package(HarfBuzz)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES HarfBuzz::HarfBuzz)
endif()
# IcoImporter has no dependencies
# JpegImporter / JpegImageConverter plugin dependencies
elseif(_component STREQUAL JpegImageConverter OR _component STREQUAL JpegImporter)
# On Emscripten, libjpeg could be taken from ports. If that's the
# case, propagate proper compiler flag.
if(CORRADE_TARGET_EMSCRIPTEN)
list(FIND _magnumPluginsConfigure "#define MAGNUM_USE_EMSCRIPTEN_PORTS_LIBJPEG" _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_LIBJPEG)
if(NOT _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_LIBJPEG EQUAL -1)
set(MAGNUM_USE_EMSCRIPTEN_PORTS_LIBJPEG 1)
endif()
endif()
if(MAGNUM_USE_EMSCRIPTEN_PORTS_LIBJPEG)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "${_component} was compiled against an emscripten-ports version of libjpeg but linking to it requires CMake 3.13 at least")
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_LIBJPEG=1")
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_LIBJPEG=1")
else()
find_package(JPEG)
# Need to handle special cases where both debug and release
# libraries are available (in form of debug;A;optimized;B in
# JPEG_LIBRARIES), thus appending them one by one
# TODO use imported target when 3.12+ is the minimum
if(JPEG_LIBRARY_DEBUG AND JPEG_LIBRARY_RELEASE)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:Debug>>:${JPEG_LIBRARY_RELEASE}>;$<$<CONFIG:Debug>:${JPEG_LIBRARY_DEBUG}>")
else()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${JPEG_LIBRARIES})
endif()
endif()
# KtxImageConverter has no dependencies
# KtxImporter has no dependencies
# LunaSvgImporter plugin dependencies
elseif(_component STREQUAL LunaSvgImporter)
find_package(lunasvg CONFIG REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES lunasvg::lunasvg)
# MeshOptimizerSceneConverter plugin dependencies
elseif(_component STREQUAL MeshOptimizerSceneConverter)
if(NOT TARGET meshoptimizer)
find_package(meshoptimizer REQUIRED CONFIG)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES meshoptimizer::meshoptimizer)
else()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES meshoptimizer)
endif()
# MiniExrImageConverter has no dependencies
# OpenExrImporter / OpenExrImageConverter plugin dependencies
elseif(_component STREQUAL OpenExrImporter OR _component STREQUAL OpenExrImageConverter)
# Force our own FindOpenEXR module, which then delegates to the
# config if appropriate
find_package(OpenEXR REQUIRED MODULE)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenEXR::OpenEXR)
# OpenEXR uses exceptions, which need an explicit flag on
# Emscripten. This is most likely not propagated through its CMake
# config file, so doing that explicitly here.
if(CORRADE_TARGET_EMSCRIPTEN)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s DISABLE_EXCEPTION_CATCHING=0")
endif()
# No special setup for the OpenDdl library
# OpenGexImporter has no dependencies
# PlutoSvgImporter plugin dependencies
elseif(_component STREQUAL PlutoSvgImporter)
find_package(plutosvg CONFIG REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES plutosvg::plutosvg)
# PngImageConverter / PngImporter plugin dependencies
elseif(_component STREQUAL PngImageConverter OR _component STREQUAL PngImporter)
# On Emscripten, libpng could be taken from ports. If that's the
# case, propagate proper compiler flag.
if(CORRADE_TARGET_EMSCRIPTEN)
list(FIND _magnumPluginsConfigure "#define MAGNUM_USE_EMSCRIPTEN_PORTS_LIBPNG" _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_LIBPNG)
if(NOT _magnumPlugins${_component}_USE_EMSCRIPTEN_PORTS_LIBPNG EQUAL -1)
set(MAGNUM_USE_EMSCRIPTEN_PORTS_LIBPNG 1)
endif()
endif()
if(MAGNUM_USE_EMSCRIPTEN_PORTS_LIBPNG)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "${_component} was compiled against an emscripten-ports version of libpng but linking to it requires CMake 3.13 at least")
endif()
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_LIBPNG=1")
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_OPTIONS "SHELL:-s USE_LIBPNG=1")
else()
find_package(PNG)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES PNG::PNG)
endif()
# PrimitiveImporter has no dependencies
# ResvgImporter plugin dependencies
elseif(_component STREQUAL ResvgImporter)
find_package(Resvg REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Resvg::Resvg)
# SpirvToolsShaderConverter plugin dependencies
elseif(_component STREQUAL SpirvToolsShaderConverter)
find_package(SpirvTools REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES SpirvTools::SpirvTools SpirvTools::Opt)
# SpngImporter plugin dependencies
elseif(_component STREQUAL SpngImporter)
find_package(Spng REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Spng::Spng)
# StanfordImporter has no dependencies
# StanfordSceneConverter has no dependencies
# StbDxtImageConverter has no dependencies
# StbImageConverter has no dependencies
# StbImageImporter plugin dependencies
elseif(_component STREQUAL StbImageImporter)
# To solve a LTO-specific linker error. See StbImageImporter's
# CMakeLists.txt for details.
if(CORRADE_TARGET_EMSCRIPTEN AND NOT EMSCRIPTEN_VERSION VERSION_LESS 3.1.42 AND EMSCRIPTEN_VERSION VERSION_LESS 3.1.46)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
endif()
target_link_options(MagnumPlugins::${_component} INTERFACE $<$<CONFIG:Release>:-Wl,-u,scalbnf>)
endif()
# StbResizeImageConverter has no dependencies
# StbTrueTypeFont has no dependencies
# StbVorbisAudioImporter plugin dependencies
elseif(_component STREQUAL StbVorbisAudioImporter)
# To solve a LTO-specific linker error. See StbVorbisAudioImporter's
# CMakeLists.txt for details.
if(CORRADE_TARGET_EMSCRIPTEN AND NOT EMSCRIPTEN_VERSION VERSION_LESS 3.1.42 AND EMSCRIPTEN_VERSION VERSION_LESS 3.1.46)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(FATAL_ERROR "CMake 3.13+ is required in order to specify Emscripten linker options")
endif()
target_link_options(MagnumPlugins::${_component} INTERFACE $<$<CONFIG:Release>:-Wl,-u,scalbnf>)
endif()
# StlImporter has no dependencies
# UfbxImporter has no dependencies
# TinyGltfImporter has no dependencies
# WebPImageConverter / WebPImporter plugin dependencies
elseif(_component STREQUAL WebPImageConverter OR _component STREQUAL WebPImporter)
find_package(WebP REQUIRED)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES WebP::WebP)
endif()
# Automatic import of static plugins
if(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS AND _MAGNUMPLUGINS_${_COMPONENT}_BUILD_STATIC)
get_filename_component(_MAGNUMPLUGINS_${_COMPONENT}_INCLUDE_DIR ${_MAGNUMPLUGINS_${_COMPONENT}_CONFIGURE_FILE} DIRECTORY)
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_SOURCES ${_MAGNUMPLUGINS_${_COMPONENT}_INCLUDE_DIR}/importStaticPlugin.cpp)
endif()
if(_component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS OR _component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS)
# Link to core Magnum library, add other Magnum dependencies
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum)
foreach(_dependency ${_MAGNUMPLUGINS_${_component}_MAGNUM_DEPENDENCIES})
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::${_dependency})
endforeach()
# Add inter-project dependencies
foreach(_dependency ${_MAGNUMPLUGINS_${_component}_DEPENDENCIES})
set_property(TARGET MagnumPlugins::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES MagnumPlugins::${_dependency})
endforeach()
endif()
endif()
endforeach()
# For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially
# useful info about the failed components.
if(NOT CMAKE_VERSION VERSION_LESS 3.16)
set(_MAGNUMPLUGINS_REASON_FAILURE_MESSAGE)
# Go only through the originally specified find_package() components, not
# the dependencies added by us afterwards
foreach(_component ${_MAGNUMPLUGINS_ORIGINAL_FIND_COMPONENTS})
if(MagnumPlugins_${_component}_FOUND)
continue()
endif()
# If it's not known at all, tell the user -- it might be a new library
# and an old Find module, or something platform-specific.
if(NOT _component IN_LIST _MAGNUMPLUGINS_LIBRARY_COMPONENTS AND NOT _component IN_LIST _MAGNUMPLUGINS_PLUGIN_COMPONENTS)
list(APPEND _MAGNUMPLUGINS_REASON_FAILURE_MESSAGE "${_component} is not a known component on this platform.")
# Otherwise, if it's not among implicitly built components, hint that
# the user may need to enable it
# TODO: currently, the _FOUND variable doesn't reflect if dependencies
# were found. When it will, this needs to be updated to avoid
# misleading messages.
elseif(NOT _component IN_LIST _MAGNUMPLUGINS_IMPLICITLY_ENABLED_COMPONENTS)
string(TOUPPER ${_component} _COMPONENT)
list(APPEND _MAGNUMPLUGINS_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum Plugins.")
# Otherwise we have no idea. Better be silent than to print something
# misleading.
else()
endif()
endforeach()
string(REPLACE ";" " " _MAGNUMPLUGINS_REASON_FAILURE_MESSAGE "${_MAGNUMPLUGINS_REASON_FAILURE_MESSAGE}")
set(_MAGNUMPLUGINS_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_MAGNUMPLUGINS_REASON_FAILURE_MESSAGE}")
endif()
# Remove Magnum Plugins dependency module dir from CMAKE_MODULE_PATH again. Do
# it before the FPHSA call which may exit early in case of a failure.
if(_MAGNUMPLUGINS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
list(REMOVE_ITEM CMAKE_MODULE_PATH ${_MAGNUMPLUGINS_DEPENDENCY_MODULE_DIR})
unset(_MAGNUMPLUGINS_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MagnumPlugins
REQUIRED_VARS MAGNUMPLUGINS_INCLUDE_DIR
HANDLE_COMPONENTS
${_MAGNUMPLUGINS_REASON_FAILURE_MESSAGE})
+126
View File
@@ -0,0 +1,126 @@
#.rst:
# Find OVR
# --------
#
# Finds the OVR library. This module defines:
#
# OVR_FOUND - True if OVR library is found
# OVR::OVR - OVR imported target
#
# Additionally these variables are defined for internal usage:
#
# OVR_LIBRARY - OVR library
# OVR_INCLUDE_DIR - Include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2015, 2016, 2018 Jonathan Hale <squareys@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
if(NOT OVR_SDK_ROOT)
find_path(OVR_SDK_ROOT OculusSDK)
if(OVR_SDK_ROOT)
set(OVR_SDK_ROOT "${OVR_SDK_ROOT}/OculusSDK")
endif()
endif()
set(LIBOVR_ROOT ${OVR_SDK_ROOT}/LibOVR)
# find include directory
find_path(OVR_INCLUDE_DIR NAMES OVR_CAPI.h HINTS ${LIBOVR_ROOT}/Include)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# compiling for 64 bit
set(_OVR_MSVC_ARCH "x64")
else()
# compiling for 32 bit
set(_OVR_MSVC_ARCH "Win32")
endif()
# select the correct library folder matching MSVC version
if (MSVC_VERSION GREATER 1800)
set(_OVR_MSVC_NAME "VS2015")
elseif (MSVC_VERSION GREATER 1700)
set(_OVR_MSVC_NAME "VS2013")
elseif (MSVC_VERSION GREATER 1600)
set(_OVR_MSVC_NAME "VS2012")
else()
set(_OVR_MSVC_NAME "VS2010")
endif()
find_library(OVR_LIBRARY_DEBUG NAMES LibOVR HINTS "${LIBOVR_ROOT}/Lib/Windows/${_OVR_MSVC_ARCH}/Debug/${_OVR_MSVC_NAME}")
find_library(OVR_LIBRARY_RELEASE NAMES LibOVR HINTS "${LIBOVR_ROOT}/Lib/Windows/${_OVR_MSVC_ARCH}/Release/${_OVR_MSVC_NAME}")
unset(_OVR_MSVC_ARCH)
unset(_OVR_MSVC_NAME)
elseif(MINGW)
# we cannot link against the MSVC lib with MinGW. Instead, we link directly to the runtime DLL,
# which requires the Oculus runtime to be installed.
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# compiling for 64 bit
find_library(OVR_LIBRARY_RELEASE NAMES LibOVRRT64_1.dll HINTS "C:/Program Files (x86)/Oculus/Support/oculus-runtime")
else()
# compiling for 32 bit
find_library(OVR_LIBRARY_RELEASE NAMES LibOVRRT32_1.dll HINTS "C:/Program Files (x86)/Oculus/Support/oculus-runtime")
endif()
endif()
else()
message(SEND_ERROR "The Oculus SDK does not support ${CMAKE_SYSTEM_NAME}.")
endif()
include(SelectLibraryConfigurations)
select_library_configurations(OVR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OVR DEFAULT_MSG
OVR_LIBRARY
OVR_INCLUDE_DIR)
mark_as_advanced(FORCE
OVR_LIBRARY_DEBUG
OVR_LIBRARY_RELEASE
OVR_INCLUDE_DIR)
if(NOT TARGET OVR::OVR)
add_library(OVR::OVR UNKNOWN IMPORTED)
set_property(TARGET OVR::OVR APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(OVR::OVR PROPERTIES
IMPORTED_LOCATION_RELEASE ${OVR_LIBRARY_RELEASE}
INTERFACE_INCLUDE_DIRECTORIES ${OVR_INCLUDE_DIR})
if(OVR_LIBRARY_DEBUG)
set_property(TARGET OVR::OVR APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET OVR::OVR PROPERTY
IMPORTED_LOCATION_DEBUG ${OVR_LIBRARY_DEBUG})
endif()
endif()
@@ -0,0 +1,27 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022, 2023, 2024, 2025, 2026
# Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
include(${CMAKE_CURRENT_LIST_DIR}/FindMagnumIntegration.cmake)