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 # always converts the path to an absolute location internally, making it
# impossible to specify relative paths there. Sorry in advance for not having # impossible to specify relative paths there. Sorry in advance for not having
# the dir selection button in CMake GUI. # 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") 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") 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") CACHE STRING "Base directory where to look for Magnum plugins")
# Plugin directories # Plugin directories. Set only if the above are non-empty. otherwise empty as
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts) # well.
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts) if(MAGNUM_PLUGINS_DIR)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts) set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters) set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters) set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters) set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters) endif()
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters) if(MAGNUM_PLUGINS_DEBUG_DIR)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers) set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers) set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers) set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters) set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters) set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters) 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 # Library version
set(MAGNUM_LIBRARY_VERSION 2.3) 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 @ref CORRADE_BUILD_MULTITHREADED option --- if you are sure that you will never
need such feature, disable it when building Corrade itself. need such feature, disable it when building Corrade itself.
Various plugin interfaces by default search for plugins in pre-defined Various plugin interfaces search for plugins in locations and order documented
locations. By default those are defined to the installation location and can be in @ref Corrade::PluginManager::implicitPluginSearchPaths(),
overriden using the `MAGNUM_PLUGINS_DIR`, `MAGNUM_PLUGINS_DEBUG_DIR` and
`MAGNUM_PLUGINS_RELEASE_DIR` CMake variables --- see also
@ref Trade::AbstractImporter::pluginSearchPaths() and equivalent functions in @ref Trade::AbstractImporter::pluginSearchPaths() and equivalent functions in
other plugin interfaces. Another option is supplying the plugin search path other plugin interfaces. In most cases the implicit behavior does the right
explicitly on the user side either using the same CMake variables (passed thing, but if you need to override those, use the `MAGNUM_PLUGINS_DIR`,
through to preprocessor, see @ref cmake) or via other autodetection means. `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 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 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 Corrade::Utility::Arguments
- @ref Resource is now nothrow-movable and thus can be used with growable - @ref Resource is now nothrow-movable and thus can be used with growable
@ref Corrade::Containers::Array instances @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 @subsubsection changelog-latest-changes-audio Audio library

12
doc/cmake.dox

@ -154,12 +154,12 @@ following:
- `MAGNUM_INCLUDE_INSTALL_PREFIX` --- Prefix where to put - `MAGNUM_INCLUDE_INSTALL_PREFIX` --- Prefix where to put
platform-independent include and other files, defaults to `.`. If a platform-independent include and other files, defaults to `.`. If a
relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`. relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`.
- `MAGNUM_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for debug - `MAGNUM_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for
builds, defaults to `magnum-d/` subdirectory of dir where Magnum library debug builds. Empty by default, which means the directory is autodetected
was found based on library and executable location; override if needed.
- `MAGNUM_PLUGINS_RELEASE_DIR` --- Base directory with dynamic plugins for - `MAGNUM_PLUGINS_RELEASE_DIR` --- Base directory with dynamic plugins for
release builds, defaults to `magnum/` subdirectory of dir where Magnum release builds. Empty by default, which means the directory is autodetected
library was found based on library and executable location; override if needed.
- `MAGNUM_PLUGINS_DIR` --- Base directory with dynamic plugins, defaults to - `MAGNUM_PLUGINS_DIR` --- Base directory with dynamic plugins, defaults to
`MAGNUM_PLUGINS_RELEASE_DIR` in release builds and multi-configuration `MAGNUM_PLUGINS_RELEASE_DIR` in release builds and multi-configuration
builds or to `MAGNUM_PLUGINS_DEBUG_DIR` in debug builds. 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. `MAGNUM_PLUGINS_DIR` variable, especially on multi-configuration build systems.
You can make use of @ref corrade-cmake "CORRADE_IS_DEBUG_BUILD" preprocessor You can make use of @ref corrade-cmake "CORRADE_IS_DEBUG_BUILD" preprocessor
variable along with `MAGNUM_PLUGINS_*_DEBUG_DIR` / `MAGNUM_PLUGINS_*_RELEASE_DIR` 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 Features of found Magnum library are exposed in these CMake variables, they
are also available as preprocessor variables if including 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, # because CMake always converts the path to an absolute location internally,
# making it impossible to specify relative paths there. Sorry in advance for # making it impossible to specify relative paths there. Sorry in advance for
# not having the dir selection button in CMake GUI. # 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") 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") 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") CACHE STRING "Base directory where to look for Magnum plugins")
# Plugin directories # Plugin directories. Set only if the above are non-empty. otherwise empty as
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts) # well.
set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts) if(MAGNUM_PLUGINS_DIR)
set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts) set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters) set(MAGNUM_PLUGINS_FONTCONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters) set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fontconverters) set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_DIR}/imageconverters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters) endif()
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/imageconverters) if(MAGNUM_PLUGINS_DEBUG_DIR)
set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/importers) set(MAGNUM_PLUGINS_FONT_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fonts)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers) set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers) set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/imageconverters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters) set(MAGNUM_PLUGINS_IMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters) set(MAGNUM_PLUGINS_FONT_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/fonts)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters) 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 #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractImporter::pluginSearchPaths() { std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return { return PluginManager::implicitPluginSearchPaths(
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
#ifndef MAGNUM_BUILD_STATIC #ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/audioimporters"), Utility::Directory::libraryLocation(&pluginInterface),
#else #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 #endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters") #ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR,
/* Release build */
#else
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/audioimporters"),
#else #else
#ifndef CORRADE_TARGET_WINDOWS MAGNUM_PLUGINS_AUDIOIMPORTER_DIR,
"../lib/magnum/audioimporters",
#endif
"magnum/audioimporters",
#endif #endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters") #ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif #endif
}; "audioimporters");
} }
#endif #endif

14
src/Magnum/Audio/AbstractImporter.h

@ -133,14 +133,12 @@ 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/` * Looks into `magnum/audioimporters/` or `magnum-d/audioimporters/`
* next to the dynamic @ref Audio library (unless it's a static build), * next to the dynamic @ref Trade library, next to the executable and
* then in the same location next to the executable and as a fallback * elsewhere according to the rules documented in
* in `magnum/audioimporters/` or `magnum-d/audioimporters/` in the * @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on * directory can be also hardcoded using the `MAGNUM_PLUGINS_DIR` CMake
* Windows). The system-wide plugin search directory is configurable * variables, see @ref building for more 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".

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

