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
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,
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.

16
src/Magnum/Audio/AbstractImporter.cpp

@ -44,10 +44,26 @@ std::string AbstractImporter::pluginInterface() {
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters")
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters")
#endif
};

13
src/Magnum/Audio/AbstractImporter.h

@ -98,12 +98,13 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagi
* @brief Plugin search paths
*
* First looks in `magnum/audioimporters/` or `magnum-d/audioimporters/`
* next to the executable and as a fallback in `magnum/audioimporters/`
* or `magnum-d/audioimporters/` in the runtime install location
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* system-wide plugin search directory is configurable using the
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more
* information.
* next to the executable (or, in case of Windows and a non-static
* build, next to the DLL of the @ref Audio library) and as a fallback
* in `magnum/audioimporters/` or `magnum-d/audioimporters/` in the
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* Windows). The 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
* @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() {
return {
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts")
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts")
#endif
};

12
src/Magnum/Text/AbstractFont.h

@ -170,11 +170,13 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
* @brief Plugin search paths
*
* First looks in `magnum/fonts/` or `magnum-d/fonts/` next to the
* executable and as a fallback in `magnum/fonts/` or `magnum-d/fonts/`
* in the runtime install location (`lib[64]/` on Unix-like systems,
* `bin/` on Windows). The system-wide plugin search directory is
* configurable using the `MAGNUM_PLUGINS_DIR` CMake variables, see
* @ref building for more information.
* executable (or, in case of Windows and a non-static build, next to
* the DLL of the @ref Text library) and as a fallback in
* `magnum/fonts/` or `magnum-d/fonts/` in the runtime install location
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* 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
* @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() {
return {
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters")
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters")
#endif
};

13
src/Magnum/Text/AbstractFontConverter.h

@ -150,12 +150,13 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* @brief Plugin search paths
*
* First looks in `magnum/fontconverters/` or `magnum-d/fontconverters/`
* next to the executable and as a fallback in `magnum/fontconverters/`
* or `magnum-d/fontconverters/` in the runtime install location
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* system-wide plugin search directory is configurable using the
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more
* information.
* next to the executable (or, in case of Windows and a non-static
* build, next to the DLL of the @ref Text library) and as a fallback
* in `magnum/fontconverters/` or `magnum-d/fontconverters/` in the
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* Windows). The 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
* @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() {
return {
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters")
#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",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters")
#endif
};

13
src/Magnum/Trade/AbstractImageConverter.h

@ -123,12 +123,13 @@ class MAGNUM_TRADE_EXPORT AbstractImageConverter: public PluginManager::Abstract
* @brief Plugin search paths
*
* First looks in `magnum/imageconverters/` or `magnum-d/imageconverters/`
* next to the executable and as a fallback in `magnum/imageconverters/`
* or `magnum-d/imageconverters/` in the runtime install location
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The
* system-wide plugin search directory is configurable using the
* `MAGNUM_PLUGINS_DIR` CMake variables, see @ref building for more
* information.
* next to the executable (or, in case of Windows and a non-static
* build, next to the DLL of the @ref Trade library) and as a fallback
* in `magnum/imageconverters/` or `magnum-d/imageconverters/` in the
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on
* Windows). The 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
* @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() {
return {
#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",
#endif
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
"magnum/importers",
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers")
#endif
};

12
src/Magnum/Trade/AbstractImporter.h

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

Loading…
Cancel
Save