Browse Source

modules: updated FindCorrade and FindMagnum.

next
Vladimír Vondruš 3 years ago
parent
commit
cec30658ed
  1. 34
      modules/FindCorrade.cmake
  2. 43
      modules/FindMagnum.cmake

34
modules/FindCorrade.cmake

@ -416,6 +416,8 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
if(TARGET Corrade::${_component}) if(TARGET Corrade::${_component})
set(Corrade_${_component}_FOUND TRUE) set(Corrade_${_component}_FOUND TRUE)
else() else()
unset(Corrade_${_component}_FOUND)
# Library (and not header-only) components # Library (and not header-only) components
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _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) add_library(Corrade::${_component} UNKNOWN IMPORTED)
@ -506,25 +508,33 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
elseif(_component STREQUAL PluginManager) elseif(_component STREQUAL PluginManager)
# -ldl is handled by Utility now # -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) elseif(_component STREQUAL TestSuite)
# XCTest runner file # XCTest runner file
if(CORRADE_TESTSUITE_TARGET_XCTEST) if(CORRADE_TESTSUITE_TARGET_XCTEST)
find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in
PATH_SUFFIXES share/corrade/TestSuite) 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 # ADB runner file
elseif(CORRADE_TARGET_ANDROID) elseif(CORRADE_TARGET_ANDROID)
find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh
PATH_SUFFIXES share/corrade/TestSuite) 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 # Emscripten runner file
elseif(CORRADE_TARGET_EMSCRIPTEN) elseif(CORRADE_TARGET_EMSCRIPTEN)
find_file(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER EmscriptenRunner.html.in find_file(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER EmscriptenRunner.html.in
PATH_SUFFIXES share/corrade/TestSuite) 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() endif()
# Utility library (contains all setup that is used by others) # Utility library (contains all setup that is used by others)
@ -569,11 +579,14 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
endforeach() endforeach()
endif() endif()
# Decide if the component was found # Decide if the component was found, unless the _FOUND is already set
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)) # by something above.
set(Corrade_${_component}_FOUND TRUE) if(NOT DEFINED Corrade_${_component}_FOUND)
else() 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 FALSE) set(Corrade_${_component}_FOUND TRUE)
else()
set(Corrade_${_component}_FOUND FALSE)
endif()
endif() endif()
endif() endif()
endforeach() endforeach()
@ -616,9 +629,6 @@ find_package_handle_standard_args(Corrade REQUIRED_VARS
CORRADE_INCLUDE_DIR CORRADE_INCLUDE_DIR
_CORRADE_MODULE_DIR _CORRADE_MODULE_DIR
_CORRADE_CONFIGURE_FILE _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}) ${_CORRADE_REASON_FAILURE_MESSAGE})

43
modules/FindMagnum.cmake

@ -228,16 +228,26 @@
# Corrade library dependencies # Corrade library dependencies
set(_MAGNUM_CORRADE_DEPENDENCIES ) set(_MAGNUM_CORRADE_DEPENDENCIES )
foreach(_component ${Magnum_FIND_COMPONENTS}) foreach(_magnum_component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT) set(_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES )
# Unrolling the transitive dependencies here so this doesn't need to be # Unrolling the transitive dependencies here so this doesn't need to be
# after resolving inter-component dependencies. Listing also all plugins. # 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)$") if(_magnum_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$")
set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager) 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() endif()
list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES}) list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES})
endforeach() endforeach()
find_package(Corrade REQUIRED Utility ${_MAGNUM_CORRADE_DEPENDENCIES}) find_package(Corrade REQUIRED Utility ${_MAGNUM_CORRADE_DEPENDENCIES})
@ -854,7 +864,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
elseif(_component STREQUAL Audio) elseif(_component STREQUAL Audio)
find_package(OpenAL) find_package(OpenAL)
set_property(TARGET Magnum::${_component} APPEND PROPERTY 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 # No special setup for DebugTools library
@ -912,26 +922,15 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
elseif(_component STREQUAL SceneTools) elseif(_component STREQUAL SceneTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Hierarchy.h) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Hierarchy.h)
# ShaderTools library # No special setup for ShaderTools library
elseif(_component STREQUAL ShaderTools)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::PluginManager)
# No special setup for Shaders library # No special setup for Shaders library
# No special setup for Text library
# Text library
elseif(_component STREQUAL Text)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::PluginManager)
# TextureTools library # TextureTools library
elseif(_component STREQUAL TextureTools) elseif(_component STREQUAL TextureTools)
set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Atlas.h) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Atlas.h)
# Trade library # No special setup for Trade library
elseif(_component STREQUAL Trade)
set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::PluginManager)
# Vk library # Vk library
elseif(_component STREQUAL Vk) elseif(_component STREQUAL Vk)
@ -980,6 +979,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
# are optional dependencies, defer adding them to later once we know if # are optional dependencies, defer adding them to later once we know if
# they were found or not. # they were found or not.
if(_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _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 set_property(TARGET Magnum::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum) INTERFACE_LINK_LIBRARIES Magnum::Magnum)
set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD ) set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD )

Loading…
Cancel
Save