Update CMake Find* modules.
This commit is contained in:
parent
ecdf7d736f
commit
a1a155d0ac
5 changed files with 132 additions and 92 deletions
|
@ -16,6 +16,8 @@
|
|||
# components, which are:
|
||||
#
|
||||
# Containers - Containers library
|
||||
# Interconnect - Interconnect library
|
||||
# Main - Main library
|
||||
# PluginManager - PluginManager library
|
||||
# TestSuite - TestSuite library
|
||||
# Utility - Utility library
|
||||
|
@ -68,7 +70,7 @@
|
|||
# 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.
|
||||
|
@ -78,6 +80,9 @@
|
|||
# CORRADE_BUILD_MULTITHREADED - Defined if compiled in a way that makes it
|
||||
# possible to safely use certain Corrade features simultaneously in multiple
|
||||
# threads
|
||||
# CORRADE_BUILD_CPU_RUNTIME_DISPATCH - Defined if built with code paths
|
||||
# optimized for multiple architectres with the best matching variant selected
|
||||
# at runtime based on detected CPU features
|
||||
# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor
|
||||
# (Linux, BSD, macOS)
|
||||
# CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms
|
||||
|
@ -98,6 +103,8 @@
|
|||
# CORRADE_TARGET_MSVC - Defined if compiling with MSVC or Clang with
|
||||
# a MSVC frontend
|
||||
# CORRADE_TARGET_MINGW - Defined if compiling under MinGW
|
||||
# CORRADE_CPU_USE_IFUNC - Defined if GNU IFUNC is allowed to be used
|
||||
# for runtime dispatch in the Cpu library
|
||||
# CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - Defined if PluginManager
|
||||
# doesn't support dynamic plugin loading due to platform limitations
|
||||
# CORRADE_TESTSUITE_TARGET_XCTEST - Defined if TestSuite is targeting Xcode
|
||||
|
@ -208,7 +215,7 @@
|
|||
# <metadata file>
|
||||
# <sources>...)
|
||||
#
|
||||
# Unline the above version this puts everything into ``<debug install dir>`` on
|
||||
# Unlike the above version this puts everything into ``<debug install dir>`` on
|
||||
# both DLL and non-DLL platforms. If ``<debug install dir>`` is set to
|
||||
# :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for testing purposes), the files
|
||||
# are copied directly, without the need to perform install step. Note that the
|
||||
|
@ -264,7 +271,7 @@
|
|||
# This file is part of Corrade.
|
||||
#
|
||||
# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
|
||||
# 2017, 2018, 2019, 2020, 2021, 2022
|
||||
# 2017, 2018, 2019, 2020, 2021, 2022, 2023
|
||||
# Vladimír Vondruš <mosra@centrum.cz>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -317,6 +324,7 @@ set(_corradeFlags
|
|||
BUILD_STATIC
|
||||
BUILD_STATIC_UNIQUE_GLOBALS
|
||||
BUILD_MULTITHREADED
|
||||
BUILD_CPU_RUNTIME_DISPATCH
|
||||
TARGET_UNIX
|
||||
TARGET_APPLE
|
||||
TARGET_IOS
|
||||
|
@ -325,10 +333,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)
|
||||
|
@ -406,6 +416,8 @@ 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 IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS)
|
||||
add_library(Corrade::${_component} UNKNOWN IMPORTED)
|
||||
|
@ -496,25 +508,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)
|
||||
|
@ -559,11 +579,14 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
# Decide if the component was 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)
|
||||
# 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()
|
||||
|
@ -590,7 +613,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16)
|
|||
# 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 WITH_${_COMPONENT} when building Corrade.")
|
||||
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()
|
||||
|
@ -606,9 +629,6 @@ 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
|
||||
${_CORRADE_REASON_FAILURE_MESSAGE})
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
# This file is part of Magnum.
|
||||
#
|
||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
|
||||
# 2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# 2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# Copyright © 2018 Jonathan Hale <squareys@googlemail.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
# Audio - Audio library
|
||||
# DebugTools - DebugTools library
|
||||
# GL - GL library
|
||||
# MaterialTools - MaterialTools library
|
||||
# MeshTools - MeshTools library
|
||||
# Primitives - Primitives library
|
||||
# SceneGraph - SceneGraph library
|
||||
|
@ -78,7 +79,6 @@
|
|||
# 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
|
||||
|
@ -128,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
|
||||
|
@ -137,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
|
||||
|
@ -149,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:
|
||||
#
|
||||
|
@ -202,7 +205,7 @@
|
|||
# This file is part of Magnum.
|
||||
#
|
||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
|
||||
# 2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# 2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -225,16 +228,26 @@
|
|||
|
||||
# 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|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$")
|
||||
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})
|
||||
|
||||
|
@ -269,9 +282,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})
|
||||
|
@ -280,9 +292,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)
|
||||
# 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()
|
||||
|
||||
# OpenGL library preference. Prefer to use GLVND, since that's the better
|
||||
|
@ -355,8 +378,8 @@ endif()
|
|||
# Component distinction (listing them explicitly to avoid mistakes with finding
|
||||
# components from other repositories)
|
||||
set(_MAGNUM_LIBRARY_COMPONENTS
|
||||
Audio DebugTools GL MeshTools Primitives SceneGraph SceneTools Shaders
|
||||
ShaderTools Text TextureTools Trade
|
||||
Audio DebugTools GL MaterialTools MeshTools Primitives SceneGraph
|
||||
SceneTools Shaders ShaderTools Text TextureTools Trade
|
||||
WindowlessEglApplication EglContext OpenGLTester)
|
||||
set(_MAGNUM_PLUGIN_COMPONENTS
|
||||
AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneConverter
|
||||
|
@ -395,7 +418,7 @@ 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 WindowlessWindowsEglApplication)
|
||||
list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext)
|
||||
endif()
|
||||
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS)
|
||||
list(APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter)
|
||||
|
@ -420,30 +443,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 AND NOT MAGNUM_TARGET_GLES)
|
||||
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)
|
||||
|
@ -492,7 +509,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)
|
||||
|
@ -708,16 +724,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()
|
||||
|
||||
|
@ -747,16 +763,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()
|
||||
|
||||
|
@ -799,12 +815,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)
|
||||
|
@ -854,13 +864,13 @@ 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(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS))
|
||||
# If the GLVND library (CMake 3.11+) was found, link to the
|
||||
# imported target. Otherwise (and also on all systems except
|
||||
# Linux) link to the classic libGL. Can't use
|
||||
|
@ -886,6 +896,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)
|
||||
|
@ -904,26 +918,19 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
|
|||
|
||||
# No special setup for SceneGraph library
|
||||
|
||||
# ShaderTools library
|
||||
elseif(_component STREQUAL ShaderTools)
|
||||
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
|
||||
|
||||
# Text library
|
||||
elseif(_component STREQUAL Text)
|
||||
set_property(TARGET Magnum::${_component} APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Corrade::PluginManager)
|
||||
# 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)
|
||||
|
@ -952,8 +959,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 IN_LIST _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)
|
||||
|
@ -967,6 +979,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
|
|||
# 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)
|
||||
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 )
|
||||
|
@ -1042,6 +1058,10 @@ if(CORRADE_TARGET_EMSCRIPTEN)
|
|||
# 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)
|
||||
# TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be
|
||||
# then passed via target_link_libraries() etc. without requiring CMake
|
||||
# 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020
|
||||
# -- change to that once we drop support for older Emscripten versions
|
||||
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()
|
||||
|
@ -1069,7 +1089,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16)
|
|||
# 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 WITH_${_COMPONENT} when building Magnum.")
|
||||
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()
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
# This file is part of Magnum.
|
||||
#
|
||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
|
||||
# 2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# 2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# Copyright © 2018 Konstantinos Chatzilygeroudis <costashatz@gmail.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -314,7 +314,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16)
|
|||
# misleading messages.
|
||||
elseif(NOT _component IN_LIST _MAGNUMINTEGRATION_IMPLICITLY_ENABLED_COMPONENTS)
|
||||
string(TOUPPER ${_component} _COMPONENT)
|
||||
list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled WITH_${_COMPONENT} when building Magnum Integration.")
|
||||
list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum Integration.")
|
||||
# Otherwise we have no idea. Better be silent than to print something
|
||||
# misleading.
|
||||
else()
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# This file is part of Magnum.
|
||||
#
|
||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
|
||||
# 2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# 2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
|
||||
# Copyright © 2018 Jonathan Hale <squareys@googlemail.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -138,10 +138,10 @@ else()
|
|||
# which CMake somehow prefers before the SDL2-2.0.dylib file. Making
|
||||
# the dylib first so it is preferred. Not sure how this maps to debug
|
||||
# config though :/
|
||||
NAMES SDL2-2.0 SDL2
|
||||
NAMES SDL2-2.0 SDL2 SDL2-static
|
||||
PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX})
|
||||
find_library(SDL2_LIBRARY_DEBUG
|
||||
NAMES SDL2d
|
||||
NAMES SDL2d SDL2-staticd
|
||||
PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX})
|
||||
# FPHSA needs one of the _DEBUG/_RELEASE variables to check that the
|
||||
# library was found -- using SDL_LIBRARY, which will get populated by
|
||||
|
|
Loading…
Reference in a new issue