[magnum,-plugins] Fix deployment of plugin types and incorrect removal of plugin lib dir on unix (#16245)

* [magnum] Correctly deploy shaderconverter and sceneconverter plugins

Signed-off-by: Squareys <squareys@googlemail.com>

* [magnum,-plugins] Only remove plugin lib dirs for Windows platforms

Signed-off-by: Squareys <squareys@googlemail.com>

* [magnum,-plugins] Clean up deletion of plugin libs and clarify in comment

Signed-off-by: Squareys <squareys@googlemail.com>

* Update versions

Co-authored-by: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
Jonathan Hale 2021-02-18 22:02:27 +01:00 committed by GitHub
parent aef2f37056
commit e7377f7992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 22 deletions

View File

@ -1,6 +1,6 @@
Source: magnum-plugins
Version: 2020.06
Port-Version: 2
Port-Version: 3
Build-Depends: magnum[core]
Description: Plugins for magnum, C++11/C++14 graphics middleware for games and data visualization
Homepage: https://magnum.graphics/

View File

@ -106,8 +106,17 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum)
else()
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d)
# On windows, plugins are "Modules" that cannot be linked as shared
# libraries, but are meant to be loaded at runtime.
# While this is handled adequately through the CMake project, the auto-magic
# linking with visual studio might try to link the import libs anyway.
#
# We delete the import libraries here to avoid the auto-magic linking
# for plugins which are loaded at runtime.
if(WIN32)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d)
endif()
endif()
# Handle copyright

View File

@ -1,6 +1,6 @@
Source: magnum
Version: 2020.06
Port-Version: 3
Port-Version: 4
Build-Depends: corrade[utility]
Description: C++11/C++14 graphics middleware for games and data visualization
Homepage: https://magnum.graphics/

View File

@ -23,16 +23,18 @@ function deployPluginsIfMagnum([string]$targetBinaryDir, [string]$MagnumPluginsD
}
}
# We detect Magnum modules in use via the DLLs themselves.
# Rather than checking for Magnum*.dll, we check for Magnum.dll and
# Magnum-d.dll to avoid falsly matching MagnumTextureTools.dll for example.
# We detect Magnum modules in use via the DLLs that contain their
# plugin interfaces.
if ($targetBinaryName -like "MagnumAudio.dll" -or $targetBinaryName -like "MagnumAudio-d.dll") {
deployPlugins "audioimporters"
} elseif ($targetBinaryName -like "MagnumText.dll" -or $targetBinaryName -like "MagnumText-d.dll") {
deployPlugins "fonts"
deployPlugins "fontconverters"
} elseif ($targetBinaryName -like "Magnum.dll" -or $targetBinaryName -like "Magnum-d.dll") {
} elseif ($targetBinaryName -like "MagnumTrade.dll" -or $targetBinaryName -like "MagnumTrade-d.dll") {
deployPlugins "importers"
deployPlugins "imageconverters"
deployPlugins "sceneconverters"
} elseif ($targetBinaryName -like "MagnumShaderTools.dll" -or $targetBinaryName -like "MagnumShaderTools-d.dll") {
deployPlugins "shaderconverters"
}
}

View File

@ -114,18 +114,61 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
# move plugin libs to conventional place
file(GLOB_RECURSE LIB_TO_MOVE ${CURRENT_PACKAGES_DIR}/lib/magnum/*)
file(COPY ${LIB_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum)
file(GLOB_RECURSE LIB_TO_MOVE_DBG ${CURRENT_PACKAGES_DIR}/debug/lib/magnum/*)
file(COPY ${LIB_TO_MOVE_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
# move plugin libs to conventional place
file(GLOB_RECURSE LIB_TO_MOVE ${CURRENT_PACKAGES_DIR}/lib/magnum/*)
file(COPY ${LIB_TO_MOVE} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum)
file(GLOB_RECURSE LIB_TO_MOVE_DBG ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d/*)
file(COPY ${LIB_TO_MOVE_DBG} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d)
else()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/magnumdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/bin/magnum)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/magnumdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/magnum-d)
# Unlike the magnum-plugins port, we cannot remove the lib files entirely here,
# As other importers might depend on them (e.g. AssimpImporter depends on AnyImageImporter)
# and modules are not allowed to have unresolved symbols, hence simply loading the
# dependencies in advance like on Unix does not work on Windows.
#
# On windows, plugins are "Modules" that cannot be linked as shared
# libraries, but are meant to be loaded at runtime.
# While this is handled adequately through the CMake project, the auto-magic
# linking with visual studio might try to link the import libs anyway.
#
# We delete most of the import libraries here to avoid the auto-magic linking
# for plugins which are loaded at runtime, but keep the afforementioned Any* plugins.
#
# See https://github.com/microsoft/vcpkg/pull/1235#issuecomment-308805989 for futher info.
if(WIN32)
file(GLOB_RECURSE LIB_TO_REMOVE ${CURRENT_PACKAGES_DIR}/lib/magnum/*)
file(GLOB_RECURSE LIB_TO_KEEP ${CURRENT_PACKAGES_DIR}/lib/magnum/*Any*)
if(LIB_TO_KEEP)
list(REMOVE_ITEM LIB_TO_REMOVE ${LIB_TO_KEEP})
endif()
if(LIB_TO_REMOVE)
file(REMOVE ${LIB_TO_REMOVE})
endif()
file(GLOB_RECURSE LIB_TO_REMOVE_DBG ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d/*)
file(GLOB_RECURSE LIB_TO_KEEP_DBG ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d/*Any*)
if(LIB_TO_KEEP_DBG)
list(REMOVE_ITEM LIB_TO_REMOVE_DBG ${LIB_TO_KEEP_DBG})
endif()
if(LIB_TO_REMOVE_DBG)
file(REMOVE ${LIB_TO_REMOVE_DBG})
endif()
# fonts and fontconverters don't have Any* plugins
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum/fonts)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum/fontconverters)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d/fonts)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d/fontconverters)
endif()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/magnumdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/bin/magnum)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/magnumdeploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/magnum-d)
endif()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
RENAME copyright)

View File

@ -3674,7 +3674,7 @@
},
"magnum": {
"baseline": "2020.06",
"port-version": 3
"port-version": 4
},
"magnum-extras": {
"baseline": "2020.06",
@ -3686,7 +3686,7 @@
},
"magnum-plugins": {
"baseline": "2020.06",
"port-version": 2
"port-version": 3
},
"mapbox-variant": {
"baseline": "1.2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "79988d3cd16038434cacef0e4423f3b2e64f0a1b",
"version-string": "2020.06",
"port-version": 3
},
{
"git-tree": "b9b701869c5d4f5f4203702622d2bbfa58b6517f",
"version-string": "2020.06",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "96fbedbdb7cac5cb1624af746d6e4b2cb4b57cc8",
"version-string": "2020.06",
"port-version": 4
},
{
"git-tree": "84fd6db3cf53cfcb736bfb14b08b86940f5588e1",
"version-string": "2020.06",