Browse Source

Implement pluginSearchPaths() for all plugin interfaces.

pull/205/head
Vladimír Vondruš 8 years ago
parent
commit
d1ed10c0a8
  1. 8
      doc/changelog.dox
  2. 14
      src/Magnum/Audio/AbstractImporter.cpp
  3. 13
      src/Magnum/Audio/AbstractImporter.h
  4. 3
      src/Magnum/Audio/CMakeLists.txt
  5. 28
      src/Magnum/Audio/configure.h.cmake
  6. 14
      src/Magnum/Text/AbstractFont.cpp
  7. 12
      src/Magnum/Text/AbstractFont.h
  8. 14
      src/Magnum/Text/AbstractFontConverter.cpp
  9. 13
      src/Magnum/Text/AbstractFontConverter.h
  10. 3
      src/Magnum/Text/CMakeLists.txt
  11. 27
      src/Magnum/Text/configure.h.cmake
  12. 13
      src/Magnum/Trade/AbstractImageConverter.cpp
  13. 13
      src/Magnum/Trade/AbstractImageConverter.h
  14. 13
      src/Magnum/Trade/AbstractImporter.cpp
  15. 12
      src/Magnum/Trade/AbstractImporter.h
  16. 3
      src/Magnum/Trade/CMakeLists.txt
  17. 27
      src/Magnum/Trade/configure.h.cmake

8
doc/changelog.dox

@ -73,6 +73,14 @@ See also:
@ref Primitives::grid3DSolid() and @ref Primitives::grid3DWireframe() @ref Primitives::grid3DSolid() and @ref Primitives::grid3DWireframe()
primitives primitives
@subsection changelog-latest-buildsystem Build system
- All plugin interfaces now implement
@ref Corrade::PluginManager::AbstractPlugin::pluginSearchPaths() "pluginSearchPaths()"
for plugin directory autodetection --- you no longer need to specify the
plugin directory explicitly when loading plugins. See @ref plugins-loading
for more information.
@subsection changelog-latest-bugfixes Bug fixes @subsection changelog-latest-bugfixes Bug fixes
- Engine startup info was not properly printed to Android log since - Engine startup info was not properly printed to Android log since

14
src/Magnum/Audio/AbstractImporter.cpp

@ -29,12 +29,26 @@
#include <Corrade/Utility/Assert.h> #include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Directory.h> #include <Corrade/Utility/Directory.h>
#include "Magnum/Audio/configure.h"
namespace Magnum { namespace Audio { namespace Magnum { namespace Audio {
std::string AbstractImporter::pluginInterface() { std::string AbstractImporter::pluginInterface() {
return "cz.mosra.magnum.Audio.AbstractImporter/0.1"; return "cz.mosra.magnum.Audio.AbstractImporter/0.1";
} }
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/audioimporters",
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "audioimporters")
#else
"magnum/audioimporters",
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "audioimporters")
#endif
};
}
AbstractImporter::AbstractImporter() = default; AbstractImporter::AbstractImporter() = default;
AbstractImporter::AbstractImporter(PluginManager::Manager<AbstractImporter>& manager): PluginManager::AbstractManagingPlugin<AbstractImporter>{manager} {} AbstractImporter::AbstractImporter(PluginManager::Manager<AbstractImporter>& manager): PluginManager::AbstractManagingPlugin<AbstractImporter>{manager} {}

13
src/Magnum/Audio/AbstractImporter.h

@ -93,6 +93,19 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagi
*/ */
static std::string pluginInterface(); static std::string pluginInterface();
/**
* @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.
*/
static std::vector<std::string> pluginSearchPaths();
/** @brief Default constructor */ /** @brief Default constructor */
explicit AbstractImporter(); explicit AbstractImporter();

3
src/Magnum/Audio/CMakeLists.txt

