2021-06-11 19:24:52 +02:00
#.rst:
# Find Magnum
# -----------
#
# Finds the Magnum library. Basic usage::
#
# find_package(Magnum REQUIRED)
#
# This module tries to find the base Magnum library and then defines the
# following:
#
# Magnum_FOUND - Whether the base library was found
# MAGNUM_DEPLOY_PREFIX - Prefix where to put final application
# executables, defaults to ``.``. If a relative path is used, it's relative
# to :variable:`CMAKE_INSTALL_PREFIX`.
# MAGNUM_PLUGINS_DEBUG_DIR - Base directory with dynamic plugins for
# debug builds, defaults to magnum-d/ subdirectory of dir where Magnum
# library was found
# MAGNUM_PLUGINS_RELEASE_DIR - Base directory with dynamic plugins for
# release builds, defaults to magnum/ subdirectory of dir where Magnum
# library was found
# MAGNUM_PLUGINS_DIR - Base directory with dynamic plugins, defaults
# to :variable:`MAGNUM_PLUGINS_RELEASE_DIR` in release builds and
# multi-configuration builds or to :variable:`MAGNUM_PLUGINS_DEBUG_DIR` in
# debug builds
# MAGNUM_PLUGINS_FONT[|_DEBUG|_RELEASE]_DIR - Directory with dynamic font
# plugins
# MAGNUM_PLUGINS_FONTCONVERTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# font converter plugins
# MAGNUM_PLUGINS_IMAGECONVERTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# image converter plugins
# MAGNUM_PLUGINS_SCENECONVERTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# scene converter plugins
# MAGNUM_PLUGINS_IMPORTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# importer plugins
# MAGNUM_PLUGINS_AUDIOIMPORTER[|_DEBUG|_RELEASE]_DIR - Directory with dynamic
# audio importer plugins
#
# If Magnum is built for Emscripten, the following variables contain paths to
# various support files:
#
# MAGNUM_EMSCRIPTENAPPLICATION_JS - Path to the EmscriptenApplication.js file
# MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS - Path to the
# WindowlessEmscriptenApplication.js file
# MAGNUM_WEBAPPLICATION_CSS - Path to the WebApplication.css file
#
# This command will try to find only the base library, not the optional
# components. The base library depends on Corrade and OpenGL libraries (or
# OpenGL ES libraries). Additional dependencies are specified by the
# components. The optional components are:
#
# AnyAudioImporter - Any audio importer
# AnyImageConverter - Any image converter
# AnyImageImporter - Any image importer
# AnySceneConverter - Any scene converter
# AnySceneImporter - Any scene importer
# Audio - Audio library
# DebugTools - DebugTools library
# GL - GL library
2023-08-31 11:52:52 +02:00
# MaterialTools - MaterialTools library
2021-06-11 19:24:52 +02:00
# MeshTools - MeshTools library
# Primitives - Primitives library
# SceneGraph - SceneGraph library
2022-03-09 11:04:19 +01:00
# SceneTools - SceneTools library
2021-06-11 19:24:52 +02:00
# Shaders - Shaders library
# ShaderTools - ShaderTools library
# Text - Text library
# TextureTools - TextureTools library
# Trade - Trade library
# Vk - Vk library
# AndroidApplication - Android application
# EmscriptenApplication - Emscripten application
# GlfwApplication - GLFW application
# GlxApplication - GLX application
# Sdl2Application - SDL2 application
# XEglApplication - X/EGL application
# WindowlessCglApplication - Windowless CGL application
# WindowlessEglApplication - Windowless EGL application
# WindowlessGlxApplication - Windowless GLX application
# WindowlessIosApplication - Windowless iOS application
# WindowlessWglApplication - Windowless WGL application
# CglContext - CGL context
# EglContext - EGL context
# GlxContext - GLX context
# WglContext - WGL context
# OpenGLTester - OpenGLTester class
# VulkanTester - VulkanTester class
# MagnumFont - Magnum bitmap font plugin
# MagnumFontConverter - Magnum bitmap font converter plugin
# ObjImporter - OBJ importer plugin
# TgaImageConverter - TGA image converter plugin
# TgaImporter - TGA importer plugin
# WavAudioImporter - WAV audio importer plugin
# distancefieldconverter - magnum-distancefieldconverter executable
# fontconverter - magnum-fontconverter executable
# imageconverter - magnum-imageconverter executable
# sceneconverterter - magnum-sceneconverter executable
# shaderconverterter - magnum-shaderconverter executable
# gl-info - magnum-gl-info executable
# vk-info - magnum-vk-info executable
# al-info - magnum-al-info executable
#
# Example usage with specifying additional components is::
#
# find_package(Magnum REQUIRED Trade MeshTools Primitives GlfwApplication)
#
# For each component is then defined:
#
# Magnum_*_FOUND - Whether the component was found
# Magnum::* - Component imported target
#
# If exactly one ``*Application`` or exactly one ``Windowless*Application``
# component is requested and found, its target is available in convenience
# alias ``Magnum::Application`` / ``Magnum::WindowlessApplication`` to simplify
# porting. Similarly, if exactly one ``*Context`` component is requested and
# found, its target is available in convenience alias ``Magnum::GLContext``.
#
# The package is found if either debug or release version of each requested
# library (or plugin) is found. If both debug and release libraries (or
# plugins) 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). Note that this autodetection might fail
# for the :variable:`MAGNUM_PLUGINS_DIR` variable, especially on
# multi-configuration build systems. You can make use of
# ``CORRADE_IS_DEBUG_BUILD`` preprocessor variable along with
# ``MAGNUM_PLUGINS_*_DEBUG_DIR`` / ``MAGNUM_PLUGINS_*_RELEASE_DIR`` variables
# to decide in preprocessing step.
#
# Features of found Magnum library are exposed in these variables:
#
2023-08-31 11:52:52 +02:00
# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated features
2021-06-11 19:24:52 +02:00
# included
# MAGNUM_BUILD_STATIC - Defined if compiled as static libraries
# MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS - Defined if static libraries keep the
# globals unique even across different shared libraries
# MAGNUM_TARGET_GL - Defined if compiled with OpenGL interop
# MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES
# MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL
2024-04-07 15:50:49 +02:00
# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 / WebGL
# 1 instead of OpenGL ES 3.0+ / WebGL 2
2023-08-31 11:52:52 +02:00
# MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a
# platform-specific OpenGL support library like CGL, EAGL, GLX or WGL
2021-06-11 19:24:52 +02:00
# MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop
#
# The following variables are provided for backwards compatibility purposes
# only when MAGNUM_BUILD_DEPRECATED is enabled and will be removed in a future
# release:
#
# MAGNUM_BUILD_MULTITHREADED - Alias to CORRADE_BUILD_MULTITHREADED. Use
# CORRADE_BUILD_MULTITHREADED instead.
2023-08-31 11:52:52 +02:00
# MAGNUM_TARGET_HEADLESS - Alias to MAGNUM_TARGET_EGL, unless on iOS,
# Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead.
# MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but
# GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead.
2024-04-07 15:50:49 +02:00
# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0+ /
# WebGL 2. Use an inverse of the MAGNUM_TARGET_GLES2 variable instead.
2021-06-11 19:24:52 +02:00
#
# Additionally these variables are defined for internal usage:
#
# MAGNUM_INCLUDE_DIR - Root include dir (w/o dependencies)
# MAGNUM_LIBRARY - Magnum library (w/o dependencies)
# MAGNUM_LIBRARY_DEBUG - Debug version of Magnum library, if found
# MAGNUM_LIBRARY_RELEASE - Release version of Magnum library, if found
# MAGNUM_*_LIBRARY - Component libraries (w/o dependencies)
# MAGNUM_*_LIBRARY_DEBUG - Debug version of given library, if found
# MAGNUM_*_LIBRARY_RELEASE - Release version of given library, if found
2024-04-07 15:50:49 +02:00
# MAGNUM_PLATFORM_JS - Path to MagnumPlatform.js file
2021-06-11 19:24:52 +02:00
# MAGNUM_BINARY_INSTALL_DIR - Binary installation directory
# MAGNUM_LIBRARY_INSTALL_DIR - Library installation directory
# MAGNUM_DATA_INSTALL_DIR - Data installation directory
# MAGNUM_PLUGINS_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Plugin binary
# installation directory
# MAGNUM_PLUGINS_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Plugin library
# installation directory
# MAGNUM_PLUGINS_SHADERCONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Shader
# converter plugin binary installation directory
# MAGNUM_PLUGINS_SHADERCONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Shader
# converter plugin library installation directory
# MAGNUM_PLUGINS_FONT_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Font plugin binary
# installation directory
# MAGNUM_PLUGINS_FONT_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Font plugin
# library installation directory
# MAGNUM_PLUGINS_FONTCONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Font
# converter plugin binary installation directory
# MAGNUM_PLUGINS_FONTCONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Font
# converter plugin library installation directory
# MAGNUM_PLUGINS_IMAGECONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Image
# converter plugin binary installation directory
# MAGNUM_PLUGINS_IMAGECONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Image
# converter plugin library installation directory
# MAGNUM_PLUGINS_IMPORTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Importer
# plugin binary installation directory
# MAGNUM_PLUGINS_IMPORTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Importer
# plugin library installation directory
# MAGNUM_PLUGINS_SCENECONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Scene
# converter plugin binary installation directory
# MAGNUM_PLUGINS_SCENECONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Scene
# converter plugin library installation directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Audio
# importer plugin binary installation directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Audio
# importer plugin library installation directory
# MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory
# MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2023-08-31 11:52:52 +02:00
# 2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
2021-06-11 19:24:52 +02:00
#
# 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.
#
2024-04-07 15:50:49 +02:00
# CMake policies used by FindMagnum are popped again at the end.
cmake_policy ( PUSH )
# Prefer GLVND when finding OpenGL. If this causes problems (known to fail with
# NVidia drivers in Debian Buster, reported on 2019-04-09), users can override
# this by setting OpenGL_GL_PREFERENCE to LEGACY.
if ( POLICY CMP0072 )
cmake_policy ( SET CMP0072 NEW )
endif ( )
2021-06-11 19:24:52 +02:00
# Corrade library dependencies
set ( _MAGNUM_CORRADE_DEPENDENCIES )
2023-08-31 11:52:52 +02:00
foreach ( _magnum_component ${ Magnum_FIND_COMPONENTS } )
set ( _MAGNUM_ ${ _magnum_component } _CORRADE_DEPENDENCIES )
2021-06-11 19:24:52 +02:00
# Unrolling the transitive dependencies here so this doesn't need to be
# after resolving inter-component dependencies. Listing also all plugins.
2023-08-31 11:52:52 +02:00
if ( _magnum_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$" )
list ( APPEND _MAGNUM_ ${ _magnum_component } _CORRADE_DEPENDENCIES PluginManager )
endif ( )
if ( _magnum_component STREQUAL DebugTools )
# DebugTools depends on TestSuite optionally, so if it's not there
# assume it wasn't compiled against it. Also, all variables from the
# FindCorrade module overwrite the local variables here (in particular
# _component, _COMPONENT and such), so we need to prefix extensively.
find_package ( Corrade QUIET COMPONENTS TestSuite )
if ( Corrade_TestSuite_FOUND )
list ( APPEND _MAGNUM_ ${ _magnum_component } _CORRADE_DEPENDENCIES TestSuite )
endif ( )
2021-06-11 19:24:52 +02:00
endif ( )
2023-08-31 11:52:52 +02:00
list ( APPEND _MAGNUM_CORRADE_DEPENDENCIES ${ _MAGNUM_${_magnum_component } _CORRADE_DEPENDENCIES} )
2021-06-11 19:24:52 +02:00
endforeach ( )
find_package ( Corrade REQUIRED Utility ${ _MAGNUM_CORRADE_DEPENDENCIES } )
# Root include dir
find_path ( MAGNUM_INCLUDE_DIR
N A M E S M a g n u m / M a g n u m . h )
mark_as_advanced ( MAGNUM_INCLUDE_DIR )
# Configuration file
find_file ( _MAGNUM_CONFIGURE_FILE configure.h
H I N T S $ { M A G N U M _ I N C L U D E _ D I R } / M a g n u m / )
mark_as_advanced ( _MAGNUM_CONFIGURE_FILE )
# We need to open configure.h file from MAGNUM_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 MAGNUM_INCLUDE_DIR )
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( Magnum
R E Q U I R E D _ V A R S M A G N U M _ I N C L U D E _ D I R _ M A G N U M _ C O N F I G U R E _ F I L E )
endif ( )
# Read flags from configuration
file ( READ ${ _MAGNUM_CONFIGURE_FILE } _magnumConfigure )
string ( REGEX REPLACE ";" "\\\\;" _magnumConfigure "${_magnumConfigure}" )
string ( REGEX REPLACE "\n" ";" _magnumConfigure "${_magnumConfigure}" )
set ( _magnumFlags
B U I L D _ D E P R E C A T E D
B U I L D _ S T A T I C
B U I L D _ S T A T I C _ U N I Q U E _ G L O B A L S
T A R G E T _ G L
T A R G E T _ G L E S
T A R G E T _ G L E S 2
T A R G E T _ W E B G L
2023-08-31 11:52:52 +02:00
T A R G E T _ E G L
2021-06-11 19:24:52 +02:00
T A R G E T _ V K )
foreach ( _magnumFlag ${ _magnumFlags } )
list ( FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_ ${ _magnumFlag } )
if ( NOT _magnum_ ${ _magnumFlag } EQUAL -1 )
set ( MAGNUM_ ${ _magnumFlag } 1 )
endif ( )
endforeach ( )
2023-08-31 11:52:52 +02:00
# For compatibility only, to be removed at some point. Refer to
# src/Magnum/configure.h.cmake for the decision logic here.
if ( MAGNUM_BUILD_DEPRECATED )
if ( CORRADE_BUILD_MULTITHREADED )
set ( MAGNUM_BUILD_MULTITHREADED 1 )
endif ( )
if ( NOT CORRADE_TARGET_IOS AND NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_WINDOWS_RT )
if ( NOT MAGNUM_TARGET_GLES AND MAGNUM_TARGET_EGL )
set ( MAGNUM_TARGET_HEADLESS 1 )
endif ( )
if ( MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL )
set ( MAGNUM_TARGET_DESKTOP_GLES 1 )
endif ( )
endif ( )
2024-04-07 15:50:49 +02:00
if ( MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2 )
set ( MAGNUM_TARGET_GLES3 1 )
endif ( )
2021-06-11 19:24:52 +02:00
endif ( )
# Base Magnum library
if ( NOT TARGET Magnum::Magnum )
add_library ( Magnum::Magnum UNKNOWN IMPORTED )
# Try to find both debug and release version
find_library ( MAGNUM_LIBRARY_DEBUG Magnum-d )
find_library ( MAGNUM_LIBRARY_RELEASE Magnum )
mark_as_advanced ( MAGNUM_LIBRARY_DEBUG
M A G N U M _ L I B R A R Y _ R E L E A S E )
# Set the MAGNUM_LIBRARY variable based on what was found, use that
# information to guess also build type of dynamic plugins
if ( MAGNUM_LIBRARY_DEBUG AND MAGNUM_LIBRARY_RELEASE )
set ( MAGNUM_LIBRARY ${ MAGNUM_LIBRARY_RELEASE } )
get_filename_component ( _MAGNUM_PLUGINS_DIR_PREFIX ${ MAGNUM_LIBRARY_DEBUG } PATH )
if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set ( _MAGNUM_PLUGINS_DIR_SUFFIX "-d" )
endif ( )
elseif ( MAGNUM_LIBRARY_DEBUG )
set ( MAGNUM_LIBRARY ${ MAGNUM_LIBRARY_DEBUG } )
get_filename_component ( _MAGNUM_PLUGINS_DIR_PREFIX ${ MAGNUM_LIBRARY_DEBUG } PATH )
set ( _MAGNUM_PLUGINS_DIR_SUFFIX "-d" )
elseif ( MAGNUM_LIBRARY_RELEASE )
set ( MAGNUM_LIBRARY ${ MAGNUM_LIBRARY_RELEASE } )
get_filename_component ( _MAGNUM_PLUGINS_DIR_PREFIX ${ MAGNUM_LIBRARY_RELEASE } PATH )
endif ( )
# On DLL platforms the plugins are stored in bin/ instead of lib/, modify
# _MAGNUM_PLUGINS_DIR_PREFIX accordingly
if ( CORRADE_TARGET_WINDOWS )
get_filename_component ( _MAGNUM_PLUGINS_DIR_PREFIX ${ _MAGNUM_PLUGINS_DIR_PREFIX } PATH )
set ( _MAGNUM_PLUGINS_DIR_PREFIX ${ _MAGNUM_PLUGINS_DIR_PREFIX } /bin )
endif ( )
if ( MAGNUM_LIBRARY_RELEASE )
set_property ( TARGET Magnum::Magnum APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S R E L E A S E )
set_property ( TARGET Magnum::Magnum PROPERTY
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { M A G N U M _ L I B R A R Y _ R E L E A S E } )
endif ( )
if ( MAGNUM_LIBRARY_DEBUG )
set_property ( TARGET Magnum::Magnum APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S D E B U G )
set_property ( TARGET Magnum::Magnum PROPERTY
I M P O R T E D _ L O C A T I O N _ D E B U G $ { M A G N U M _ L I B R A R Y _ D E B U G } )
endif ( )
# Include directories
set_property ( TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$ { M A G N U M _ I N C L U D E _ D I R } )
# Dependent libraries
set_property ( TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_LINK_LIBRARIES
C o r r a d e : : U t i l i t y )
else ( )
set ( MAGNUM_LIBRARY Magnum::Magnum )
endif ( )
# Component distinction (listing them explicitly to avoid mistakes with finding
# components from other repositories)
set ( _MAGNUM_LIBRARY_COMPONENTS
2023-08-31 11:52:52 +02:00
A u d i o D e b u g T o o l s G L M a t e r i a l T o o l s M e s h T o o l s P r i m i t i v e s S c e n e G r a p h
S c e n e T o o l s S h a d e r s S h a d e r T o o l s T e x t T e x t u r e T o o l s T r a d e
2021-06-11 19:24:52 +02:00
W i n d o w l e s s E g l A p p l i c a t i o n E g l C o n t e x t O p e n G L T e s t e r )
set ( _MAGNUM_PLUGIN_COMPONENTS
A n y A u d i o I m p o r t e r A n y I m a g e C o n v e r t e r A n y I m a g e I m p o r t e r A n y S c e n e C o n v e r t e r
A n y S c e n e I m p o r t e r M a g n u m F o n t M a g n u m F o n t C o n v e r t e r O b j I m p o r t e r
T g a I m a g e C o n v e r t e r T g a I m p o r t e r W a v A u d i o I m p o r t e r )
set ( _MAGNUM_EXECUTABLE_COMPONENTS
i m a g e c o n v e r t e r s c e n e c o n v e r t e r s h a d e r c o n v e r t e r g l - i n f o a l - i n f o )
# Audio and Vk libs aren't enabled by default, and none of the Context,
# Application, Tester libs nor plugins are. Keep in sync with Magnum's root
# CMakeLists.txt.
set ( _MAGNUM_IMPLICITLY_ENABLED_COMPONENTS
D e b u g T o o l s M e s h T o o l s S c e n e G r a p h S h a d e r s S h a d e r T o o l s T e x t T e x t u r e T o o l s T r a d e
G L P r i m i t i v e s )
if ( NOT CORRADE_TARGET_EMSCRIPTEN )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS Vk VulkanTester )
list ( APPEND _MAGNUM_EXECUTABLE_COMPONENTS vk-info )
endif ( )
if ( NOT CORRADE_TARGET_ANDROID )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS Sdl2Application )
endif ( )
if ( NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_IOS AND NOT CORRADE_TARGET_EMSCRIPTEN )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS GlfwApplication )
endif ( )
if ( CORRADE_TARGET_ANDROID )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS AndroidApplication )
endif ( )
if ( CORRADE_TARGET_EMSCRIPTEN )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS EmscriptenApplication )
endif ( )
if ( CORRADE_TARGET_IOS )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessIosApplication )
2022-03-09 11:04:19 +01:00
elseif ( CORRADE_TARGET_APPLE AND NOT MAGNUM_TARGET_GLES )
2021-06-11 19:24:52 +02:00
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessCglApplication CglContext )
endif ( )
if ( CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE )
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS GlxApplication XEglApplication WindowlessGlxApplication GlxContext )
endif ( )
if ( CORRADE_TARGET_WINDOWS )
2023-08-31 11:52:52 +02:00
list ( APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext )
2021-06-11 19:24:52 +02:00
endif ( )
if ( CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS )
list ( APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter )
endif ( )
# Inter-component dependencies
set ( _MAGNUM_Audio_DEPENDENCIES )
# Trade is used by CompareImage. If Trade is not enabled, CompareImage is not
# compiled at all.
set ( _MAGNUM_DebugTools_DEPENDENCIES Trade )
set ( _MAGNUM_DebugTools_Trade_DEPENDENCY_IS_OPTIONAL ON )
# MeshTools, Primitives, SceneGraph and Shaders are used only for GL renderers
# in DebugTools. All of this is optional, compiled in only if the base library
# was selected.
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_DebugTools_DEPENDENCIES MeshTools Primitives SceneGraph Shaders GL )
set ( _MAGNUM_DebugTools_MeshTools_DEPENDENCY_IS_OPTIONAL ON )
set ( _MAGNUM_DebugTools_Primitives_DEPENDENCY_IS_OPTIONAL ON )
set ( _MAGNUM_DebugTools_SceneGraph_DEPENDENCY_IS_OPTIONAL ON )
set ( _MAGNUM_DebugTools_Shaders_DEPENDENCY_IS_OPTIONAL ON )
set ( _MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON )
endif ( )
2023-08-31 11:52:52 +02:00
set ( _MAGNUM_MaterialTools_DEPENDENCIES Trade )
2021-06-11 19:24:52 +02:00
set ( _MAGNUM_MeshTools_DEPENDENCIES Trade )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_MeshTools_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_OpenGLTester_DEPENDENCIES GL )
2023-08-31 11:52:52 +02:00
if ( MAGNUM_TARGET_EGL )
2021-06-11 19:24:52 +02:00
list ( APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication )
elseif ( CORRADE_TARGET_IOS )
list ( APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessIosApplication )
2023-08-31 11:52:52 +02:00
elseif ( CORRADE_TARGET_APPLE )
2021-06-11 19:24:52 +02:00
list ( APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessCglApplication )
elseif ( CORRADE_TARGET_UNIX )
2023-08-31 11:52:52 +02:00
list ( APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication )
2021-06-11 19:24:52 +02:00
elseif ( CORRADE_TARGET_WINDOWS )
2023-08-31 11:52:52 +02:00
list ( APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication )
2021-06-11 19:24:52 +02:00
endif ( )
set ( _MAGNUM_Primitives_DEPENDENCIES MeshTools Trade )
if ( MAGNUM_TARGET_GL )
# GL not required by Primitives themselves, but transitively by MeshTools
list ( APPEND _MAGNUM_Primitives_DEPENDENCIES GL )
endif ( )
2022-03-09 11:04:19 +01:00
2021-06-11 19:24:52 +02:00
set ( _MAGNUM_SceneGraph_DEPENDENCIES )
2022-03-09 11:04:19 +01:00
set ( _MAGNUM_SceneTools_DEPENDENCIES Trade )
2021-06-11 19:24:52 +02:00
set ( _MAGNUM_Shaders_DEPENDENCIES GL )
2022-03-09 11:04:19 +01:00
2021-06-11 19:24:52 +02:00
set ( _MAGNUM_Text_DEPENDENCIES TextureTools )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_Text_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_TextureTools_DEPENDENCIES )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_TextureTools_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_Trade_DEPENDENCIES )
set ( _MAGNUM_VulkanTester_DEPENDENCIES Vk )
set ( _MAGNUM_AndroidApplication_DEPENDENCIES GL )
2022-03-09 11:04:19 +01:00
2021-06-11 19:24:52 +02:00
set ( _MAGNUM_EmscriptenApplication_DEPENDENCIES )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_EmscriptenApplication_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_GlfwApplication_DEPENDENCIES )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_GlfwApplication_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_GlxApplication_DEPENDENCIES GL )
set ( _MAGNUM_Sdl2Application_DEPENDENCIES )
if ( MAGNUM_TARGET_GL )
list ( APPEND _MAGNUM_Sdl2Application_DEPENDENCIES GL )
endif ( )
set ( _MAGNUM_WindowlessCglApplication_DEPENDENCIES GL )
set ( _MAGNUM_WindowlessEglApplication_DEPENDENCIES GL )
set ( _MAGNUM_WindowlessGlxApplication_DEPENDENCIES GL )
set ( _MAGNUM_WindowlessIosApplication_DEPENDENCIES GL )
set ( _MAGNUM_WindowlessWglApplication_DEPENDENCIES GL )
set ( _MAGNUM_XEglApplication_DEPENDENCIES GL )
set ( _MAGNUM_CglContext_DEPENDENCIES GL )
set ( _MAGNUM_EglContext_DEPENDENCIES GL )
set ( _MAGNUM_GlxContext_DEPENDENCIES GL )
set ( _MAGNUM_WglContext_DEPENDENCIES GL )
set ( _MAGNUM_MagnumFont_DEPENDENCIES Trade TgaImporter GL ) # and below
set ( _MAGNUM_MagnumFontConverter_DEPENDENCIES Trade TgaImageConverter ) # and below
set ( _MAGNUM_ObjImporter_DEPENDENCIES MeshTools ) # and below
foreach ( _component ${ _MAGNUM_PLUGIN_COMPONENTS } )
if ( _component MATCHES ".+AudioImporter" )
list ( APPEND _MAGNUM_ ${ _component } _DEPENDENCIES Audio )
elseif ( _component MATCHES ".+ShaderConverter" )
list ( APPEND _MAGNUM_ ${ _component } _DEPENDENCIES ShaderTools )
elseif ( _component MATCHES ".+(Importer|ImageConverter|SceneConverter)" )
list ( APPEND _MAGNUM_ ${ _component } _DEPENDENCIES Trade )
elseif ( _component MATCHES ".+(Font|FontConverter)" )
list ( APPEND _MAGNUM_ ${ _component } _DEPENDENCIES Text TextureTools )
endif ( )
endforeach ( )
# Ensure that all inter-component dependencies are specified as well
set ( _MAGNUM_ADDITIONAL_COMPONENTS )
foreach ( _component ${ Magnum_FIND_COMPONENTS } )
# Mark the dependencies as required if the component is also required, but
# only if they themselves are not optional (for example parts of DebugTools
# are present only if their respective base library is compiled)
if ( Magnum_FIND_REQUIRED_ ${ _component } )
foreach ( _dependency ${ _MAGNUM_${_component } _DEPENDENCIES} )
if ( NOT _MAGNUM_ ${ _component } _ ${ _dependency } _DEPENDENCY_IS_OPTIONAL )
set ( Magnum_FIND_REQUIRED_ ${ _dependency } TRUE )
endif ( )
endforeach ( )
endif ( )
list ( APPEND _MAGNUM_ADDITIONAL_COMPONENTS ${ _MAGNUM_${_component } _DEPENDENCIES} )
endforeach ( )
# Join the lists, remove duplicate components
set ( _MAGNUM_ORIGINAL_FIND_COMPONENTS ${ Magnum_FIND_COMPONENTS } )
if ( _MAGNUM_ADDITIONAL_COMPONENTS )
list ( INSERT Magnum_FIND_COMPONENTS 0 ${ _MAGNUM_ADDITIONAL_COMPONENTS } )
endif ( )
if ( Magnum_FIND_COMPONENTS )
list ( REMOVE_DUPLICATES Magnum_FIND_COMPONENTS )
endif ( )
# Find all components. Maintain a list of components that'll need to have
# their optional dependencies checked.
set ( _MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD )
foreach ( _component ${ Magnum_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 Magnum:: ${ _component } )
set ( Magnum_ ${ _component } _FOUND TRUE )
else ( )
# Library components
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS )
add_library ( Magnum:: ${ _component } UNKNOWN IMPORTED )
# Set library defaults, find the library
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/ ${ _component } )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _component } .h )
# Try to find both debug and release version
find_library ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG Magnum ${ _component } -d )
find_library ( MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE Magnum ${ _component } )
mark_as_advanced ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG
M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E )
# Plugin components
elseif ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
add_library ( Magnum:: ${ _component } UNKNOWN IMPORTED )
# AudioImporter plugin specific name suffixes
if ( _component MATCHES ".+AudioImporter$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX audioimporters )
# Audio importer class is Audio::*Importer, thus we need to
# convert *AudioImporter.h to *Importer.h
string ( REPLACE "AudioImporter" "Importer" _MAGNUM_ ${ _COMPONENT } _HEADER_NAME "${_component}" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _MAGNUM_${_COMPONENT } _HEADER_NAME}.h )
# ShaderConverter plugin specific name suffixes
elseif ( _component MATCHES ".+ShaderConverter$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX shaderconverters )
# Importer plugin specific name suffixes
elseif ( _component MATCHES ".+Importer$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX importers )
# Font plugin specific name suffixes
elseif ( _component MATCHES ".+Font$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX fonts )
# ImageConverter plugin specific name suffixes
elseif ( _component MATCHES ".+ImageConverter$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX imageconverters )
# SceneConverter plugin specific name suffixes
elseif ( _component MATCHES ".+SceneConverter$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX sceneconverters )
# FontConverter plugin specific name suffixes
elseif ( _component MATCHES ".+FontConverter$" )
set ( _MAGNUM_ ${ _COMPONENT } _PATH_SUFFIX fontconverters )
endif ( )
# Don't override the exception for *AudioImporter plugins
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX MagnumPlugins/ ${ _component } )
if ( NOT _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES ${ _component } .h )
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
2022-03-09 11:04:19 +01:00
# accidentally break something else
2021-06-11 19:24:52 +02:00
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 ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG ${ _component } -d
P A T H _ S U F F I X E S m a g n u m / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ P A T H _ S U F F I X } )
find_library ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG ${ _component }
P A T H _ S U F F I X E S m a g n u m - d / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ P A T H _ S U F F I X } )
find_library ( MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE ${ _component }
P A T H _ S U F F I X E S m a g n u m / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ P A T H _ S U F F I X } )
mark_as_advanced ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG
M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E )
# Reset back
set ( CMAKE_FIND_LIBRARY_PREFIXES "${_tmp_prefixes}" )
# Executables
elseif ( _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS )
add_executable ( Magnum:: ${ _component } IMPORTED )
find_program ( MAGNUM_ ${ _COMPONENT } _EXECUTABLE magnum- ${ _component } )
mark_as_advanced ( MAGNUM_ ${ _COMPONENT } _EXECUTABLE )
if ( MAGNUM_ ${ _COMPONENT } _EXECUTABLE )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N $ { M A G N U M _ $ { _ C O M P O N E N T } _ E X E C U T A B L E } )
endif ( )
# Something unknown, skip. FPHSA will take care of handling this below.
else ( )
continue ( )
endif ( )
# Library location for libraries/plugins
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
if ( MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S R E L E A S E )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ R E L E A S E } )
endif ( )
if ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I M P O R T E D _ C O N F I G U R A T I O N S D E B U G )
set_property ( TARGET Magnum:: ${ _component } PROPERTY
I M P O R T E D _ L O C A T I O N _ D E B U G $ { M A G N U M _ $ { _ C O M P O N E N T } _ L I B R A R Y _ D E B U G } )
endif ( )
endif ( )
# Applications
if ( _component MATCHES ".+Application" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
# Android application dependencies
if ( _component STREQUAL AndroidApplication )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S a n d r o i d E G L : : E G L )
2024-04-07 15:50:49 +02:00
# Emscripten application dependencies
elseif ( _component STREQUAL EmscriptenApplication )
# Emscripten has various stuff implemented in JS
if ( CORRADE_TARGET_EMSCRIPTEN )
find_file ( MAGNUM_PLATFORM_JS MagnumPlatform.js
P A T H _ S U F F I X E S l i b )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
# TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once
# we require CMake 3.13 unconditionally
I N T E R F A C E _ L I N K _ L I B R A R I E S " - - j s - l i b r a r y $ { M A G N U M _ P L A T F O R M _ J S } " )
endif ( )
2021-06-11 19:24:52 +02:00
# GLFW application dependencies
elseif ( _component STREQUAL GlfwApplication )
find_package ( GLFW )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S G L F W : : G L F W )
# Use the Foundation framework on Apple to query the DPI awareness
if ( CORRADE_TARGET_APPLE )
find_library ( _MAGNUM_APPLE_FOUNDATION_FRAMEWORK_LIBRARY Foundation )
mark_as_advanced ( _MAGNUM_APPLE_FOUNDATION_FRAMEWORK_LIBRARY )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { _ M A G N U M _ A P P L E _ F O U N D A T I O N _ F R A M E W O R K _ L I B R A R Y } )
# Needed for opt-in DPI queries
elseif ( CORRADE_TARGET_UNIX )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { C M A K E _ D L _ L I B S } )
endif ( )
2024-04-07 15:50:49 +02:00
# With GLVND (since CMake 3.10) we need to explicitly link to
2021-06-11 19:24:52 +02:00
# GLX/EGL because libOpenGL doesn't provide it. For EGL we have
# our own EGL find module, which makes things simpler. The
# upstream FindOpenGL is anything but simple. Also can't use
# OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
# *not* found. WTF. Also can't just check for
# OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
if ( MAGNUM_TARGET_GL )
2023-08-31 11:52:52 +02:00
if ( MAGNUM_TARGET_EGL )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND
P R O P E R T Y I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L )
elseif ( CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE )
2021-06-11 19:24:52 +02:00
find_package ( OpenGL )
if ( OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND )
set_property ( TARGET Magnum:: ${ _component } APPEND
P R O P E R T Y I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L : : G L X )
endif ( )
endif ( )
endif ( )
# SDL2 application dependencies
elseif ( _component STREQUAL Sdl2Application )
find_package ( SDL2 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S S D L 2 : : S D L 2 )
# Use the Foundation framework on Apple to query the DPI awareness
if ( CORRADE_TARGET_APPLE )
find_library ( _MAGNUM_APPLE_FOUNDATION_FRAMEWORK_LIBRARY Foundation )
mark_as_advanced ( _MAGNUM_APPLE_FOUNDATION_FRAMEWORK_LIBRARY )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { _ M A G N U M _ A P P L E _ F O U N D A T I O N _ F R A M E W O R K _ L I B R A R Y } )
# Needed for opt-in DPI queries
elseif ( CORRADE_TARGET_UNIX )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { C M A K E _ D L _ L I B S } )
2024-04-07 15:50:49 +02:00
# Emscripten has various stuff implemented in JS
elseif ( CORRADE_TARGET_EMSCRIPTEN )
find_file ( MAGNUM_PLATFORM_JS MagnumPlatform.js
P A T H _ S U F F I X E S l i b )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
# TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once
# we require CMake 3.13 unconditionally
I N T E R F A C E _ L I N K _ L I B R A R I E S " - - j s - l i b r a r y $ { M A G N U M _ P L A T F O R M _ J S } " )
2021-06-11 19:24:52 +02:00
endif ( )
2024-04-07 15:50:49 +02:00
# With GLVND (since CMake 3.10) we need to explicitly link to
2021-06-11 19:24:52 +02:00
# GLX/EGL because libOpenGL doesn't provide it. For EGL we have
# our own EGL find module, which makes things simpler. The
# upstream FindOpenGL is anything but simple. Also can't use
# OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
# *not* found. WTF. Also can't just check for
# OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
if ( MAGNUM_TARGET_GL )
2023-08-31 11:52:52 +02:00
if ( MAGNUM_TARGET_EGL )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND
P R O P E R T Y I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L )
elseif ( CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE )
2021-06-11 19:24:52 +02:00
find_package ( OpenGL )
if ( OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND )
set_property ( TARGET Magnum:: ${ _component } APPEND
P R O P E R T Y I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L : : G L X )
endif ( )
endif ( )
endif ( )
# (Windowless) GLX application dependencies
elseif ( _component STREQUAL GlxApplication OR _component STREQUAL WindowlessGlxApplication )
find_package ( X11 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S $ { X 1 1 _ I N C L U D E _ D I R } )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { X 1 1 _ L I B R A R I E S } )
2024-04-07 15:50:49 +02:00
# With GLVND (since CMake 3.10) we need to explicitly link to
2021-06-11 19:24:52 +02:00
# GLX because libOpenGL doesn't provide it. Also can't use
# OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
# *not* found. WTF. Also can't just check for
# OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
2024-04-07 15:50:49 +02:00
#
# If MAGNUM_TARGET_GLES and MAGNUM_TARGET_EGL is set, these
# applications can be built only if GLVND is available as
# otherwise there would be a conflict between libGL and
# libGLES. Thus, if GLVND is not available, it won't link
# libGLX here, but that shouldn't be a problem since the
# application library won't exist either.
2021-06-11 19:24:52 +02:00
find_package ( OpenGL )
if ( OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L : : G L X )
endif ( )
# Windowless CGL application has no additional dependencies
# Windowless EGL application dependencies
elseif ( _component STREQUAL WindowlessEglApplication )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L )
# Windowless iOS application dependencies
elseif ( _component STREQUAL WindowlessIosApplication )
# We need to link to Foundation framework to use ObjC
find_library ( _MAGNUM_IOS_FOUNDATION_FRAMEWORK_LIBRARY Foundation )
mark_as_advanced ( _MAGNUM_IOS_FOUNDATION_FRAMEWORK_LIBRARY )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L $ { _ M A G N U M _ I O S _ F O U N D A T I O N _ F R A M E W O R K _ L I B R A R Y } )
# Windowless WGL application has no additional dependencies
# X/EGL application dependencies
elseif ( _component STREQUAL XEglApplication )
find_package ( EGL )
find_package ( X11 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S $ { X 1 1 _ I N C L U D E _ D I R } )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L $ { X 1 1 _ L I B R A R I E S } )
endif ( )
# Context libraries
elseif ( _component MATCHES ".+Context" )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Platform )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES GLContext.h )
# GLX context dependencies
if ( _component STREQUAL GlxContext )
2024-04-07 15:50:49 +02:00
# With GLVND (since CMake 3.10) we need to explicitly link to
2021-06-11 19:24:52 +02:00
# GLX because libOpenGL doesn't provide it. Also can't use
# OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
# *not* found. If GLVND is not used, link to X11 instead. Also
# can't just check for OPENGL_opengl_LIBRARY because that's set
# even if OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
find_package ( OpenGL )
if ( OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L : : G L X )
else ( )
find_package ( X11 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S $ { X 1 1 _ I N C L U D E _ D I R } )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { X 1 1 _ L I B R A R I E S } )
endif ( )
# EGL context dependencies
elseif ( _component STREQUAL EglContext )
find_package ( EGL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S E G L : : E G L )
endif ( )
# No additional dependencies for CGL context
# No additional dependencies for WGL context
# Audio library
elseif ( _component STREQUAL Audio )
find_package ( OpenAL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
2023-08-31 11:52:52 +02:00
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n A L : : O p e n A L )
2021-06-11 19:24:52 +02:00
# No special setup for DebugTools library
# GL library
elseif ( _component STREQUAL GL )
2023-08-31 11:52:52 +02:00
if ( NOT MAGNUM_TARGET_GLES OR ( MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS ) )
2024-04-07 15:50:49 +02:00
# If the GLVND library (CMake 3.10+) was found, link to the
2021-06-11 19:24:52 +02:00
# imported target. Otherwise (and also on all systems except
# Linux) link to the classic libGL. Can't use
# OpenGL_OpenGL_FOUND, because that one is set also if GLVND is
# *not* found. WTF. Also can't just check for
# OPENGL_opengl_LIBRARY because that's set even if
# OpenGL_GL_PREFERENCE is explicitly set to LEGACY.
find_package ( OpenGL REQUIRED )
if ( OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L : : O p e n G L )
else ( )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S $ { O P E N G L _ g l _ L I B R A R Y } )
endif ( )
elseif ( MAGNUM_TARGET_GLES2 )
find_package ( OpenGLES2 REQUIRED )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L E S 2 : : O p e n G L E S 2 )
2024-04-07 15:50:49 +02:00
else ( )
2021-06-11 19:24:52 +02:00
find_package ( OpenGLES3 REQUIRED )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S O p e n G L E S 3 : : O p e n G L E S 3 )
endif ( )
2023-08-31 11:52:52 +02:00
# MaterialTools library
elseif ( _component STREQUAL MaterialTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES PhongToPbrMetallicRoughness.h )
2021-06-11 19:24:52 +02:00
# MeshTools library
elseif ( _component STREQUAL MeshTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES CompressIndices.h )
# OpenGLTester library
elseif ( _component STREQUAL OpenGLTester )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/GL )
# VulkanTester library
elseif ( _component STREQUAL VulkanTester )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_SUFFIX Magnum/Vk )
# Primitives library
elseif ( _component STREQUAL Primitives )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Cube.h )
# No special setup for SceneGraph library
2023-08-31 11:52:52 +02:00
# SceneTools library
elseif ( _component STREQUAL SceneTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Hierarchy.h )
2021-06-11 19:24:52 +02:00
2023-08-31 11:52:52 +02:00
# No special setup for ShaderTools library
2021-06-11 19:24:52 +02:00
# No special setup for Shaders library
2023-08-31 11:52:52 +02:00
# No special setup for Text library
2021-06-11 19:24:52 +02:00
# TextureTools library
elseif ( _component STREQUAL TextureTools )
set ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_PATH_NAMES Atlas.h )
2023-08-31 11:52:52 +02:00
# No special setup for Trade library
2021-06-11 19:24:52 +02:00
# Vk library
elseif ( _component STREQUAL Vk )
find_package ( Vulkan REQUIRED )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S V u l k a n : : V u l k a n )
endif ( )
# No special setup for AnyAudioImporter plugin
# No special setup for AnyImageConverter plugin
# No special setup for AnyImageImporter plugin
# No special setup for AnySceneImporter plugin
# No special setup for MagnumFont plugin
# No special setup for MagnumFontConverter plugin
# No special setup for ObjImporter plugin
# No special setup for TgaImageConverter plugin
# No special setup for TgaImporter plugin
# No special setup for WavAudioImporter plugin
# Find library/plugin includes
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
find_path ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR
N A M E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ N A M E S }
H I N T S $ { M A G N U M _ I N C L U D E _ D I R } / $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ P A T H _ S U F F I X } )
mark_as_advanced ( _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR )
endif ( )
# Automatic import of static plugins. Skip in case the include dir was
2023-08-31 11:52:52 +02:00
# not found -- that'll fail later with a proper message. Skip it also
# if the include dir doesn't contain the generated configure.h, which
# is the case with Magnum as a subproject and given plugin not enabled
# -- there it finds just the sources, where's just configure.h.cmake,
# and that's not useful for anything. The assumption here is that it
# will fail later anyway on the binary not being found.
if ( _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR AND EXISTS ${ _MAGNUM_${_COMPONENT } _INCLUDE_DIR}/configure.h )
2021-06-11 19:24:52 +02:00
# Automatic import of static plugins
file ( READ ${ _MAGNUM_${_COMPONENT } _INCLUDE_DIR}/configure.h _magnum ${ _component } Configure )
string ( FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum ${ _component } _BUILD_STATIC )
if ( NOT _magnum ${ _component } _BUILD_STATIC EQUAL -1 )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ S O U R C E S $ { _ M A G N U M _ $ { _ C O M P O N E N T } _ I N C L U D E _ D I R } / i m p o r t S t a t i c P l u g i n . c p p )
endif ( )
endif ( )
# Link to core Magnum library, add inter-library dependencies. If there
# are optional dependencies, defer adding them to later once we know if
# they were found or not.
if ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS )
2023-08-31 11:52:52 +02:00
foreach ( _dependency ${ _MAGNUM_${_component } _CORRADE_DEPENDENCIES} )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S C o r r a d e : : $ { _ d e p e n d e n c y } )
endforeach ( )
2021-06-11 19:24:52 +02:00
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S M a g n u m : : M a g n u m )
2024-04-07 15:50:49 +02:00
set ( _MAGNUM_ ${ _component } _OPTIONAL_DEPENDENCIES_TO_ADD )
2021-06-11 19:24:52 +02:00
foreach ( _dependency ${ _MAGNUM_${_component } _DEPENDENCIES} )
if ( NOT _MAGNUM_ ${ _component } _ ${ _dependency } _DEPENDENCY_IS_OPTIONAL )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S M a g n u m : : $ { _ d e p e n d e n c y } )
else ( )
list ( APPEND _MAGNUM_ ${ _component } _OPTIONAL_DEPENDENCIES_TO_ADD
$ { _ d e p e n d e n c y } )
endif ( )
endforeach ( )
if ( _MAGNUM_ ${ _component } _OPTIONAL_DEPENDENCIES_TO_ADD )
list ( APPEND _MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD ${ _component } )
endif ( )
endif ( )
# Decide if the library was found
if ( ( ( _component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS ) AND _MAGNUM_ ${ _COMPONENT } _INCLUDE_DIR AND ( MAGNUM_ ${ _COMPONENT } _LIBRARY_DEBUG OR MAGNUM_ ${ _COMPONENT } _LIBRARY_RELEASE ) ) OR ( _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS AND MAGNUM_ ${ _COMPONENT } _EXECUTABLE ) )
set ( Magnum_ ${ _component } _FOUND TRUE )
else ( )
set ( Magnum_ ${ _component } _FOUND FALSE )
endif ( )
endif ( )
# Global aliases for Windowless*Application, *Application and *Context
# components. If already set, unset them to avoid ambiguity.
if ( _component MATCHES "Windowless.+Application" )
if ( NOT DEFINED _MAGNUM_WINDOWLESSAPPLICATION_ALIAS )
set ( _MAGNUM_WINDOWLESSAPPLICATION_ALIAS Magnum:: ${ _component } )
else ( )
unset ( _MAGNUM_WINDOWLESSAPPLICATION_ALIAS )
endif ( )
elseif ( _component MATCHES ".+Application" )
if ( NOT DEFINED _MAGNUM_APPLICATION_ALIAS )
set ( _MAGNUM_APPLICATION_ALIAS Magnum:: ${ _component } )
else ( )
unset ( _MAGNUM_APPLICATION_ALIAS )
endif ( )
elseif ( _component MATCHES ".+Context" )
if ( NOT DEFINED _MAGNUM_GLCONTEXT_ALIAS )
set ( _MAGNUM_GLCONTEXT_ALIAS Magnum:: ${ _component } )
else ( )
unset ( _MAGNUM_GLCONTEXT_ALIAS )
endif ( )
endif ( )
endforeach ( )
# Emscripten-specific files and flags
if ( CORRADE_TARGET_EMSCRIPTEN )
find_file ( MAGNUM_EMSCRIPTENAPPLICATION_JS EmscriptenApplication.js
P A T H _ S U F F I X E S s h a r e / m a g n u m )
find_file ( MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS WindowlessEmscriptenApplication.js
P A T H _ S U F F I X E S s h a r e / m a g n u m )
find_file ( MAGNUM_WEBAPPLICATION_CSS WebApplication.css
P A T H _ S U F F I X E S s h a r e / m a g n u m )
mark_as_advanced (
M A G N U M _ E M S C R I P T E N A P P L I C A T I O N _ J S
M A G N U M _ W I N D O W L E S S E M S C R I P T E N A P P L I C A T I O N _ J S
M A G N U M _ W E B A P P L I C A T I O N _ C S S )
set ( MAGNUM_EXTRAS_NEEDED
M A G N U M _ E M S C R I P T E N A P P L I C A T I O N _ J S
M A G N U M _ W I N D O W L E S S E M S C R I P T E N A P P L I C A T I O N _ J S
M A G N U M _ W E B A P P L I C A T I O N _ C S S )
endif ( )
# 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 ( _MAGNUM_REASON_FAILURE_MESSAGE )
# Go only through the originally specified find_package() components, not
# the dependencies added by us afterwards
foreach ( _component ${ _MAGNUM_ORIGINAL_FIND_COMPONENTS } )
if ( Magnum_ ${ _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 _MAGNUM_LIBRARY_COMPONENTS AND NOT _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND NOT _component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS )
list ( APPEND _MAGNUM_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 _MAGNUM_IMPLICITLY_ENABLED_COMPONENTS )
string ( TOUPPER ${ _component } _COMPONENT )
2023-08-31 11:52:52 +02:00
list ( APPEND _MAGNUM_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum." )
2021-06-11 19:24:52 +02:00
# Otherwise we have no idea. Better be silent than to print something
# misleading.
else ( )
endif ( )
endforeach ( )
string ( REPLACE ";" " " _MAGNUM_REASON_FAILURE_MESSAGE "${_MAGNUM_REASON_FAILURE_MESSAGE}" )
set ( _MAGNUM_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_MAGNUM_REASON_FAILURE_MESSAGE}" )
endif ( )
# Complete the check with also all components
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( Magnum
R E Q U I R E D _ V A R S M A G N U M _ I N C L U D E _ D I R M A G N U M _ L I B R A R Y $ { M A G N U M _ E X T R A S _ N E E D E D }
H A N D L E _ C O M P O N E N T S
$ { _ M A G N U M _ R E A S O N _ F A I L U R E _ M E S S A G E } )
# Components with optional dependencies -- add them once we know if they were
# found or not.
foreach ( _component ${ _MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD } )
foreach ( _dependency ${ _MAGNUM_${_component } _OPTIONAL_DEPENDENCIES_TO_ADD} )
if ( Magnum_ ${ _dependency } _FOUND )
set_property ( TARGET Magnum:: ${ _component } APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S M a g n u m : : $ { _ d e p e n d e n c y } )
endif ( )
endforeach ( )
endforeach ( )
# Create Windowless*Application, *Application and *Context aliases
# TODO: ugh why can't I make an alias of IMPORTED target?
if ( _MAGNUM_WINDOWLESSAPPLICATION_ALIAS AND NOT TARGET Magnum::WindowlessApplication )
get_target_property ( _MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET ${ _MAGNUM_WINDOWLESSAPPLICATION_ALIAS } ALIASED_TARGET )
if ( _MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET )
add_library ( Magnum::WindowlessApplication ALIAS ${ _MAGNUM_WINDOWLESSAPPLICATION_ALIASED_TARGET } )
else ( )
add_library ( Magnum::WindowlessApplication UNKNOWN IMPORTED )
foreach ( property IMPORTED_CONFIGURATIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_LIBRARIES )
get_target_property ( _MAGNUM_WINDOWLESSAPPLICATION_ ${ property } ${ _MAGNUM_WINDOWLESSAPPLICATION_ALIAS } ${ property } )
if ( _MAGNUM_WINDOWLESSAPPLICATION_ ${ property } )
set_target_properties ( Magnum::WindowlessApplication PROPERTIES
$ { p r o p e r t y } " $ { _ M A G N U M _ W I N D O W L E S S A P P L I C A T I O N _ $ { p r o p e r t y } } " )
endif ( )
endforeach ( )
get_target_property ( _MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_RELEASE ${ _MAGNUM_WINDOWLESSAPPLICATION_ALIAS } IMPORTED_LOCATION_RELEASE )
get_target_property ( _MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG ${ _MAGNUM_WINDOWLESSAPPLICATION_ALIAS } IMPORTED_LOCATION_DEBUG )
if ( _MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_RELEASE )
set_target_properties ( Magnum::WindowlessApplication PROPERTIES
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { _ M A G N U M _ W I N D O W L E S S A P P L I C A T I O N _ I M P O R T E D _ L O C A T I O N _ R E L E A S E } )
endif ( )
if ( _MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG )
set_target_properties ( Magnum::WindowlessApplication PROPERTIES
I M P O R T E D _ L O C A T I O N _ D E B U G $ { _ M A G N U M _ W I N D O W L E S S A P P L I C A T I O N _ I M P O R T E D _ L O C A T I O N _ D E B U G } )
endif ( )
endif ( )
# Prevent creating the alias again
unset ( _MAGNUM_WINDOWLESSAPPLICATION_ALIAS )
endif ( )
if ( _MAGNUM_APPLICATION_ALIAS AND NOT TARGET Magnum::Application )
get_target_property ( _MAGNUM_APPLICATION_ALIASED_TARGET ${ _MAGNUM_APPLICATION_ALIAS } ALIASED_TARGET )
if ( _MAGNUM_APPLICATION_ALIASED_TARGET )
add_library ( Magnum::Application ALIAS ${ _MAGNUM_APPLICATION_ALIASED_TARGET } )
else ( )
add_library ( Magnum::Application UNKNOWN IMPORTED )
foreach ( property IMPORTED_CONFIGURATIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_LIBRARIES )
get_target_property ( _MAGNUM_APPLICATION_ ${ property }
$ { _ M A G N U M _ A P P L I C A T I O N _ A L I A S } $ { p r o p e r t y } )
if ( _MAGNUM_APPLICATION_ ${ property } )
set_target_properties ( Magnum::Application PROPERTIES ${ property }
" $ { _ M A G N U M _ A P P L I C A T I O N _ $ { p r o p e r t y } } " )
endif ( )
endforeach ( )
get_target_property ( _MAGNUM_APPLICATION_IMPORTED_LOCATION_RELEASE ${ _MAGNUM_APPLICATION_ALIAS } IMPORTED_LOCATION_RELEASE )
get_target_property ( _MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG ${ _MAGNUM_APPLICATION_ALIAS } IMPORTED_LOCATION_DEBUG )
if ( _MAGNUM_APPLICATION_IMPORTED_LOCATION_RELEASE )
set_target_properties ( Magnum::Application PROPERTIES
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { _ M A G N U M _ A P P L I C A T I O N _ I M P O R T E D _ L O C A T I O N _ R E L E A S E } )
endif ( )
if ( _MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG )
set_target_properties ( Magnum::Application PROPERTIES
I M P O R T E D _ L O C A T I O N _ D E B U G $ { _ M A G N U M _ A P P L I C A T I O N _ I M P O R T E D _ L O C A T I O N _ D E B U G } )
endif ( )
endif ( )
# Prevent creating the alias again
unset ( _MAGNUM_APPLICATION_ALIAS )
endif ( )
if ( _MAGNUM_GLCONTEXT_ALIAS AND NOT TARGET Magnum::GLContext )
get_target_property ( _MAGNUM_GLCONTEXT_ALIASED_TARGET ${ _MAGNUM_GLCONTEXT_ALIAS } ALIASED_TARGET )
if ( _MAGNUM_GLCONTEXT_ALIASED_TARGET )
add_library ( Magnum::GLContext ALIAS ${ _MAGNUM_GLCONTEXT_ALIASED_TARGET } )
else ( )
add_library ( Magnum::GLContext UNKNOWN IMPORTED )
foreach ( property IMPORTED_CONFIGURATIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_LIBRARIES )
get_target_property ( _MAGNUM_GLCONTEXT_ ${ property } ${ _MAGNUM_GLCONTEXT_ALIAS } ${ property } )
if ( _MAGNUM_GLCONTEXT_ ${ property } )
set_target_properties ( Magnum::GLContext PROPERTIES ${ property }
" $ { _ M A G N U M _ G L C O N T E X T _ $ { p r o p e r t y } } " )
endif ( )
endforeach ( )
get_target_property ( _MAGNUM_GLCONTEXT_IMPORTED_LOCATION_RELEASE ${ _MAGNUM_GLCONTEXT_ALIAS } IMPORTED_LOCATION_RELEASE )
get_target_property ( _MAGNUM_GLCONTEXT_IMPORTED_LOCATION_DEBUG ${ _MAGNUM_GLCONTEXT_ALIAS } IMPORTED_LOCATION_DEBUG )
if ( _MAGNUM_GLCONTEXT_IMPORTED_LOCATION_RELEASE )
set_target_properties ( Magnum::GLContext PROPERTIES
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { _ M A G N U M _ G L C O N T E X T _ I M P O R T E D _ L O C A T I O N _ R E L E A S E } )
endif ( )
if ( _MAGNUM_GLCONTEXT_IMPORTED_LOCATION_DEBUG )
set_target_properties ( Magnum::GLContext PROPERTIES
I M P O R T E D _ L O C A T I O N _ D E B U G $ { _ M A G N U M _ G L C O N T E X T _ I M P O R T E D _ L O C A T I O N _ D E B U G } )
endif ( )
endif ( )
# Prevent creating the alias again
unset ( _MAGNUM_GLCONTEXT_ALIAS )
endif ( )
# Installation and deploy dirs
set ( MAGNUM_DEPLOY_PREFIX "."
C A C H E S T R I N G " P r e f i x w h e r e t o p u t f i n a l a p p l i c a t i o n e x e c u t a b l e s " )
include ( ${ CORRADE_LIB_SUFFIX_MODULE } )
set ( MAGNUM_BINARY_INSTALL_DIR bin )
set ( MAGNUM_LIBRARY_INSTALL_DIR lib ${ LIB_SUFFIX } )
set ( MAGNUM_DATA_INSTALL_DIR share/magnum )
set ( MAGNUM_INCLUDE_INSTALL_DIR include/Magnum )
set ( MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR include/MagnumExternal )
set ( MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR include/MagnumPlugins )
if ( MAGNUM_BUILD_DEPRECATED AND MAGNUM_INCLUDE_INSTALL_PREFIX AND NOT MAGNUM_INCLUDE_INSTALL_PREFIX STREQUAL "." )
message ( DEPRECATION "MAGNUM_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 ( MAGNUM_DATA_INSTALL_DIR ${ MAGNUM_INCLUDE_INSTALL_PREFIX } / ${ MAGNUM_DATA_INSTALL_DIR } )
set ( MAGNUM_INCLUDE_INSTALL_DIR ${ MAGNUM_INCLUDE_INSTALL_PREFIX } / ${ MAGNUM_INCLUDE_INSTALL_DIR } )
set ( MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${ MAGNUM_INCLUDE_INSTALL_PREFIX } / ${ MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR } )
set ( MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${ MAGNUM_INCLUDE_INSTALL_PREFIX } / ${ MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR } )
endif ( )
set ( MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_BINARY_INSTALL_DIR } /magnum-d )
set ( MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_LIBRARY_INSTALL_DIR } /magnum-d )
set ( MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_BINARY_INSTALL_DIR } /magnum )
set ( MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_LIBRARY_INSTALL_DIR } /magnum )
set ( MAGNUM_PLUGINS_SHADERCONVERTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /shaderconverters )
set ( MAGNUM_PLUGINS_SHADERCONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /shaderconverters )
set ( MAGNUM_PLUGINS_SHADERCONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /shaderconverters )
set ( MAGNUM_PLUGINS_SHADERCONVERTER_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /shaderconverters )
set ( MAGNUM_PLUGINS_FONT_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONT_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONT_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONT_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /fontconverters )
set ( MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /fontconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMPORTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /importers )
set ( MAGNUM_PLUGINS_IMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /importers )
set ( MAGNUM_PLUGINS_IMPORTER_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /importers )
set ( MAGNUM_PLUGINS_IMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /importers )
set ( MAGNUM_PLUGINS_SCENECONVERTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_SCENECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR } /audioimporters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR } /audioimporters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_BINARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR } /audioimporters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${ MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR } /audioimporters )
# Get base plugin directory from main library location. This is *not* PATH,
# because CMake always converts the path to an absolute location internally,
# making it impossible to specify relative paths there. Sorry in advance for
# not having the dir selection button in CMake GUI.
set ( MAGNUM_PLUGINS_DEBUG_DIR ""
C A C H E S T R I N G " B a s e d i r e c t o r y w h e r e t o l o o k f o r M a g n u m p l u g i n s f o r d e b u g b u i l d s " )
set ( MAGNUM_PLUGINS_RELEASE_DIR ""
C A C H E S T R I N G " B a s e d i r e c t o r y w h e r e t o l o o k f o r M a g n u m p l u g i n s f o r r e l e a s e b u i l d s " )
set ( MAGNUM_PLUGINS_DIR ""
C A C H E S T R I N G " B a s e d i r e c t o r y w h e r e t o l o o k f o r M a g n u m p l u g i n s " )
# Plugin directories. Set only if the above are non-empty. otherwise empty as
# well.
if ( MAGNUM_PLUGINS_DIR )
set ( MAGNUM_PLUGINS_FONT_DIR ${ MAGNUM_PLUGINS_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONTCONVERTER_DIR ${ MAGNUM_PLUGINS_DIR } /fontconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${ MAGNUM_PLUGINS_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMPORTER_DIR ${ MAGNUM_PLUGINS_DIR } /importers )
set ( MAGNUM_PLUGINS_SCENECONVERTER_DIR ${ MAGNUM_PLUGINS_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${ MAGNUM_PLUGINS_DIR } /audioimporters )
endif ( )
if ( MAGNUM_PLUGINS_DEBUG_DIR )
set ( MAGNUM_PLUGINS_FONT_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /fonts )
set ( MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /fontconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /importers )
set ( MAGNUM_PLUGINS_FONT_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /fonts )
set ( MAGNUM_PLUGINS_SCENECONVERTER_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${ MAGNUM_PLUGINS_DEBUG_DIR } /audioimporters )
endif ( )
if ( MAGNUM_PLUGINS_RELEASE_DIR )
set ( MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /fontconverters )
set ( MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /imageconverters )
set ( MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /importers )
set ( MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /sceneconverters )
set ( MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${ MAGNUM_PLUGINS_RELEASE_DIR } /audioimporters )
endif ( )
2024-04-07 15:50:49 +02:00
# Resets CMake policies set at the top of the file to not affect other code.
cmake_policy ( POP )