@ -23,6 +23,5 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}" #define MAGNUM_PLUGINS_AUDIOIMPORTER_DIR "${MAGNUM_PLUGINS_AUDIOIMPORTER_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_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 #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
std::vector<std::string> AbstractFont::pluginSearchPaths() { std::vector<std::string> AbstractFont::pluginSearchPaths() {
return { return PluginManager::implicitPluginSearchPaths(
/* Debug build */
#ifdef CORRADE_IS_DEBUG_BUILD
#ifndef MAGNUM_BUILD_STATIC #ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum-d/fonts"), Utility::Directory::libraryLocation(&pluginInterface),
#else #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 #endif
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts") #ifdef CORRADE_IS_DEBUG_BUILD
MAGNUM_PLUGINS_FONT_DEBUG_DIR,
/* Release build */
#else
#ifndef MAGNUM_BUILD_STATIC
Utility::Directory::join(Utility::Directory::path(Utility::Directory::libraryLocation(&pluginInterface)), "magnum/fonts"),
#else #else
#ifndef CORRADE_TARGET_WINDOWS MAGNUM_PLUGINS_FONT_DIR,
"../lib/magnum/fonts",
#endif
"magnum/fonts",
#endif #endif
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts") #ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/"
#else
"magnum/"
#endif #endif
}; "fonts");
} }
#endif #endif

14
src/Magnum/Text/AbstractFont.h

@ -198,14 +198,12 @@ 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 * Looks into `magnum/fonts/` or `magnum-d/fonts/` next to the dynamic
* dynamic @ref Text library (unless it's a static build), then in the * @ref Trade library, next to the executable and elsewhere according
* same location next to the executable and as a fallback in * to the rules documented in
* `magnum/fonts/` or `magnum-d/fonts/` in the runtime install location * @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* (`lib[64]/` on Unix-like systems, `bin/` on Windows). The * directory can be also hardcoded using the `MAGNUM_PLUGINS_DIR` CMake
* system-wide plugin search directory is configurable using the * variables, see @ref building for more information.
* `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".

33
src/Magnum/Text/AbstractFontConverter.cpp

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

14
src/Magnum/Text/AbstractFontConverter.h

@ -182,14 +182,12 @@ 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/` * Looks into `magnum/fontconverters/` or `magnum-d/fontconverters/`
* next to the dynamic @ref Text library (unless it's a static build), * next to the dynamic @ref Trade library, next to the executable and
* then in the same location next to the executable and as a fallback * elsewhere according to the rules documented in
* in `magnum/fontconverters/` or `magnum-d/fontconverters/` in the * @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on * directory can be also hardcoded using the `MAGNUM_PLUGINS_DIR` CMake
* Windows). The system-wide plugin search directory is configurable * variables, see @ref building for more 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".

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

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

14
src/Magnum/Trade/AbstractImageConverter.h

@ -177,14 +177,12 @@ 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/` * Looks into `magnum/imageconverters/` or `magnum-d/imageconverters/`
* next to the dynamic @ref Trade library (unless it's a static build), * next to the dynamic @ref Trade library, next to the executable and
* then in the same location next to the executable and as a fallback * elsewhere according to the rules documented in
* in `magnum/imageconverters/` or `magnum-d/imageconverters/` in the * @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* runtime install location (`lib[64]/` on Unix-like systems, `bin/` on * directory can be also hardcoded using the `MAGNUM_PLUGINS_DIR` CMake
* Windows). The system-wide plugin search directory is configurable * variables, see @ref building for more 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".

33
src/Magnum/Trade/AbstractImporter.cpp

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

14
src/Magnum/Trade/AbstractImporter.h

@ -297,14 +297,12 @@ 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 * Looks into `magnum/importers/` or `magnum-d/importers/` next to the
* the dynamic @ref Trade library (unless it's a static build), then in * dynamic @ref Trade library, next to the executable and elsewhere
* the same location next to the executable and as a fallback in * according to the rules documented in
* `magnum/importers/` or `magnum-d/importers/` in the runtime install * @ref Corrade::PluginManager::implicitPluginSearchPaths(). The search
* location (`lib[64]/` on Unix-like systems, `bin/` on Windows). The * directory can be also hardcoded using the `MAGNUM_PLUGINS_DIR` CMake
* system-wide plugin search directory is configurable using the * variables, see @ref building for more information.
* `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".

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

@ -23,5 +23,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}" #define MAGNUM_PLUGINS_IMPORTER_DIR "${MAGNUM_PLUGINS_IMPORTER_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_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