From 38896feb66dc338099723f25d762025392f0968d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 10 Apr 2023 10:44:14 +0200 Subject: [PATCH] modules: update Find modules from Magnum repositories. --- modules/FindCorrade.cmake | 18 +++++++++++++----- modules/FindMagnum.cmake | 17 ++++++++++++++--- modules/FindOpenGLES3.cmake | 4 ++++ modules/FindSDL2.cmake | 8 ++++---- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index ff3429b..fa18d13 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -80,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 @@ -100,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 @@ -210,7 +215,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 @@ -319,6 +324,7 @@ set(_corradeFlags BUILD_STATIC BUILD_STATIC_UNIQUE_GLOBALS BUILD_MULTITHREADED + BUILD_CPU_RUNTIME_DISPATCH TARGET_UNIX TARGET_APPLE TARGET_IOS @@ -327,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) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index b5e89b6..3e17e0a 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -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 @@ -127,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 @@ -367,8 +368,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 @@ -432,6 +433,8 @@ 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) @@ -883,6 +886,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) @@ -901,6 +908,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # No special setup for SceneGraph library + # SceneTools library + elseif(_component STREQUAL SceneTools) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES FlattenTransformationHierarchy.h) + # ShaderTools library elseif(_component STREQUAL ShaderTools) set_property(TARGET Magnum::${_component} APPEND PROPERTY diff --git a/modules/FindOpenGLES3.cmake b/modules/FindOpenGLES3.cmake index 4d601ad..1c53a61 100644 --- a/modules/FindOpenGLES3.cmake +++ b/modules/FindOpenGLES3.cmake @@ -82,6 +82,10 @@ if(NOT TARGET OpenGLES3::OpenGLES3) # Emscripten needs a special flag to use WebGL 2. CMake 3.13 allows to set # this via INTERFACE_LINK_OPTIONS, for older versions we modify the global # CMAKE_EXE_LINKER_FLAGS inside FindMagnum.cmake. + # 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(CORRADE_TARGET_EMSCRIPTEN AND NOT CMAKE_VERSION VERSION_LESS 3.13) # I could probably use target_link_options() here, but let's be # consistent with the rest diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 800d264..6d9e6ec 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -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 @@ -168,10 +168,10 @@ find_path(SDL2_INCLUDE_DIR if(CORRADE_TARGET_WINDOWS) find_file(SDL2_DLL_RELEASE NAMES SDL2.dll - PATH_SUFFIXES ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX}) + PATH_SUFFIXES bin ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX}) find_file(SDL2_DLL_DEBUG NAMES SDL2d.dll # not sure? - PATH_SUFFIXES ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX}) + PATH_SUFFIXES bin ${_SDL2_RUNTIME_PATH_SUFFIX} ${_SDL2_LIBRARY_PATH_SUFFIX}) endif() # (Static) macOS / iOS dependencies. On macOS these were mainly needed when