Browse Source

Search plugins relative to library DLLs on Windows.

Makes Windows users' lives slightly easier.
pull/364/head
Vladimír Vondruš 7 years ago
parent
commit
0d71c1d1cc
  1. 5
      doc/changelog.dox
  2. 16
      src/Magnum/Audio/AbstractImporter.cpp
  3. 13
      src/Magnum/Audio/AbstractImporter.h
  4. 16
      src/Magnum/Text/AbstractFont.cpp
  5. 12
      src/Magnum/Text/AbstractFont.h
  6. 16
      src/Magnum/Text/AbstractFontConverter.cpp
  7. 13
      src/Magnum/Text/AbstractFontConverter.h
  8. 16
      src/Magnum/Trade/AbstractImageConverter.cpp
  9. 13
      src/Magnum/Trade/AbstractImageConverter.h
  10. 18
      src/Magnum/Trade/AbstractImporter.cpp
  11. 12
      src/Magnum/Trade/AbstractImporter.h

5
doc/changelog.dox

@ -371,6 +371,11 @@ See also:
- @ref building-packages-msys "MSYS2 packages" are now in official - @ref building-packages-msys "MSYS2 packages" are now in official
repositories, installable directly via `pacman` repositories, installable directly via `pacman`
- Plugin search path on Windows is now discovered relative to location of the
@ref Trade, @ref Text or @ref Audio library DLL instead of executable
location. That makes it behave better in case Magnum is installed via a
package and the installation directory hardcoded at build time doesn't
exist on the target machine (which is the case of MSYS2 packages).
- `FindSDL2.cmake` was updated to work with MinGW version 2.0.5 and newer, - `FindSDL2.cmake` was updated to work with MinGW version 2.0.5 and newer,
since these dropped the old directory hierarchy. Older versions have both since these dropped the old directory hierarchy. Older versions have both
the original and the new hierarchy, so it should work with these as well. the original and the new hierarchy, so it should work with these as well.

16
src/Magnum/Audio/AbstractImporter.cpp

@ -44,10 +44,26 @@ std::string AbstractImporter::pluginInterface() {
std::vector<std::string> AbstractImporter::pluginSearchPaths() { std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return { return {
#ifdef CORRADE_IS_DEBUG_BUILD #ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumAudio-d")), "magnum-d/audioimporters"),
#else
"magnum-d/audioimporters", "magnum-d/audioimporters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters") Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters")
#else #else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumAudio")), "magnum/audioimporters"),
#else
"magnum/audioimporters", "magnum/audioimporters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters") Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters")
#endif #endif
}; };

13
src/Magnum/Audio/AbstractImporter.h

@ -98,12 +98,13 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagi
* @brief Plugin search paths * @brief Plugin search paths
* *
* First looks in `magnum/audioimporters/` or `magnum-d/audioimporters/` * First looks in `magnum/audioimporters/` or `magnum-d/audioimporters/`
* next to the executable and as a fallback in `magnum/audioimporters/` * next to the executable (or, in case of Windows and a non-static
* or `magnum-d/audioimporters/` in the runtime install location * build, next to the DLL of the @ref Audio library) and as a fallback
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The * in `magnum/audioimporters/` or `magnum-d/audioimporters/` in the
* system-wide plugin search directory is configurable using the * runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more * Windows). The system-wide plugin search directory is configurable
* information. * using the `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building
* for more information.
* *
* Not defined on platforms without * Not defined on platforms without
* @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support". * @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support".

16
src/Magnum/Text/AbstractFont.cpp

@ -50,10 +50,26 @@ std::string AbstractFont::pluginInterface() {
std::vector<std::string> AbstractFont::pluginSearchPaths() { std::vector<std::string> AbstractFont::pluginSearchPaths() {
return { return {
#ifdef CORRADE_IS_DEBUG_BUILD #ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText-d")), "magnum-d/fonts"),
#else
"magnum-d/fonts", "magnum-d/fonts",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts") Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts")
#else #else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText")), "magnum/fonts"),
#else
"magnum/fonts", "magnum/fonts",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts") Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts")
#endif #endif
}; };

12
src/Magnum/Text/AbstractFont.h

@ -170,11 +170,13 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @brief Plugin search paths * @brief Plugin search paths
* *
* First looks in `magnum/fonts/` or `magnum-d/fonts/` next to the * First looks in `magnum/fonts/` or `magnum-d/fonts/` next to the
* executable and as a fallback in `magnum/fonts/` or `magnum-d/fonts/` * executable (or, in case of Windows and a non-static build, next to
* in the runtime install location (`lib[64]/` on Unix-like systems, * the DLL of the @ref Text library) and as a fallback in
* `bin/` on Windows). The system-wide plugin search directory is * `magnum/fonts/` or `magnum-d/fonts/` in the runtime install location
* configurable using the `MAGNUM_PLUGINS_DIR` CMake variables, see * (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* @ref building for more information. * system-wide plugin search directory is configurable using the
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more
* information.
* *
* Not defined on platforms without * Not defined on platforms without
* @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support". * @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support".

16
src/Magnum/Text/AbstractFontConverter.cpp

@ -64,10 +64,26 @@ std::string AbstractFontConverter::pluginInterface() {
std::vector<std::string> AbstractFontConverter::pluginSearchPaths() { std::vector<std::string> AbstractFontConverter::pluginSearchPaths() {
return { return {
#ifdef CORRADE_IS_DEBUG_BUILD #ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText-d")), "magnum-d/fontconverters"),
#else
"magnum-d/fontconverters", "magnum-d/fontconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters") Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters")
#else #else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumText")), "magnum/fontconverters"),
#else
"magnum/fontconverters", "magnum/fontconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters") Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters")
#endif #endif
}; };

13
src/Magnum/Text/AbstractFontConverter.h

@ -150,12 +150,13 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* @brief Plugin search paths * @brief Plugin search paths
* *
* First looks in `magnum/fontconverters/` or `magnum-d/fontconverters/` * First looks in `magnum/fontconverters/` or `magnum-d/fontconverters/`
* next to the executable and as a fallback in `magnum/fontconverters/` * next to the executable (or, in case of Windows and a non-static
* or `magnum-d/fontconverters/` in the runtime install location * build, next to the DLL of the @ref Text library) and as a fallback
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The * in `magnum/fontconverters/` or `magnum-d/fontconverters/` in the
* system-wide plugin search directory is configurable using the * runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more * Windows). The system-wide plugin search directory is configurable
* information. * using the `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building
* for more information.
* *
* Not defined on platforms without * Not defined on platforms without
* @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support". * @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support".

