Browse Source

MagnumPlugins: exporting symbols of all plugins.

For consistency. Already done for the magnum-plugins repo and somehow
forgotten here.
pull/176/head
Vladimír Vondruš 10 years ago
parent
commit
f270705f36
  1. 15
      src/MagnumPlugins/MagnumFont/CMakeLists.txt
  2. 46
      src/MagnumPlugins/MagnumFont/MagnumFont.h
  3. 26
      src/MagnumPlugins/MagnumFont/configure.h.cmake
  4. 15
      src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt
  5. 21
      src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h
  6. 1
      src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt
  7. 26
      src/MagnumPlugins/MagnumFontConverter/configure.h.cmake
  8. 12
      src/MagnumPlugins/ObjImporter/CMakeLists.txt
  9. 37
      src/MagnumPlugins/ObjImporter/ObjImporter.h
  10. 7
      src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt
  11. 26
      src/MagnumPlugins/ObjImporter/configure.h.cmake
  12. 12
      src/MagnumPlugins/WavAudioImporter/CMakeLists.txt
  13. 7
      src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt
  14. 33
      src/MagnumPlugins/WavAudioImporter/WavImporter.h
  15. 26
      src/MagnumPlugins/WavAudioImporter/configure.h.cmake

15
src/MagnumPlugins/MagnumFont/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_MAGNUMFONT_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(MagnumFont_SRCS
MagnumFont.cpp)
@ -34,6 +41,9 @@ add_library(MagnumFontObjects OBJECT
${MagnumFont_SRCS}
${MagnumFont_HEADERS})
target_include_directories(MagnumFontObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
target_compile_definitions(MagnumFontObjects PRIVATE "MagnumFontObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFontObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -53,6 +63,7 @@ if(CORRADE_TARGET_WINDOWS)
endif()
install(FILES ${MagnumFont_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFont)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFont)
if(BUILD_GL_TESTS)
# On Win32 we need to avoid dllimporting TgaImporter symbols, because it
@ -63,7 +74,9 @@ if(BUILD_GL_TESTS)
add_library(MagnumMagnumFontTestLib STATIC
${MagnumFont_SRCS}
${MagnumFont_HEADERS})
target_compile_definitions(MagnumMagnumFontTestLib PRIVATE "MAGNUM_TGAIMPORTER_BUILD_STATIC")
target_compile_definitions(MagnumMagnumFontTestLib
PRIVATE "MAGNUM_TGAIMPORTER_BUILD_STATIC"
PUBLIC "MAGNUM_MAGNUMFONT_BUILD_STATIC")
else()
add_library(MagnumMagnumFontTestLib STATIC
$<TARGET_OBJECTS:MagnumFontObjects>

46
src/MagnumPlugins/MagnumFont/MagnumFont.h

@ -32,6 +32,21 @@
#include "Magnum/Text/AbstractFont.h"
#include "Magnum/Trade/Trade.h"
#include "MagnumPlugins/MagnumFont/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_MAGNUMFONT_BUILD_STATIC
#if defined(MagnumFont_EXPORTS) || defined(MagnumFontObjects_EXPORTS)
#define MAGNUM_MAGNUMFONT_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_MAGNUMFONT_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_MAGNUMFONT_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_MAGNUMFONT_LOCAL CORRADE_VISIBILITY_LOCAL
#endif
namespace Magnum { namespace Text {
/**
@ -101,9 +116,9 @@ The file syntax is as in following:
# ...
@see Trade::TgaImporter
@see @ref Trade::TgaImporter
*/
class MagnumFont: public AbstractFont {
class MAGNUM_MAGNUMFONT_EXPORT MagnumFont: public AbstractFont {
public:
/** @brief Default constructor */
explicit MagnumFont();
@ -116,25 +131,18 @@ class MagnumFont: public AbstractFont {
private:
struct Data;
Features doFeatures() const override;
bool doIsOpened() const override;
Metrics doOpenData(const std::vector<std::pair<std::string, Containers::ArrayView<const char>>>& data, Float) override;
Metrics doOpenFile(const std::string& filename, Float) override;
void doClose() override;
UnsignedInt doGlyphId(char32_t character) override;
Vector2 doGlyphAdvance(UnsignedInt glyph) override;
std::unique_ptr<GlyphCache> doCreateGlyphCache() override;
MAGNUM_MAGNUMFONT_LOCAL Features doFeatures() const override;
MAGNUM_MAGNUMFONT_LOCAL bool doIsOpened() const override;
MAGNUM_MAGNUMFONT_LOCAL Metrics doOpenData(const std::vector<std::pair<std::string, Containers::ArrayView<const char>>>& data, Float) override;
MAGNUM_MAGNUMFONT_LOCAL Metrics doOpenFile(const std::string& filename, Float) override;
MAGNUM_MAGNUMFONT_LOCAL void doClose() override;
std::unique_ptr<AbstractLayouter> doLayout(const GlyphCache& cache, Float size, const std::string& text) override;
MAGNUM_MAGNUMFONT_LOCAL UnsignedInt doGlyphId(char32_t character) override;
MAGNUM_MAGNUMFONT_LOCAL Vector2 doGlyphAdvance(UnsignedInt glyph) override;
MAGNUM_MAGNUMFONT_LOCAL std::unique_ptr<GlyphCache> doCreateGlyphCache() override;
MAGNUM_MAGNUMFONT_LOCAL std::unique_ptr<AbstractLayouter> doLayout(const GlyphCache& cache, Float size, const std::string& text) override;
Metrics openInternal(Utility::Configuration&& conf, Trade::ImageData2D&& image);
MAGNUM_MAGNUMFONT_LOCAL Metrics openInternal(Utility::Configuration&& conf, Trade::ImageData2D&& image);
Data* _opened;
};

26
src/MagnumPlugins/MagnumFont/configure.h.cmake

@ -0,0 +1,26 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
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.
*/
#cmakedefine MAGNUM_MAGNUMFONT_BUILD_STATIC

15
src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_MAGNUMFONTCONVERTER_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(MagnumFontConverter_SRCS
MagnumFontConverter.cpp)
@ -34,6 +41,9 @@ add_library(MagnumFontConverterObjects OBJECT
${MagnumFontConverter_SRCS}
${MagnumFontConverter_HEADERS})
target_include_directories(MagnumFontConverterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
target_compile_definitions(MagnumFontConverterObjects PRIVATE "MagnumFontConverterObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(MagnumFontConverterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -53,6 +63,7 @@ if(CORRADE_TARGET_WINDOWS)
endif()
install(FILES ${MagnumFontConverter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFontConverter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFontConverter)
if(BUILD_GL_TESTS)
# On Win32 we need to avoid dllimporting TgaImageConverter symbols, because
@ -63,7 +74,9 @@ if(BUILD_GL_TESTS)
add_library(MagnumMagnumFontConverterTestLib STATIC
${MagnumFontConverter_SRCS}
${MagnumFontConverter_HEADERS})
target_compile_definitions(MagnumMagnumFontConverterTestLib PRIVATE "MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC")
target_compile_definitions(MagnumMagnumFontConverterTestLib
PRIVATE "MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC"
PUBLIC "MAGNUM_MAGNUMFONTCONVERTER_BUILD_STATIC")
else()
add_library(MagnumMagnumFontConverterTestLib STATIC
$<TARGET_OBJECTS:MagnumFontConverterObjects>

21
src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.h

@ -31,6 +31,21 @@
#include "Magnum/Text/AbstractFontConverter.h"
#include "MagnumPlugins/MagnumFontConverter/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_MAGNUMFONTCONVERTER_BUILD_STATIC
#if defined(MagnumFontConverter_EXPORTS) || defined(MagnumFontConverterObjects_EXPORTS)
#define MAGNUM_MAGNUMFONTCONVERTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_MAGNUMFONTCONVERTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_MAGNUMFONTCONVERTER_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_MAGNUMFONTCONVERTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif
namespace Magnum { namespace Text {
/**
@ -49,7 +64,7 @@ dependency of another plugin, you need to request `MagnumFontConverter`
component of `Magnum` package in CMake and link to `Magnum::MagnumFontConverter`
target. See @ref building, @ref cmake and @ref plugins for more information.
*/
class MagnumFontConverter: public Text::AbstractFontConverter {
class MAGNUM_MAGNUMFONTCONVERTER_EXPORT MagnumFontConverter: public Text::AbstractFontConverter {
public:
/** @brief Default constructor */
explicit MagnumFontConverter();
@ -58,8 +73,8 @@ class MagnumFontConverter: public Text::AbstractFontConverter {
explicit MagnumFontConverter(PluginManager::AbstractManager& manager, std::string plugin);
private:
Features doFeatures() const override;
std::vector<std::pair<std::string, Containers::Array<char>>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const override;
MAGNUM_MAGNUMFONTCONVERTER_LOCAL Features doFeatures() const override;
MAGNUM_MAGNUMFONTCONVERTER_LOCAL std::vector<std::pair<std::string, Containers::Array<char>>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const override;
};
}}

1
src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt

@ -31,7 +31,6 @@ corrade_add_test(MagnumFontConverterGLTest MagnumFontConverterGLTest.cpp LIBRARI
MagnumTgaImporterTestLib
${GL_TEST_LIBRARIES})
target_include_directories(MagnumFontConverterGLTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting TgaImporter symbols, because it would
# search for the symbols in some DLL even though they were linked statically.
# However it apparently doesn't matter that they were dllexported when building

26
src/MagnumPlugins/MagnumFontConverter/configure.h.cmake

@ -0,0 +1,26 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
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.
*/
#cmakedefine MAGNUM_MAGNUMFONTCONVERTER_BUILD_STATIC

12
src/MagnumPlugins/ObjImporter/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_OBJIMPORTER_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(ObjImporter_SRCS
ObjImporter.cpp)
@ -34,6 +41,9 @@ add_library(ObjImporterObjects OBJECT
${ObjImporter_SRCS}
${ObjImporter_HEADERS})
target_include_directories(ObjImporterObjects PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
target_compile_definitions(ObjImporterObjects PRIVATE "ObjImporterObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(ObjImporterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -49,12 +59,14 @@ endif()
target_link_libraries(ObjImporter Magnum MagnumMeshTools)
install(FILES ${ObjImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter)
if(BUILD_TESTS)
add_library(MagnumObjImporterTestLib STATIC
$<TARGET_OBJECTS:ObjImporterObjects>
${PROJECT_SOURCE_DIR}/src/dummy.cpp) # XCode workaround, see file comment for details
target_link_libraries(MagnumObjImporterTestLib Magnum MagnumMeshTools)
add_subdirectory(Test)
endif()

37
src/MagnumPlugins/ObjImporter/ObjImporter.h

@ -31,6 +31,21 @@
#include "Magnum/Trade/AbstractImporter.h"
#include "MagnumPlugins/ObjImporter/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_OBJIMPORTER_BUILD_STATIC
#if defined(ObjImporter_EXPORTS) || defined(ObjImporterObjects_EXPORTS)
#define MAGNUM_OBJIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_OBJIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_OBJIMPORTER_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_OBJIMPORTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif
namespace Magnum { namespace Trade {
/**
@ -51,7 +66,7 @@ of another plugin, you need to request `ObjImporter` component of `Magnum`
package in CMake and link to `Magnum::ObjImporter` target. See @ref building,
@ref cmake and @ref plugins for more information.
*/
class ObjImporter: public AbstractImporter {
class MAGNUM_OBJIMPORTER_EXPORT ObjImporter: public AbstractImporter {
public:
/** @brief Default constructor */
explicit ObjImporter();
@ -64,19 +79,19 @@ class ObjImporter: public AbstractImporter {
private:
struct File;
Features doFeatures() const override;
MAGNUM_OBJIMPORTER_LOCAL Features doFeatures() const override;
bool doIsOpened() const override;
void doOpenData(Containers::ArrayView<const char> data) override;
void doOpenFile(const std::string& filename) override;
void doClose() override;
MAGNUM_OBJIMPORTER_LOCAL bool doIsOpened() const override;
MAGNUM_OBJIMPORTER_LOCAL void doOpenData(Containers::ArrayView<const char> data) override;
MAGNUM_OBJIMPORTER_LOCAL void doOpenFile(const std::string& filename) override;
MAGNUM_OBJIMPORTER_LOCAL void doClose() override;
UnsignedInt doMesh3DCount() const override;
Int doMesh3DForName(const std::string& name) override;
std::string doMesh3DName(UnsignedInt id) override;
std::optional<MeshData3D> doMesh3D(UnsignedInt id) override;
MAGNUM_OBJIMPORTER_LOCAL UnsignedInt doMesh3DCount() const override;
MAGNUM_OBJIMPORTER_LOCAL Int doMesh3DForName(const std::string& name) override;
MAGNUM_OBJIMPORTER_LOCAL std::string doMesh3DName(UnsignedInt id) override;
MAGNUM_OBJIMPORTER_LOCAL std::optional<MeshData3D> doMesh3D(UnsignedInt id) override;
void parseMeshNames();
MAGNUM_OBJIMPORTER_LOCAL void parseMeshNames();
std::unique_ptr<File> _file;
};

7
src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt

@ -34,6 +34,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
corrade_add_test(ObjImporterTest Test.cpp LIBRARIES MagnumObjImporterTestLib)
target_include_directories(ObjImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting ObjImporter symbols, because it would
# search for the symbols in some DLL even though they were linked statically.
# However it apparently doesn't matter that they were dllexported when building
# the static library. EH.
if(WIN32)
target_compile_definitions(ObjImporterTest PRIVATE "MAGNUM_OBJIMPORTER_BUILD_STATIC")
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
emscripten_embed_file(ObjImporterTest "" "/")

26
src/MagnumPlugins/ObjImporter/configure.h.cmake

@ -0,0 +1,26 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
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.
*/
#cmakedefine MAGNUM_OBJIMPORTER_BUILD_STATIC

12
src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_WAVAUDIOIMPORTER_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(WavAudioImporter_SRCS
WavHeader.cpp
WavImporter.cpp)
@ -38,6 +45,9 @@ add_library(WavAudioImporterObjects OBJECT
target_include_directories(WavAudioImporterObjects PUBLIC
$<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:MagnumAudio,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT BUILD_PLUGINS_STATIC)
target_compile_definitions(WavAudioImporterObjects PRIVATE "WavAudioImporterObjects_EXPORTS")
endif()
if(NOT BUILD_PLUGINS_STATIC OR BUILD_STATIC_PIC)
set_target_properties(WavAudioImporterObjects PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
@ -53,12 +63,14 @@ endif()
target_link_libraries(WavAudioImporter Magnum MagnumAudio)
install(FILES ${WavAudioImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter)
if(BUILD_TESTS)
add_library(MagnumWavAudioImporterTestLib STATIC
$<TARGET_OBJECTS:WavAudioImporterObjects>
${PROJECT_SOURCE_DIR}/src/dummy.cpp) # XCode workaround, see file comment for details
target_link_libraries(MagnumWavAudioImporterTestLib Magnum MagnumAudio)
add_subdirectory(Test)
endif()

7
src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt

@ -34,6 +34,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
corrade_add_test(WavAudioImporterTest WavImporterTest.cpp LIBRARIES MagnumWavAudioImporterTestLib)
target_include_directories(WavAudioImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# On Win32 we need to avoid dllimporting WavAudioImporter symbols, because it
# would search for the symbols in some DLL even though they were linked
# statically. However it apparently doesn't matter that they were dllexported
# when building the static library. EH.
if(WIN32)
target_compile_definitions(WavAudioImporterTest PRIVATE "MAGNUM_WAVAUDIOIMPORTER_BUILD_STATIC")
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
emscripten_embed_file(WavAudioImporterTest mono8.wav "/mono8.wav")

33
src/MagnumPlugins/WavAudioImporter/WavImporter.h

@ -33,6 +33,21 @@
#include "Magnum/Audio/AbstractImporter.h"
#include "MagnumPlugins/WavAudioImporter/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_WAVAUDIOIMPORTER_BUILD_STATIC
#if defined(WavAudioImporter_EXPORTS) || defined(WavAudioImporterObjects_EXPORTS)
#define MAGNUM_WAVAUDIOIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_WAVAUDIOIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_WAVAUDIOIMPORTER_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_WAVAUDIOIMPORTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif
namespace Magnum { namespace Audio {
/**
@ -49,7 +64,7 @@ dependency of another plugin, you need to request `WavAudioImporter` component
of `Magnum` package in CMake and link to `Magnum::WavAudioImporter` target. See
@ref building, @ref cmake and @ref plugins for more information.
*/
class WavImporter: public AbstractImporter {
class MAGNUM_WAVAUDIOIMPORTER_EXPORT WavImporter: public AbstractImporter {
public:
/** @brief Default constructor */
explicit WavImporter();
@ -58,14 +73,14 @@ class WavImporter: public AbstractImporter {
explicit WavImporter(PluginManager::AbstractManager& manager, std::string plugin);
private:
Features doFeatures() const override;
bool doIsOpened() const override;
void doOpenData(Containers::ArrayView<const char> data) override;
void doClose() override;
Buffer::Format doFormat() const override;
UnsignedInt doFrequency() const override;
Containers::Array<char> doData() override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL Features doFeatures() const override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL bool doIsOpened() const override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL void doOpenData(Containers::ArrayView<const char> data) override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL void doClose() override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL Buffer::Format doFormat() const override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL UnsignedInt doFrequency() const override;
MAGNUM_WAVAUDIOIMPORTER_LOCAL Containers::Array<char> doData() override;
Containers::Array<char> _data;
Buffer::Format _format;

26
src/MagnumPlugins/WavAudioImporter/configure.h.cmake

@ -0,0 +1,26 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
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.
*/
#cmakedefine MAGNUM_WAVAUDIOIMPORTER_BUILD_STATIC
Loading…
Cancel
Save