@ -44,6 +44,9 @@ set(MagnumAudio_HEADERS
visibility.h) visibility.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
if(WITH_SCENEGRAPH) if(WITH_SCENEGRAPH)
list(APPEND MagnumAudio_HEADERS list(APPEND MagnumAudio_HEADERS
Listener.h Listener.h

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

@ -0,0 +1,28 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"

14
src/Magnum/Text/AbstractFont.cpp

@ -32,12 +32,26 @@
#include "Magnum/Math/Functions.h" #include "Magnum/Math/Functions.h"
#include "Magnum/Text/GlyphCache.h" #include "Magnum/Text/GlyphCache.h"
#include "Magnum/Text/configure.h"
namespace Magnum { namespace Text { namespace Magnum { namespace Text {
std::string AbstractFont::pluginInterface() { std::string AbstractFont::pluginInterface() {
return "cz.mosra.magnum.Text.AbstractFont/0.2.4"; return "cz.mosra.magnum.Text.AbstractFont/0.2.4";
} }
std::vector<std::string> AbstractFont::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/fonts",
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fonts")
#else
"magnum/fonts",
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fonts")
#endif
};
}
AbstractFont::AbstractFont(): _size(0.0f) {} AbstractFont::AbstractFont(): _size(0.0f) {}
AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, const std::string& plugin): AbstractPlugin{manager, plugin}, _size{0.0f}, _lineHeight{0.0f} {} AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, const std::string& plugin): AbstractPlugin{manager, plugin}, _size{0.0f}, _lineHeight{0.0f} {}

12
src/Magnum/Text/AbstractFont.h

@ -109,6 +109,18 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
*/ */
static std::string pluginInterface(); static std::string pluginInterface();
/**
* @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.
*/
static std::vector<std::string> pluginSearchPaths();
/** @brief Default constructor */ /** @brief Default constructor */
explicit AbstractFont(); explicit AbstractFont();

14
src/Magnum/Text/AbstractFontConverter.cpp

@ -33,6 +33,8 @@
#include "Magnum/Text/GlyphCache.h" #include "Magnum/Text/GlyphCache.h"
#include "Magnum/Text/configure.h"
namespace Magnum { namespace Text { namespace Magnum { namespace Text {
namespace { namespace {
@ -55,6 +57,18 @@ std::string AbstractFontConverter::pluginInterface() {
return "cz.mosra.magnum.Text.AbstractFontConverter/0.1.2"; return "cz.mosra.magnum.Text.AbstractFontConverter/0.1.2";
} }
std::vector<std::string> AbstractFontConverter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/fontconverters",
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "fontconverters")
#else
"magnum/fontconverters",
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "fontconverters")
#endif
};
}
AbstractFontConverter::AbstractFontConverter() = default; AbstractFontConverter::AbstractFontConverter() = default;
AbstractFontConverter::AbstractFontConverter(PluginManager::AbstractManager& manager, const std::string& plugin): PluginManager::AbstractPlugin{manager, plugin} {} AbstractFontConverter::AbstractFontConverter(PluginManager::AbstractManager& manager, const std::string& plugin): PluginManager::AbstractPlugin{manager, plugin} {}

13
src/Magnum/Text/AbstractFontConverter.h

@ -135,6 +135,19 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
*/ */
static std::string pluginInterface(); static std::string pluginInterface();
/**
* @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.
*/
static std::vector<std::string> pluginSearchPaths();
/** @brief Default constructor */ /** @brief Default constructor */
explicit AbstractFontConverter(); explicit AbstractFontConverter();

3
src/Magnum/Text/CMakeLists.txt

@ -40,6 +40,9 @@ set(MagnumText_HEADERS
visibility.h) visibility.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
# Text library # Text library
add_library(MagnumText ${SHARED_OR_STATIC} add_library(MagnumText ${SHARED_OR_STATIC}
${MagnumText_SRCS} ${MagnumText_SRCS}

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

@ -0,0 +1,27 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"

13
src/Magnum/Trade/AbstractImageConverter.cpp

@ -31,6 +31,7 @@
#include "Magnum/Image.h" #include "Magnum/Image.h"
#include "Magnum/Trade/ImageData.h" #include "Magnum/Trade/ImageData.h"
#include "Magnum/Trade/configure.h"
namespace Magnum { namespace Trade { namespace Magnum { namespace Trade {
@ -38,6 +39,18 @@ std::string AbstractImageConverter::pluginInterface() {
return "cz.mosra.magnum.Trade.AbstractImporter/0.3"; return "cz.mosra.magnum.Trade.AbstractImporter/0.3";
} }
std::vector<std::string> AbstractImageConverter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/imageconverters",
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "imageconverters")
#else
"magnum/imageconverters",
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "imageconverters")
#endif
};
}
AbstractImageConverter::AbstractImageConverter() = default; AbstractImageConverter::AbstractImageConverter() = default;
AbstractImageConverter::AbstractImageConverter(PluginManager::Manager<AbstractImageConverter>& manager): PluginManager::AbstractManagingPlugin<AbstractImageConverter>{manager} {} AbstractImageConverter::AbstractImageConverter(PluginManager::Manager<AbstractImageConverter>& manager): PluginManager::AbstractManagingPlugin<AbstractImageConverter>{manager} {}

13
src/Magnum/Trade/AbstractImageConverter.h

@ -123,6 +123,19 @@ class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractManagi
*/ */
static std::string pluginInterface(); static std::string pluginInterface();
/**
* @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.
*/
static std::vector<std::string> pluginSearchPaths();
/** @brief Default constructor */ /** @brief Default constructor */
explicit AbstractImageConverter(); explicit AbstractImageConverter();

13
src/Magnum/Trade/AbstractImporter.cpp

@ -40,6 +40,7 @@
#include "Magnum/Trade/ObjectData3D.h" #include "Magnum/Trade/ObjectData3D.h"
#include "Magnum/Trade/SceneData.h" #include "Magnum/Trade/SceneData.h"
#include "Magnum/Trade/TextureData.h" #include "Magnum/Trade/TextureData.h"
#include "Magnum/Trade/configure.h"
namespace Magnum { namespace Trade { namespace Magnum { namespace Trade {
@ -47,6 +48,18 @@ std::string AbstractImporter::pluginInterface() {
return "cz.mosra.magnum.Trade.AbstractImporter/0.3"; return "cz.mosra.magnum.Trade.AbstractImporter/0.3";
} }
std::vector<std::string> AbstractImporter::pluginSearchPaths() {
return {
#ifdef CORRADE_IS_DEBUG_BUILD
"magnum-d/importers",
Utility::Directory::join(MAGNUM_PLUGINS_DEBUG_DIR, "importers")
#else
"magnum/importers",
Utility::Directory::join(MAGNUM_PLUGINS_DIR, "importers")
#endif
};
}
AbstractImporter::AbstractImporter() = default; AbstractImporter::AbstractImporter() = default;
AbstractImporter::AbstractImporter(PluginManager::Manager<AbstractImporter>& manager): PluginManager::AbstractManagingPlugin<AbstractImporter>{manager} {} AbstractImporter::AbstractImporter(PluginManager::Manager<AbstractImporter>& manager): PluginManager::AbstractManagingPlugin<AbstractImporter>{manager} {}

12
src/Magnum/Trade/AbstractImporter.h

@ -113,6 +113,18 @@ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlug
*/ */
static std::string pluginInterface(); static std::string pluginInterface();
/**
* @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.
*/
static std::vector<std::string> pluginSearchPaths();
/** @brief Default constructor */ /** @brief Default constructor */
explicit AbstractImporter(); explicit AbstractImporter();

3
src/Magnum/Trade/CMakeLists.txt

@ -41,6 +41,9 @@ set(MagnumTrade_HEADERS
TextureData.h TextureData.h
Trade.h) Trade.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
# Force IDEs to display all header files in project view # Force IDEs to display all header files in project view
add_custom_target(MagnumTrade SOURCES ${MagnumTrade_HEADERS}) add_custom_target(MagnumTrade SOURCES ${MagnumTrade_HEADERS})
set_target_properties(MagnumTrade PROPERTIES FOLDER "Magnum/Trade") set_target_properties(MagnumTrade PROPERTIES FOLDER "Magnum/Trade")

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

@ -0,0 +1,27 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}"
#define MAGNUM_PLUGINS_DEBUG_DIR "${MAGNUM_PLUGINS_DEBUG_DIR}"
Loading…
Cancel
Save