diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index 8a5fd6f..7d2e725 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -11,14 +11,13 @@ # # Corrade_FOUND - Whether the base library was found # CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module -# CORRADE_INCLUDE_INSTALL_PREFIX - Prefix where to put platform-independent -# include and other files, defaults to ``.``. If a relative path is used, -# it's relative to :variable:`CMAKE_INSTALL_PREFIX`. # # 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 @@ -65,13 +64,13 @@ # # Features of found Corrade library are exposed in these variables: # -# CORRADE_MSVC2019_COMPATIBILITY - Defined if compiled with compatibility -# mode for MSVC 2019 +# 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 APIs +# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated features # included # CORRADE_BUILD_STATIC - Defined if compiled as static libraries. # Default are shared libraries. @@ -79,8 +78,11 @@ # 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 simultaenously in multiple +# 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 @@ -101,9 +103,11 @@ # 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 targetting Xcode +# 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 @@ -118,20 +122,16 @@ # automatically) # 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 -# -# Workflows without :prop_tgt:`IMPORTED` targets are deprecated and the -# following variables are included just for backwards compatibility and only if -# :variable:`CORRADE_BUILD_DEPRECATED` is enabled: -# -# CORRADE_CXX_FLAGS - Pedantic compile flags. Use -# :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` property or -# :variable:`CORRADE_PEDANTIC_COMPILER_DEFINITIONS` / -# :variable:`CORRADE_PEDANTIC_COMPILER_OPTIONS` list variables instead. +# 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: # @@ -216,7 +216,7 @@ # # ...) # -# Unline the above version this puts everything into ```` on +# Unlike the above version this puts everything into ```` on # both DLL and non-DLL platforms. If ```` 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 @@ -272,7 +272,8 @@ # This file is part of Corrade. # # Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, -# 2017, 2018, 2019, 2020 Vladimír Vondruš +# 2017, 2018, 2019, 2020, 2021, 2022, 2023 +# Vladimír Vondruš # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -319,11 +320,12 @@ string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}") set(_corradeFlags MSVC2015_COMPATIBILITY MSVC2017_COMPATIBILITY - MSVC2019_COMPATIBILITY + MSVC_COMPATIBILITY BUILD_DEPRECATED BUILD_STATIC BUILD_STATIC_UNIQUE_GLOBALS BUILD_MULTITHREADED + BUILD_CPU_RUNTIME_DISPATCH TARGET_UNIX TARGET_APPLE TARGET_IOS @@ -332,10 +334,12 @@ set(_corradeFlags TARGET_WINDOWS_RT TARGET_EMSCRIPTEN TARGET_ANDROID - # TARGET_X86 etc and TARGET_LIBCXX 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. + # 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) @@ -355,40 +359,47 @@ mark_as_advanced(_CORRADE_MODULE_DIR) 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) +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}) - string(TOUPPER ${_component} _COMPONENT) - - if(_component STREQUAL Containers) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) - elseif(_component STREQUAL Interconnect) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) - elseif(_component STREQUAL PluginManager) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers Utility rc) - elseif(_component STREQUAL TestSuite) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility Main) # see below - elseif(_component STREQUAL Utility) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers rc) - endif() - # Mark the dependencies as required if the component is also required if(Corrade_FIND_REQUIRED_${_component}) - foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) + foreach(_dependency ${_CORRADE_${_component}_DEPENDENCIES}) set(Corrade_FIND_REQUIRED_${_dependency} TRUE) endforeach() endif() - list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) - - # 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 - if(_component STREQUAL TestSuite) - set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) - 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() @@ -396,16 +407,6 @@ if(Corrade_FIND_COMPONENTS) list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS) endif() -# Component distinction -set(_CORRADE_LIBRARY_COMPONENTS "^(Containers|Interconnect|Main|PluginManager|TestSuite|Utility)$") -if(CORRADE_TARGET_WINDOWS) - # CorradeMain is a real library only on windows, a dummy target elsewhere - set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers)$") -else() - set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers|Main)$") -endif() -set(_CORRADE_EXECUTABLE_COMPONENTS "^(rc)$") - # Find all components foreach(_component ${Corrade_FIND_COMPONENTS}) string(TOUPPER ${_component} _COMPONENT) @@ -416,8 +417,10 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) if(TARGET Corrade::${_component}) set(Corrade_${_component}_FOUND TRUE) else() + unset(Corrade_${_component}_FOUND) + # Library (and not header-only) components - if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) + if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) add_library(Corrade::${_component} UNKNOWN IMPORTED) # Try to find both debug and release version @@ -442,19 +445,19 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) endif() # Header-only library components - if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) + if(_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) add_library(Corrade::${_component} INTERFACE IMPORTED) endif() # Default include path names to look for for library / header-only # components - if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) + if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS) set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade/${_component}) set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h) endif() # Executable components - if(_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS}) + if(_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS) add_executable(Corrade::${_component} IMPORTED) find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component}) @@ -471,8 +474,9 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) # Interconnect library if(_component STREQUAL Interconnect) # Disable /OPT:ICF on MSVC, which merges functions with identical - # contents and thus breaks signal comparison - if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # 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") @@ -506,25 +510,33 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) elseif(_component STREQUAL PluginManager) # -ldl is handled by Utility now - # TestSuite library has some additional files + # 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) - set(CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED CORRADE_TESTSUITE_XCTEST_RUNNER) + 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) - set(CORRADE_TESTSUITE_ADB_RUNNER_NEEDED CORRADE_TESTSUITE_ADB_RUNNER) + 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) - set(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER) + if(NOT CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER) + set(Corrade_${_component}_FOUND FALSE) + endif() endif() # Utility library (contains all setup that is used by others) @@ -539,7 +551,7 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) set_property(TARGET Corrade::${_component} APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD) - # Directory::libraryLocation() needs this + # Path::libraryLocation() needs this if(CORRADE_TARGET_UNIX) set_property(TARGET Corrade::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) @@ -549,10 +561,19 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) 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() # Find library includes - if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) + 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}) @@ -560,39 +581,74 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) endif() # Add inter-library dependencies - if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) - foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) - if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) + 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() - # Decide if the component was found - if((_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS} OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS} AND CORRADE_${_COMPONENT}_EXECUTABLE)) - set(Corrade_${_component}_FOUND TRUE) - else() - set(Corrade_${_component}_FOUND FALSE) + # Decide if the component was found, unless the _FOUND is already set + # by something above. + if(NOT DEFINED Corrade_${_component}_FOUND) + if((_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS AND CORRADE_${_COMPONENT}_EXECUTABLE)) + set(Corrade_${_component}_FOUND TRUE) + else() + set(Corrade_${_component}_FOUND FALSE) + endif() 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 - ${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED} - ${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED} - ${CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED} - HANDLE_COMPONENTS) + HANDLE_COMPONENTS + ${_CORRADE_REASON_FAILURE_MESSAGE}) # Finalize the finding process include(${CORRADE_USE_MODULE}) -# Installation dirs -set(CORRADE_INCLUDE_INSTALL_PREFIX "." - CACHE STRING "Prefix where to put platform-independent include and other files") +set(CORRADE_INCLUDE_INSTALL_DIR include/Corrade) -set(CORRADE_INCLUDE_INSTALL_DIR ${CORRADE_INCLUDE_INSTALL_PREFIX}/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() diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 8761448..5662389 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -13,9 +13,6 @@ # 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_INCLUDE_INSTALL_PREFIX - Prefix where to put platform-independent -# include and other files, 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 @@ -60,10 +57,13 @@ # Audio - Audio library # DebugTools - DebugTools library # GL - GL library +# MaterialTools - MaterialTools library # MeshTools - MeshTools library # Primitives - Primitives library # SceneGraph - SceneGraph library +# SceneTools - SceneTools library # Shaders - Shaders library +# ShaderTools - ShaderTools library # Text - Text library # TextureTools - TextureTools library # Trade - Trade library @@ -79,12 +79,12 @@ # WindowlessGlxApplication - Windowless GLX application # WindowlessIosApplication - Windowless iOS application # WindowlessWglApplication - Windowless WGL application -# WindowlessWindowsEglApplication - Windowless Windows/EGL 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 @@ -95,7 +95,9 @@ # 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:: @@ -126,7 +128,7 @@ # # Features of found Magnum library are exposed in these variables: # -# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated APIs +# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated features # included # MAGNUM_BUILD_STATIC - Defined if compiled as static libraries # MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS - Defined if static libraries keep the @@ -135,10 +137,9 @@ # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES # MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 # MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 -# MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES -# emulation on desktop OpenGL # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL -# MAGNUM_TARGET_HEADLESS - Defined if compiled for headless machines +# MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a +# platform-specific OpenGL support library like CGL, EAGL, GLX or WGL # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop # # The following variables are provided for backwards compatibility purposes @@ -147,6 +148,10 @@ # # MAGNUM_BUILD_MULTITHREADED - Alias to CORRADE_BUILD_MULTITHREADED. Use # CORRADE_BUILD_MULTITHREADED instead. +# 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. # # Additionally these variables are defined for internal usage: # @@ -157,6 +162,7 @@ # 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 +# MAGNUM_PLATFORM_JS - Path to MagnumPlatform.js file # MAGNUM_BINARY_INSTALL_DIR - Binary installation directory # MAGNUM_LIBRARY_INSTALL_DIR - Library installation directory # MAGNUM_DATA_INSTALL_DIR - Data installation directory @@ -164,6 +170,10 @@ # 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 @@ -196,7 +206,7 @@ # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, -# 2020 Vladimír Vondruš +# 2020, 2021, 2022, 2023 Vladimír Vondruš # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -217,18 +227,37 @@ # DEALINGS IN THE SOFTWARE. # +# 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() + # Corrade library dependencies set(_MAGNUM_CORRADE_DEPENDENCIES ) -foreach(_component ${Magnum_FIND_COMPONENTS}) - string(TOUPPER ${_component} _COMPONENT) +foreach(_magnum_component ${Magnum_FIND_COMPONENTS}) + set(_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES ) # Unrolling the transitive dependencies here so this doesn't need to be # after resolving inter-component dependencies. Listing also all plugins. - if(_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font)$") - set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager) + 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() endif() - list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES}) + list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES}) endforeach() find_package(Corrade REQUIRED Utility ${_MAGNUM_CORRADE_DEPENDENCIES}) @@ -263,9 +292,8 @@ set(_magnumFlags TARGET_GLES TARGET_GLES2 TARGET_GLES3 - TARGET_DESKTOP_GLES TARGET_WEBGL - TARGET_HEADLESS + TARGET_EGL TARGET_VK) foreach(_magnumFlag ${_magnumFlags}) list(FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag}) @@ -274,17 +302,20 @@ foreach(_magnumFlag ${_magnumFlags}) endif() endforeach() -# For compatibility only, to be removed at some point -if(MAGNUM_BUILD_DEPRECATED AND CORRADE_BUILD_MULTITHREADED) - set(MAGNUM_BUILD_MULTITHREADED 1) -endif() - -# OpenGL library preference. Prefer to use GLVND, since that's the better -# approach nowadays, but allow the users to override it from outside in case -# it is broken for some reason (Nvidia drivers in Debian's testing (Buster) -- -# reported on 2019-04-09). -if(NOT CMAKE_VERSION VERSION_LESS 3.10 AND NOT OpenGL_GL_PREFERENCE) - set(OpenGL_GL_PREFERENCE GLVND) +# 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() endif() # Base Magnum library @@ -338,12 +369,6 @@ if(NOT TARGET Magnum::Magnum) # Include directories set_property(TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MAGNUM_INCLUDE_DIR}) - # Some deprecated APIs use headers (but not externally defined symbols) - # from the GL library, link those includes as well - if(MAGNUM_BUILD_DEPRECATED AND MAGNUM_TARGET_GL) - set_property(TARGET Magnum::Magnum APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${MAGNUM_INCLUDE_DIR}/MagnumExternal/OpenGL) - endif() # Dependent libraries set_property(TARGET Magnum::Magnum APPEND PROPERTY INTERFACE_LINK_LIBRARIES @@ -354,22 +379,52 @@ endif() # Component distinction (listing them explicitly to avoid mistakes with finding # components from other repositories) -set(_MAGNUM_LIBRARY_COMPONENT_LIST - Audio DebugTools GL MeshTools Primitives SceneGraph Shaders Text - TextureTools Trade Vk - AndroidApplication EmscriptenApplication GlfwApplication GlxApplication - Sdl2Application XEglApplication WindowlessCglApplication - WindowlessEglApplication WindowlessGlxApplication WindowlessIosApplication - WindowlessWglApplication WindowlessWindowsEglApplication - CglContext EglContext GlxContext WglContext - OpenGLTester) -set(_MAGNUM_PLUGIN_COMPONENT_LIST +set(_MAGNUM_LIBRARY_COMPONENTS + Audio DebugTools GL MaterialTools MeshTools Primitives SceneGraph + SceneTools Shaders ShaderTools Text TextureTools Trade + WindowlessEglApplication EglContext OpenGLTester) +set(_MAGNUM_PLUGIN_COMPONENTS AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneConverter AnySceneImporter MagnumFont MagnumFontConverter ObjImporter TgaImageConverter TgaImporter WavAudioImporter) -set(_MAGNUM_EXECUTABLE_COMPONENT_LIST - distancefieldconverter fontconverter imageconverter sceneconverter gl-info - al-info) +set(_MAGNUM_EXECUTABLE_COMPONENTS + imageconverter sceneconverter shaderconverter gl-info al-info) +# 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 + DebugTools MeshTools SceneGraph Shaders ShaderTools Text TextureTools Trade + GL Primitives) +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) +elseif(CORRADE_TARGET_APPLE AND NOT MAGNUM_TARGET_GLES) + 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) + list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext) +endif() +if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS) + list(APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter) +endif() # Inter-component dependencies set(_MAGNUM_Audio_DEPENDENCIES ) @@ -390,30 +445,24 @@ if(MAGNUM_TARGET_GL) set(_MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON) endif() +set(_MAGNUM_MaterialTools_DEPENDENCIES Trade) + set(_MAGNUM_MeshTools_DEPENDENCIES Trade) if(MAGNUM_TARGET_GL) list(APPEND _MAGNUM_MeshTools_DEPENDENCIES GL) endif() set(_MAGNUM_OpenGLTester_DEPENDENCIES GL) -if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) +if(MAGNUM_TARGET_EGL) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication) elseif(CORRADE_TARGET_IOS) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessIosApplication) elseif(CORRADE_TARGET_APPLE) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessCglApplication) elseif(CORRADE_TARGET_UNIX) - if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES) - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication) - else() - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication) - endif() + list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication) elseif(CORRADE_TARGET_WINDOWS) - if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication) - else() - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWindowsEglApplication) - endif() + list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication) endif() set(_MAGNUM_Primitives_DEPENDENCIES MeshTools Trade) @@ -421,8 +470,11 @@ if(MAGNUM_TARGET_GL) # GL not required by Primitives themselves, but transitively by MeshTools list(APPEND _MAGNUM_Primitives_DEPENDENCIES GL) endif() + set(_MAGNUM_SceneGraph_DEPENDENCIES ) +set(_MAGNUM_SceneTools_DEPENDENCIES Trade) set(_MAGNUM_Shaders_DEPENDENCIES GL) + set(_MAGNUM_Text_DEPENDENCIES TextureTools) if(MAGNUM_TARGET_GL) list(APPEND _MAGNUM_Text_DEPENDENCIES GL) @@ -434,7 +486,9 @@ if(MAGNUM_TARGET_GL) endif() set(_MAGNUM_Trade_DEPENDENCIES ) +set(_MAGNUM_VulkanTester_DEPENDENCIES Vk) set(_MAGNUM_AndroidApplication_DEPENDENCIES GL) + set(_MAGNUM_EmscriptenApplication_DEPENDENCIES) if(MAGNUM_TARGET_GL) list(APPEND _MAGNUM_EmscriptenApplication_DEPENDENCIES GL) @@ -457,7 +511,6 @@ set(_MAGNUM_WindowlessEglApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessGlxApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessIosApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessWglApplication_DEPENDENCIES GL) -set(_MAGNUM_WindowlessWindowsEglApplication_DEPENDENCIES GL) set(_MAGNUM_XEglApplication_DEPENDENCIES GL) set(_MAGNUM_CglContext_DEPENDENCIES GL) set(_MAGNUM_EglContext_DEPENDENCIES GL) @@ -467,9 +520,11 @@ 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_COMPONENT_LIST}) +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)") @@ -495,6 +550,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) 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() @@ -502,13 +558,6 @@ if(Magnum_FIND_COMPONENTS) list(REMOVE_DUPLICATES Magnum_FIND_COMPONENTS) endif() -# Convert components lists to regular expressions so I can use if(MATCHES). -# TODO: Drop this once CMake 3.3 and if(IN_LIST) can be used -foreach(_WHAT LIBRARY PLUGIN EXECUTABLE) - string(REPLACE ";" "|" _MAGNUM_${_WHAT}_COMPONENTS "${_MAGNUM_${_WHAT}_COMPONENT_LIST}") - set(_MAGNUM_${_WHAT}_COMPONENTS "^(${_MAGNUM_${_WHAT}_COMPONENTS})$") -endforeach() - # Find all components. Maintain a list of components that'll need to have # their optional dependencies checked. set(_MAGNUM_OPTIONAL_DEPENDENCIES_TO_ADD ) @@ -522,7 +571,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set(Magnum_${_component}_FOUND TRUE) else() # Library components - if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS}) + if(_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS) add_library(Magnum::${_component} UNKNOWN IMPORTED) # Set library defaults, find the library @@ -534,10 +583,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) find_library(MAGNUM_${_COMPONENT}_LIBRARY_RELEASE Magnum${_component}) mark_as_advanced(MAGNUM_${_COMPONENT}_LIBRARY_DEBUG MAGNUM_${_COMPONENT}_LIBRARY_RELEASE) - endif() # Plugin components - if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) + elseif(_component IN_LIST _MAGNUM_PLUGIN_COMPONENTS) add_library(Magnum::${_component} UNKNOWN IMPORTED) # AudioImporter plugin specific name suffixes @@ -549,6 +597,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) 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) @@ -578,7 +630,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # 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 - # accidentaly break something else + # accidentally break something else set(_tmp_prefixes "${CMAKE_FIND_LIBRARY_PREFIXES}") set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};") @@ -601,10 +653,26 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # 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 + IMPORTED_LOCATION ${MAGNUM_${_COMPONENT}_EXECUTABLE}) + endif() + + # Something unknown, skip. FPHSA will take care of handling this below. + else() + continue() endif() # Library location for libraries/plugins - if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) + 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 IMPORTED_CONFIGURATIONS RELEASE) @@ -620,19 +688,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endif() endif() - # Executables - if(_component MATCHES ${_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 - IMPORTED_LOCATION ${MAGNUM_${_COMPONENT}_EXECUTABLE}) - endif() - endif() - # Applications if(_component MATCHES ".+Application") set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX Magnum/Platform) @@ -643,7 +698,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES android EGL::EGL) - # EmscriptenApplication has no additional dependencies + # 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 + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") + endif() # GLFW application dependencies elseif(_component STREQUAL GlfwApplication) @@ -662,7 +727,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # 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 @@ -671,16 +736,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. if(MAGNUM_TARGET_GL) - if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) + if(MAGNUM_TARGET_EGL) + find_package(EGL) + set_property(TARGET Magnum::${_component} APPEND + PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) + elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE) find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) endif() - elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND - PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) endif() endif() @@ -699,9 +764,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) elseif(CORRADE_TARGET_UNIX) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) + # Emscripten has various stuff implemented in JS + elseif(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_PLATFORM_JS MagnumPlatform.js + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # 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 @@ -710,16 +783,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. if(MAGNUM_TARGET_GL) - if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) + if(MAGNUM_TARGET_EGL) + find_package(EGL) + set_property(TARGET Magnum::${_component} APPEND + PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) + elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE) find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) endif() - elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND - PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) endif() endif() @@ -731,12 +804,19 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES}) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # 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. + # + # 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. find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -762,12 +842,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # Windowless WGL application has no additional dependencies - # Windowless Windows/EGL application dependencies - elseif(_component STREQUAL WindowlessWindowsEglApplication) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES EGL::EGL) - # X/EGL application dependencies elseif(_component STREQUAL XEglApplication) find_package(EGL) @@ -785,7 +859,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # GLX context dependencies if(_component STREQUAL GlxContext) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # 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 @@ -817,14 +891,14 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) elseif(_component STREQUAL Audio) find_package(OpenAL) set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager OpenAL::OpenAL) + INTERFACE_LINK_LIBRARIES OpenAL::OpenAL) # No special setup for DebugTools library # GL library elseif(_component STREQUAL GL) - if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) - # If the GLVND library (CMake 3.11+) was found, link to the + if(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS)) + # If the GLVND library (CMake 3.10+) was found, link to the # 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 @@ -849,6 +923,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) endif() + # MaterialTools library + elseif(_component STREQUAL MaterialTools) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES PhongToPbrMetallicRoughness.h) + # MeshTools library elseif(_component STREQUAL MeshTools) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES CompressIndices.h) @@ -857,30 +935,32 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) 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 - # No special setup for Shaders library - # Text library - elseif(_component STREQUAL Text) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager) + # SceneTools library + elseif(_component STREQUAL SceneTools) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Hierarchy.h) + + # No special setup for ShaderTools library + # No special setup for Shaders library + # No special setup for Text library # TextureTools library elseif(_component STREQUAL TextureTools) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Atlas.h) - # Trade library - elseif(_component STREQUAL Trade) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager) + # No special setup for Trade library # Vk library elseif(_component STREQUAL Vk) - set(Vulkan_INCLUDE_DIR ${MAGNUM_INCLUDE_DIR}/MagnumExternal/Vulkan) find_package(Vulkan REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Vulkan::Vulkan) @@ -898,7 +978,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # No special setup for WavAudioImporter plugin # Find library/plugin includes - if(_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) + if(_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS) find_path(_MAGNUM_${_COMPONENT}_INCLUDE_DIR NAMES ${_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES} HINTS ${MAGNUM_INCLUDE_DIR}/${_MAGNUM_${_COMPONENT}_INCLUDE_PATH_SUFFIX}) @@ -906,8 +986,13 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endif() # Automatic import of static plugins. Skip in case the include dir was - # not found -- that'll fail later with a proper message. - if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR) + # 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) # 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) @@ -920,10 +1005,14 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # 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 MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) + if(_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS) + foreach(_dependency ${_MAGNUM_${_component}_CORRADE_DEPENDENCIES}) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES Corrade::${_dependency}) + endforeach() set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Magnum::Magnum) - set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD ) + set(_MAGNUM_${_component}_OPTIONAL_DEPENDENCIES_TO_ADD ) foreach(_dependency ${_MAGNUM_${_component}_DEPENDENCIES}) if(NOT _MAGNUM_${_component}_${_dependency}_DEPENDENCY_IS_OPTIONAL) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -939,7 +1028,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endif() # Decide if the library was found - if(((_component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS}) AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR AND (MAGNUM_${_COMPONENT}_LIBRARY_DEBUG OR MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)) OR (_component MATCHES ${_MAGNUM_EXECUTABLE_COMPONENTS} AND MAGNUM_${_COMPONENT}_EXECUTABLE)) + 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) @@ -985,27 +1074,47 @@ if(CORRADE_TARGET_EMSCRIPTEN) MAGNUM_EMSCRIPTENAPPLICATION_JS MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS MAGNUM_WEBAPPLICATION_CSS) +endif() - # If we are on CMake 3.13 and up, `-s USE_WEBGL2=1` linker option is - # propagated from FindOpenGLES3.cmake already. If not (and the GL library - # is used), we need to modify the global CMAKE_EXE_LINKER_FLAGS. Do it here - # instead of in FindOpenGLES3.cmake so it works also for CMake subprojects - # (in which case find_package(OpenGLES3) is called in (and so - # CMAKE_EXE_LINKER_FLAGS would be modified in) Magnum's root CMakeLists.txt - # and thus can't affect the variable in the outer project). CMake supports - # IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but - # it's behind a policy, so enable that one as well. - cmake_policy(SET CMP0057 NEW) - if(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") - 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) + list(APPEND _MAGNUM_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum.") + # 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 REQUIRED_VARS MAGNUM_INCLUDE_DIR MAGNUM_LIBRARY ${MAGNUM_EXTRAS_NEEDED} - HANDLE_COMPONENTS) + HANDLE_COMPONENTS + ${_MAGNUM_REASON_FAILURE_MESSAGE}) # Components with optional dependencies -- add them once we know if they were # found or not. @@ -1106,17 +1215,31 @@ endif() # Installation and deploy dirs set(MAGNUM_DEPLOY_PREFIX "." CACHE STRING "Prefix where to put final application executables") -set(MAGNUM_INCLUDE_INSTALL_PREFIX "." - CACHE STRING "Prefix where to put platform-independent include and other files") include(${CORRADE_LIB_SUFFIX_MODULE}) set(MAGNUM_BINARY_INSTALL_DIR bin) set(MAGNUM_LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}) -set(MAGNUM_DATA_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/share/magnum) +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) @@ -1139,9 +1262,6 @@ set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG 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) -set(MAGNUM_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/Magnum) -set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/MagnumExternal) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/MagnumPlugins) # Get base plugin directory from main library location. This is *not* PATH, # because CMake always converts the path to an absolute location internally, @@ -1180,3 +1300,6 @@ if(MAGNUM_PLUGINS_RELEASE_DIR) set(MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/sceneconverters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters) endif() + +# Resets CMake policies set at the top of the file to not affect other code. +cmake_policy(POP)