Browse Source

Rework plugin search paths using new Corrade APIs.

pull/427/merge
Vladimír Vondruš 6 years ago
parent
commit
4090a88c97
  1. 45
      CMakeLists.txt
  2. 19
      doc/building.dox
  3. 4
      doc/changelog.dox
  4. 12
      doc/cmake.dox
  5. 45
      modules/FindMagnum.cmake
  6. 33
      src/Magnum/Audio/AbstractImporter.cpp
  7. 14
      src/Magnum/Audio/AbstractImporter.h
  8. 5
      src/Magnum/Audio/configure.h.cmake
  9. 33
      src/Magnum/Text/AbstractFont.cpp
  10. 14
      src/Magnum/Text/AbstractFont.h
  11. 33
      src/Magnum/Text/AbstractFontConverter.cpp
  12. 14
      src/Magnum/Text/AbstractFontConverter.h
  13. 6
      src/Magnum/Text/configure.h.cmake
  14. 33
      src/Magnum/Trade/AbstractImageConverter.cpp
  15. 14
      src/Magnum/Trade/AbstractImageConverter.h
  16. 33
      src/Magnum/Trade/AbstractImporter.cpp
  17. 14
      src/Magnum/Trade/AbstractImporter.h
  18. 6
      src/Magnum/Trade/configure.h.cmake

45
CMakeLists.txt

