diff --git a/src/Primitives/CMakeLists.txt b/src/Primitives/CMakeLists.txt index 189052ec1..19f05fff9 100644 --- a/src/Primitives/CMakeLists.txt +++ b/src/Primitives/CMakeLists.txt @@ -15,10 +15,11 @@ set(MagnumPrimitives_HEADERS Icosphere.h Plane.h Square.h - UVSphere.h) + UVSphere.h -add_library(MagnumPrimitives STATIC ${MagnumPrimitives_SRCS}) -set_target_properties(MagnumPrimitives PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") + magnumPrimitivesVisibility.h) + +add_library(MagnumPrimitives SHARED ${MagnumPrimitives_SRCS}) target_link_libraries(MagnumPrimitives Magnum) install(TARGETS MagnumPrimitives DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) diff --git a/src/Primitives/Capsule.h b/src/Primitives/Capsule.h index dc00e9272..a9cd054da 100644 --- a/src/Primitives/Capsule.h +++ b/src/Primitives/Capsule.h @@ -21,6 +21,8 @@ #include "Trade/MeshData3D.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -53,7 +55,7 @@ class Capsule: public Trade::MeshData3D { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - explicit Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate); + explicit MAGNUM_PRIMITIVES_EXPORT Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate); private: Capsule(std::uint32_t segments, TextureCoords textureCoords); diff --git a/src/Primitives/Crosshair.h b/src/Primitives/Crosshair.h index 55c9841ff..22b7e2e09 100644 --- a/src/Primitives/Crosshair.h +++ b/src/Primitives/Crosshair.h @@ -21,6 +21,8 @@ #include "Trade/Trade.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -29,7 +31,7 @@ namespace Magnum { namespace Primitives { 2x2 wireframe crosshair (two crossed lines), non-indexed @ref Mesh::Primitive "Lines". */ -class Crosshair2D { +class MAGNUM_PRIMITIVES_EXPORT Crosshair2D { public: /** @brief Wireframe crosshair */ static Trade::MeshData2D wireframe(); @@ -43,7 +45,7 @@ class Crosshair2D { 2x2x2 wireframe crosshair (three crossed lines), non-indexed @ref Mesh::Primitive "Lines". */ -class Crosshair3D { +class MAGNUM_PRIMITIVES_EXPORT Crosshair3D { public: /** @brief Wireframe crosshair */ static Trade::MeshData3D wireframe(); diff --git a/src/Primitives/Cube.h b/src/Primitives/Cube.h index c46899fb7..ed6cb1669 100644 --- a/src/Primitives/Cube.h +++ b/src/Primitives/Cube.h @@ -21,6 +21,8 @@ #include "Trade/Trade.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives { 2x2x2 cube. */ -class Cube { +class MAGNUM_PRIMITIVES_EXPORT Cube { public: /** * @brief Solid cube diff --git a/src/Primitives/Cylinder.h b/src/Primitives/Cylinder.h index b1063de92..a5b35beb8 100644 --- a/src/Primitives/Cylinder.h +++ b/src/Primitives/Cylinder.h @@ -23,6 +23,8 @@ #include "Primitives/Capsule.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -58,7 +60,7 @@ class Cylinder: public Capsule { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - explicit Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags()); + explicit MAGNUM_PRIMITIVES_EXPORT Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags()); private: void capVertexRing(GLfloat y, GLfloat textureCoordsV, const Vector3& normal); diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h index 08760c1f2..79f5583e3 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Primitives/Icosphere.h @@ -24,11 +24,13 @@ #include "MeshTools/Clean.h" #include "Trade/MeshData3D.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @todoc Remove `ifndef` when Doxygen is sane again */ #ifndef DOXYGEN_GENERATING_OUTPUT -template class Icosphere; +template class MAGNUM_PRIMITIVES_EXPORT Icosphere; #endif /** diff --git a/src/Primitives/Plane.h b/src/Primitives/Plane.h index 59f22bdf5..72970ed66 100644 --- a/src/Primitives/Plane.h +++ b/src/Primitives/Plane.h @@ -21,6 +21,8 @@ #include "Trade/Trade.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives { 2x2 plane. */ -class Plane { +class MAGNUM_PRIMITIVES_EXPORT Plane { public: /** * @brief Solid plane diff --git a/src/Primitives/Square.h b/src/Primitives/Square.h index 6bd77a172..4d81f9b90 100644 --- a/src/Primitives/Square.h +++ b/src/Primitives/Square.h @@ -21,6 +21,8 @@ #include "Trade/Trade.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives { 2x2 square. */ -class Square { +class MAGNUM_PRIMITIVES_EXPORT Square { public: /** * @brief Solid square diff --git a/src/Primitives/UVSphere.h b/src/Primitives/UVSphere.h index d2e77c4d6..d2cd6400e 100644 --- a/src/Primitives/UVSphere.h +++ b/src/Primitives/UVSphere.h @@ -21,6 +21,8 @@ #include "Primitives/Capsule.h" +#include "Primitives/magnumPrimitivesVisibility.h" + namespace Magnum { namespace Primitives { /** @@ -40,7 +42,7 @@ class UVSphere: public Capsule { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - explicit UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate); + explicit MAGNUM_PRIMITIVES_EXPORT UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate); }; }} diff --git a/src/Primitives/magnumPrimitivesVisibility.h b/src/Primitives/magnumPrimitivesVisibility.h new file mode 100644 index 000000000..cf8191277 --- /dev/null +++ b/src/Primitives/magnumPrimitivesVisibility.h @@ -0,0 +1,28 @@ +#ifndef Magnum_Primitives_magnumPrimitivesVisibility_h +#define Magnum_Primitives_magnumPrimitivesVisibility_h +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +#ifdef _WIN32 + #ifdef MagnumPrimitives_EXPORTS + #define MAGNUM_PRIMITIVES_EXPORT __declspec(dllexport) + #else + #define MAGNUM_PRIMITIVES_EXPORT __declspec(dllimport) + #endif +#else + #define MAGNUM_PRIMITIVES_EXPORT __attribute__ ((visibility ("default"))) +#endif + +#endif