16
src/Magnum/Trade/AbstractImageConverter.cpp

@ -50,10 +50,26 @@ std::string AbstractImageConverter::pluginInterface() {
std::vector<std::string> AbstractImageConverter::pluginSearchPaths() { std::vector<std::string> AbstractImageConverter::pluginSearchPaths() {
return { return {
#ifdef CORRADE_IS_DEBUG_BUILD #ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade-d")), "magnum-d/imageconverters"),
#else
"magnum-d/imageconverters", "magnum-d/imageconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters") Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters")
#else #else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade")), "magnum/imageconverters"),
#else
"magnum/imageconverters", "magnum/imageconverters",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters") Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters")
#endif #endif
}; };

13
src/Magnum/Trade/AbstractImageConverter.h

@ -123,12 +123,13 @@ class MAGNUM_TRADE_EXPORT AbstractImageConverter: public PluginManager::Abstract
* @brief Plugin search paths * @brief Plugin search paths
* *
* First looks in `magnum/imageconverters/` or `magnum-d/imageconverters/` * First looks in `magnum/imageconverters/` or `magnum-d/imageconverters/`
* next to the executable and as a fallback in `magnum/imageconverters/` * next to the executable (or, in case of Windows and a non-static
* or `magnum-d/imageconverters/` in the runtime install location * build, next to the DLL of the @ref Trade library) and as a fallback
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The * in `magnum/imageconverters/` or `magnum-d/imageconverters/` in the
* system-wide plugin search directory is configurable using the * runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more * Windows). The system-wide plugin search directory is configurable
* information. * using the `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building
* for more information.
* *
* Not defined on platforms without * Not defined on platforms without
* @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support". * @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support".

18
src/Magnum/Trade/AbstractImporter.cpp

@ -59,10 +59,28 @@ std::string AbstractImporter::pluginInterface() {
std::vector<std::string> AbstractImporter::pluginSearchPaths() { std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return { return {
#ifdef CORRADE_IS_DEBUG_BUILD #ifdef CORRADE_IS_DEBUG_BUILD
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade-d")), "magnum-d/importers"),
#else
"magnum-d/importers", "magnum-d/importers",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers") Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers")
#ifdef CORRADE_TARGET_WINDOWS
#endif
#else
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_BUILD_STATIC)
Utility::Directory::join(Utility::Directory::path(Utility::Directory::dllLocation(
#ifdef __MINGW32__
"lib"
#endif
"MagnumTrade")), "magnum/importers"),
#else #else
"magnum/importers", "magnum/importers",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers") Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers")
#endif #endif
}; };

12
src/Magnum/Trade/AbstractImporter.h

@ -244,11 +244,13 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
* @brief Plugin search paths * @brief Plugin search paths
* *
* First looks in `magnum/importers/` or `magnum-d/importers/` next to * First looks in `magnum/importers/` or `magnum-d/importers/` next to
* the executable and as a fallback in `magnum/importers/` or * the executable (or, in case of Windows and a non-static build, next
* `magnum-d/importers/` in the runtime install location (`lib[64]/` on * to the DLL of the @ref Trade library) and as a fallback in
* Unix-like systems, `bin/` on Windows). The system-wide plugin search * `magnum/importers/` or `magnum-d/importers/` in the runtime install
* directory is configurable using the `MAGNUM_PLUGINS_DIR` CMake * location (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* variables, see @ref building for more information. * system-wide plugin search directory is configurable using the
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more
* information.
* *
* Not defined on platforms without * Not defined on platforms without
* @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support". * @ref CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT "dynamic plugin support".

Loading…
Cancel
Save