@ -380,29 +380,36 @@ endif()
# always converts the path to an absolute location internally, making it
# impossible to specify relative paths there. Sorry in advance for not having
# the dir selection button in CMake GUI.
set(MAGNUM_PLUGINS_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR_INIT}
set(MAGNUM_PLUGINS_DEBUG_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins for debug builds")
set(MAGNUM_PLUGINS_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR_INIT}
set(MAGNUM_PLUGINS_RELEASE_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins for release builds")
set(MAGNUM_PLUGINS_DIR ${MAGNUM_PLUGINS_DIR_INIT}
set(MAGNUM_PLUGINS_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins")
# Plugin directories
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)
# Plugin directories. Set only if the above are non-empty. otherwise empty as
# well.
if(MAGNUM_PLUGINS_DIR)
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
endif()
if(MAGNUM_PLUGINS_DEBUG_DIR)
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
endif()
if(MAGNUM_PLUGINS_RELEASE_DIR)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)
endif()
# Library version
set(MAGNUM_LIBRARY_VERSION 2.3)

19
doc/building.dox

@ -521,14 +521,19 @@ thread-local Magnum contents. This is inherited from the
@ref CORRADE_BUILD_MULTITHREADED option --- if you are sure that you will never
need such feature, disable it when building Corrade itself.
Various plugin interfaces by default search for plugins in pre-defined
locations. By default those are defined to the installation location and can be
overriden using the `MAGNUM_PLUGINS_DIR`, `MAGNUM_PLUGINS_DEBUG_DIR` and
`MAGNUM_PLUGINS_RELEASE_DIR` CMake variables --- see also
Various plugin interfaces search for plugins in locations and order documented
in @ref Corrade::PluginManager::implicitPluginSearchPaths(),
@ref Trade::AbstractImporter::pluginSearchPaths() and equivalent functions in
other plugin interfaces. Another option is supplying the plugin search path
explicitly on the user side either using the same CMake variables (passed
through to preprocessor, see @ref cmake) or via other autodetection means.
other plugin interfaces. In most cases the implicit behavior does the right
thing, but if you need to override those, use the `MAGNUM_PLUGINS_DIR`,
`MAGNUM_PLUGINS_DEBUG_DIR` and `MAGNUM_PLUGINS_RELEASE_DIR` CMake variables.
Those are empty by default, which means no hardcoded path is used. Another
option is supplying the plugin search path to the
@ref Corrade::PluginManager::Manger constructor either using the same CMake
variables (passed through to preprocessor, see @ref cmake) or via any other
means. All builtin Magnum utilities such as @ref magnum-imageconverter also
provide a way to override the plugin directory via the `--plugin-dir`
command-line option.
The features used can be conveniently detected in depending projects both in
CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more

4
doc/changelog.dox

@ -297,6 +297,10 @@ See also:
@ref Corrade::Utility::Arguments
- @ref Resource is now nothrow-movable and thus can be used with growable
@ref Corrade::Containers::Array instances
- Reworked plugin search paths to prefer autodetection based on library or
executable location where possible and use hardcoded paths only if
explicitly specified. See @ref Trade::AbstractImporter::pluginSearchPaths()
for more information.
@subsubsection changelog-latest-changes-audio Audio library

12
doc/cmake.dox

@ -154,12 +154,12 @@ following:
- `MAGNUM_INCLUDE_INSTALL_PREFIX` --- Prefix where to put
platform-independent include and other files, defaults to `.`. If a
relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`.
- `MAGNUM_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for debug
builds, defaults to `magnum-d/` subdirectory of dir where Magnum library
was found
- `MAGNUM_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for
debug builds. Empty by default, which means the directory is autodetected
based on library and executable location; override if needed.
- `MAGNUM_PLUGINS_RELEASE_DIR` --- Base directory with dynamic plugins for
release builds, defaults to `magnum/` subdirectory of dir where Magnum
library was found
release builds. Empty by default, which means the directory is autodetected
based on library and executable location; override if needed.
- `MAGNUM_PLUGINS_DIR` --- Base directory with dynamic plugins, defaults to
`MAGNUM_PLUGINS_RELEASE_DIR` in release builds and multi-configuration
builds or to `MAGNUM_PLUGINS_DEBUG_DIR` in debug builds.
@ -297,7 +297,7 @@ release libraries). Note that this autodetection might fail for the
`MAGNUM_PLUGINS_DIR` variable, especially on multi-configuration build systems.
You can make use of @ref corrade-cmake "CORRADE_IS_DEBUG_BUILD" preprocessor
variable along with `MAGNUM_PLUGINS_*_DEBUG_DIR` / `MAGNUM_PLUGINS_*_RELEASE_DIR`
variables to decide in preprocessing step instead.
variables to decide in a preprocessing step instead.
Features of found Magnum library are exposed in these CMake variables, they
are also available as preprocessor variables if including

45
modules/FindMagnum.cmake

@ -1127,26 +1127,33 @@ set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/
# because CMake always converts the path to an absolute location internally,
# making it impossible to specify relative paths there. Sorry in advance for
# not having the dir selection button in CMake GUI.
set(MAGNUM_PLUGINS_DEBUG_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum-d
set(MAGNUM_PLUGINS_DEBUG_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins for debug builds")
set(MAGNUM_PLUGINS_RELEASE_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum
set(MAGNUM_PLUGINS_RELEASE_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins for release builds")
set(MAGNUM_PLUGINS_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum${_MAGNUM_PLUGINS_DIR_SUFFIX}
set(MAGNUM_PLUGINS_DIR ""
CACHE STRING "Base directory where to look for Magnum plugins")
# Plugin directories
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)
# Plugin directories. Set only if the above are non-empty. otherwise empty as
# well.
if(MAGNUM_PLUGINS_DIR)
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
endif()
if(MAGNUM_PLUGINS_DEBUG_DIR)
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
endif()
if(MAGNUM_PLUGINS_RELEASE_DIR)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)
endif()

33
src/Magnum/Audio/AbstractImporter.cpp

@ -43,34 +43,23 @@ std::string AbstractImporter::pluginInterface() {
#ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
return PluginManager::implicitPluginSearchPaths(
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/audioimporters"),
Utility::Directory::libraryLocation(&pluginInterface),
#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"),
#ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR,
#else
#ifndef CORRADE_TARGET_WINDOWS
"../lib/magnum/audioimporters",
#endif
"magnum/audioimporters",
MAGNUM_PLUGINS_AUDIOIMPORTER_DIR,
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters")
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif
};
"audioimporters");
}
#endif

14
src/Magnum/Audio/AbstractImporter.h

@ -133,14 +133,12 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagi
/**
* @brief Plugin search paths
*
* First looks in `magnum/audioimporters/` or `magnum-d/audioimporters/`
* next to the dynamic @ref Audio library (unless it's a static build),
* then in the same location 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.
* Looks into `magnum/audioimporters/` or `magnum-d/audioimporters/`
* next to the dynamic @ref Trade library, next to the executable and
* elsewhere according to the rules documented in
* @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* directory can be also hardcoded 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".

5
src/Magnum/Audio/configure.h.cmake

@ -23,6 +23,5 @@
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"
#define MAGNUM_PLUGINS_AUDIOIMPORTER_DIR "${MAGNUM_PLUGINS_AUDIOIMPORTER_DIR}"
#define MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR "${MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR}"

33
src/Magnum/Text/AbstractFont.cpp

@ -48,34 +48,23 @@ std::string AbstractFont::pluginInterface() {
#ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractFont::pluginSearchPaths() {
return {
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
return PluginManager::implicitPluginSearchPaths(
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fonts"),
Utility::Directory::libraryLocation(&pluginInterface),
#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/fonts",
#endif
"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"),
#ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_FONT_DEBUG_DIR,
#else
#ifndef CORRADE_TARGET_WINDOWS
"../lib/magnum/fonts",
#endif
"magnum/fonts",
MAGNUM_PLUGINS_FONT_DIR,
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts")
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif
};
"fonts");
}
#endif

14
src/Magnum/Text/AbstractFont.h

@ -198,14 +198,12 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
/**
* @brief Plugin search paths
*
* First looks in `magnum/fonts/` or `magnum-d/fonts/` next to the
* dynamic @ref Text library (unless it's a static build), then in the
* same location 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.
* Looks into `magnum/fonts/` or `magnum-d/fonts/` next to the dynamic
* @ref Trade library, next to the executable and elsewhere according
* to the rules documented in
* @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* directory can be also hardcoded 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".

33
src/Magnum/Text/AbstractFontConverter.cpp

@ -63,34 +63,23 @@ std::string AbstractFontConverter::pluginInterface() {
#ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractFontConverter::pluginSearchPaths() {
return {
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
return PluginManager::implicitPluginSearchPaths(
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fontconverters"),
Utility::Directory::libraryLocation(&pluginInterface),
#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"),
#ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR,
#else
#ifndef CORRADE_TARGET_WINDOWS
"../lib/magnum/fontconverters",
#endif
"magnum/fontconverters",
MAGNUM_PLUGINS_FONTCONVERTER_DIR,
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters")
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif
};
"fontconverters");
}
#endif

14
src/Magnum/Text/AbstractFontConverter.h

@ -182,14 +182,12 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
/**
* @brief Plugin search paths
*
* First looks in `magnum/fontconverters/` or `magnum-d/fontconverters/`
* next to the dynamic @ref Text library (unless it's a static build),
* then in the same location 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.
* Looks into `magnum/fontconverters/` or `magnum-d/fontconverters/`
* next to the dynamic @ref Trade library, next to the executable and
* elsewhere according to the rules documented in
* @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* directory can be also hardcoded 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".

6
src/Magnum/Text/configure.h.cmake

@ -23,5 +23,7 @@
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"
#define MAGNUM_PLUGINS_FONT_DIR "${MAGNUM_PLUGINS_FONT_DIR}"
#define MAGNUM_PLUGINS_FONT_DEBUG_DIR "${MAGNUM_PLUGINS_FONT_DEBUG_DIR}"
#define MAGNUM_PLUGINS_FONTCONVERTER_DIR "${MAGNUM_PLUGINS_FONTCONVERTER_DIR}"
#define MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR "${MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR}"

33
src/Magnum/Trade/AbstractImageConverter.cpp

@ -48,34 +48,23 @@ std::string AbstractImageConverter::pluginInterface() {
#ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractImageConverter::pluginSearchPaths() {
return {
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
return PluginManager::implicitPluginSearchPaths(
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/imageconverters"),
Utility::Directory::libraryLocation(&pluginInterface),
#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/imageconverters",
#endif
"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"),
#ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR,
#else
#ifndef CORRADE_TARGET_WINDOWS
"../lib/magnum/imageconverters",
#endif
"magnum/imageconverters",
MAGNUM_PLUGINS_IMAGECONVERTER_DIR,
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters")
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif
};
"imageconverters");
}
#endif

14
src/Magnum/Trade/AbstractImageConverter.h

@ -177,14 +177,12 @@ class MAGNUM_TRADE_EXPORT AbstractImageConverter: public PluginManager::Abstract
/**
* @brief Plugin search paths
*
* First looks in `magnum/imageconverters/` or `magnum-d/imageconverters/`
* next to the dynamic @ref Trade library (unless it's a static build),
* then in the same location 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.
* Looks into `magnum/imageconverters/` or `magnum-d/imageconverters/`
* next to the dynamic @ref Trade library, next to the executable and
* elsewhere according to the rules documented in
* @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* directory can be also hardcoded 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".

33
src/Magnum/Trade/AbstractImporter.cpp

@ -64,34 +64,23 @@ std::string AbstractImporter::pluginInterface() {
#ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
return PluginManager::implicitPluginSearchPaths(
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/importers"),
Utility::Directory::libraryLocation(&pluginInterface),
#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/importers",
#endif
"magnum-d/importers",
{},
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers")
/* Release build */
#else
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/importers"),
#ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR,
#else
#ifndef CORRADE_TARGET_WINDOWS
"../lib/magnum/importers",
#endif
"magnum/importers",
MAGNUM_PLUGINS_IMPORTER_DIR,
#endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers")
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif
};
"importers");
}
#endif

14
src/Magnum/Trade/AbstractImporter.h

@ -297,14 +297,12 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
/**
* @brief Plugin search paths
*
* First looks in `magnum/importers/` or `magnum-d/importers/` next to
* the dynamic @ref Trade library (unless it's a static build), then in
* the same location 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.
* Looks into `magnum/importers/` or `magnum-d/importers/` next to the
* dynamic @ref Trade library, next to the executable and elsewhere
* according to the rules documented in
* @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* directory can be also hardcoded 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".

6
src/Magnum/Trade/configure.h.cmake

@ -23,5 +23,7 @@
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"
#define MAGNUM_PLUGINS_IMPORTER_DIR "${MAGNUM_PLUGINS_IMPORTER_DIR}"
#define MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR "${MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR}"
#define MAGNUM_PLUGINS_IMAGECONVERTER_DIR "${MAGNUM_PLUGINS_IMAGECONVERTER_DIR}"
#define MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR "${MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR}"

Loading…
Cancel
Save