Browse Source

TgaImageConverter, TgaImporter: export symbols only on dynamic build.

Mainly to fix linker errors on Windows when using static plugins as
dependencies of other plugins. Don't even let me get started on how much
I hate the dllexport/dllimport hell.
pull/88/head
Vladimír Vondruš 11 years ago
parent
commit
5c75770a1b
  1. 8
      src/MagnumPlugins/TgaImageConverter/CMakeLists.txt
  2. 12
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
  3. 26
      src/MagnumPlugins/TgaImageConverter/configure.h.cmake
  4. 8
      src/MagnumPlugins/TgaImporter/CMakeLists.txt
  5. 12
      src/MagnumPlugins/TgaImporter/TgaImporter.h
  6. 26
      src/MagnumPlugins/TgaImporter/configure.h.cmake

8
src/MagnumPlugins/TgaImageConverter/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(TgaImageConverter_SRCS
TgaImageConverter.cpp)
@ -52,6 +59,7 @@ endif()
target_link_libraries(TgaImageConverter Magnum)
install(FILES ${TgaImageConverter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter/configure.h)
if(BUILD_TESTS)
add_library(MagnumTgaImageConverterTestLib STATIC $<TARGET_OBJECTS:TgaImageConverterObjects>)

12
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h

@ -31,11 +31,17 @@
#include "Magnum/Trade/AbstractImageConverter.h"
#include "MagnumPlugins/TgaImageConverter/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#if defined(TgaImageConverter_EXPORTS) || defined(TgaImageConverterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_EXPORT
#ifndef MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC
#if defined(TgaImageConverter_EXPORTS) || defined(TgaImageConverterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_IMPORT
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_TRADE_TGAIMAGECONVERTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif

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

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

8
src/MagnumPlugins/TgaImporter/CMakeLists.txt

@ -23,6 +23,13 @@
# DEALINGS IN THE SOFTWARE.
#
if(BUILD_PLUGINS_STATIC)
set(MAGNUM_TGAIMPORTER_BUILD_STATIC 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
set(TgaImporter_SRCS
TgaImporter.cpp)
@ -53,6 +60,7 @@ endif()
target_link_libraries(TgaImporter Magnum)
install(FILES ${TgaImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter/configure.h)
if(BUILD_TESTS)
add_library(MagnumTgaImporterTestLib STATIC $<TARGET_OBJECTS:TgaImporterObjects>)

12
src/MagnumPlugins/TgaImporter/TgaImporter.h

@ -33,11 +33,17 @@
#include "Magnum/Trade/AbstractImporter.h"
#include "MagnumPlugins/TgaImporter/configure.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#if defined(TgaImporter_EXPORTS) || defined(TgaImporterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#ifndef MAGNUM_TGAIMPORTER_BUILD_STATIC
#if defined(TgaImporter_EXPORTS) || defined(TgaImporterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#else
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_STATIC
#endif
#define MAGNUM_TRADE_TGAIMPORTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif

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

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