From 44aed01d77d88f4ec0892dee9f794cfba7da1181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 28 Jan 2020 13:36:21 +0100 Subject: [PATCH] Fix plugins being searched in lib/ when it should be bin/ and vice versa. Ugh. I must have been drunk when writing this. Also, why nobody complained until now? Interesting. --- doc/changelog.dox | 3 +++ src/Magnum/Audio/AbstractImporter.cpp | 11 +++++++++++ src/Magnum/Text/AbstractFont.cpp | 7 +++++-- src/Magnum/Text/AbstractFontConverter.cpp | 11 +++++++++++ src/Magnum/Trade/AbstractImageConverter.cpp | 7 +++++-- src/Magnum/Trade/AbstractImporter.cpp | 9 +++++---- 6 files changed, 40 insertions(+), 8 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index bf46da95e..f70a9a8c9 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -237,6 +237,9 @@ See also: @ref Corrade/Containers/StridedArrayView.h to be included *before* in order to use the @ref ImageView::pixels() "pixels()" function. Now it's enough to just include it at any point, with no order dependency anymore. +- Dynamic plugins on static Magnum builds on Windows were accidentally + searched for in the `lib/` directory instead of `bin/`, and in some cases + in `bin/` instead of `lib/` on Unix platforms. @subsection changelog-latest-deprecated Deprecated APIs diff --git a/src/Magnum/Audio/AbstractImporter.cpp b/src/Magnum/Audio/AbstractImporter.cpp index 2b3f28c4d..262e93aed 100644 --- a/src/Magnum/Audio/AbstractImporter.cpp +++ b/src/Magnum/Audio/AbstractImporter.cpp @@ -44,17 +44,28 @@ std::string AbstractImporter::pluginInterface() { #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT std::vector AbstractImporter::pluginSearchPaths() { return { + /* Debug build */ #ifdef CORRADE_IS_DEBUG_BUILD #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/audioimporters"), #else + #ifndef CORRADE_TARGET_WINDOWS + /* On Windows, the plugin DLLs are next to the executable, so the one + below works. Elsewhere the plugins are in the lib dir instead */ + "../lib/magnum-d/audioimporters", + #endif "magnum-d/audioimporters", #endif Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters") + + /* Release build */ #else #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/audioimporters"), #else + #ifndef CORRADE_TARGET_WINDOWS + "../lib/magnum/audioimporters", + #endif "magnum/audioimporters", #endif Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters") diff --git a/src/Magnum/Text/AbstractFont.cpp b/src/Magnum/Text/AbstractFont.cpp index b6ab5db05..995253f0d 100644 --- a/src/Magnum/Text/AbstractFont.cpp +++ b/src/Magnum/Text/AbstractFont.cpp @@ -49,11 +49,12 @@ std::string AbstractFont::pluginInterface() { #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT std::vector AbstractFont::pluginSearchPaths() { return { + /* Debug build */ #ifdef CORRADE_IS_DEBUG_BUILD #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fonts"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS /* On Windows, the plugin DLLs are next to the executable, so the one below works. Elsewhere the plugins are in the lib dir instead */ "../lib/magnum-d/fonts", @@ -61,11 +62,13 @@ std::vector AbstractFont::pluginSearchPaths() { "magnum-d/fonts", #endif Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts") + + /* Release build */ #else #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/fonts"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS "../lib/magnum/fonts", #endif "magnum/fonts", diff --git a/src/Magnum/Text/AbstractFontConverter.cpp b/src/Magnum/Text/AbstractFontConverter.cpp index a37acda9f..9c11479a6 100644 --- a/src/Magnum/Text/AbstractFontConverter.cpp +++ b/src/Magnum/Text/AbstractFontConverter.cpp @@ -63,17 +63,28 @@ std::string AbstractFontConverter::pluginInterface() { #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT std::vector AbstractFontConverter::pluginSearchPaths() { return { + /* Debug build */ #ifdef CORRADE_IS_DEBUG_BUILD #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fontconverters"), #else + #ifndef CORRADE_TARGET_WINDOWS + /* On Windows, the plugin DLLs are next to the executable, so the one + below works. Elsewhere the plugins are in the lib dir instead */ + "../lib/magnum-d/fontconverters", + #endif "magnum-d/fontconverters", #endif Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters") + + /* Release build */ #else #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/fontconverters"), #else + #ifndef CORRADE_TARGET_WINDOWS + "../lib/magnum/fontconverters", + #endif "magnum/fontconverters", #endif Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters") diff --git a/src/Magnum/Trade/AbstractImageConverter.cpp b/src/Magnum/Trade/AbstractImageConverter.cpp index 9e04085eb..afc209aa2 100644 --- a/src/Magnum/Trade/AbstractImageConverter.cpp +++ b/src/Magnum/Trade/AbstractImageConverter.cpp @@ -49,11 +49,12 @@ std::string AbstractImageConverter::pluginInterface() { #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT std::vector AbstractImageConverter::pluginSearchPaths() { return { + /* Debug build */ #ifdef CORRADE_IS_DEBUG_BUILD #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/imageconverters"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS /* On Windows, the plugin DLLs are next to the executable, so the one below works. Elsewhere the plugins are in the lib dir instead */ "../lib/magnum-d/imageconverters", @@ -61,11 +62,13 @@ std::vector AbstractImageConverter::pluginSearchPaths() { "magnum-d/imageconverters", #endif Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters") + + /* Release build */ #else #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/imageconverters"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS "../lib/magnum/imageconverters", #endif "magnum/imageconverters", diff --git a/src/Magnum/Trade/AbstractImporter.cpp b/src/Magnum/Trade/AbstractImporter.cpp index 92fa0458f..f14dbb85a 100644 --- a/src/Magnum/Trade/AbstractImporter.cpp +++ b/src/Magnum/Trade/AbstractImporter.cpp @@ -58,11 +58,12 @@ std::string AbstractImporter::pluginInterface() { #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT std::vector AbstractImporter::pluginSearchPaths() { return { + /* Debug build */ #ifdef CORRADE_IS_DEBUG_BUILD #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/importers"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS /* On Windows, the plugin DLLs are next to the executable, so the one below works. Elsewhere the plugins are in the lib dir instead */ "../lib/magnum-d/importers", @@ -70,13 +71,13 @@ std::vector AbstractImporter::pluginSearchPaths() { "magnum-d/importers", #endif Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers") - #ifdef CORRADE_TARGET_WINDOWS - #endif + + /* Release build */ #else #ifndef MAGNUM_BUILD_STATIC Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/importers"), #else - #ifndef MAGNUM_TARGET_WINDOWS + #ifndef CORRADE_TARGET_WINDOWS "../lib/magnum/importers", #endif "magnum/importers",