Browse Source

Primitives: the library is now shared instead of static.

Saves 2.5M of ~16M of debug build size.
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
ba547fb7f8
  1. 7
      src/Primitives/CMakeLists.txt
  2. 4
      src/Primitives/Capsule.h
  3. 6
      src/Primitives/Crosshair.h
  4. 4
      src/Primitives/Cube.h
  5. 4
      src/Primitives/Cylinder.h
  6. 4
      src/Primitives/Icosphere.h
  7. 4
      src/Primitives/Plane.h
  8. 4
      src/Primitives/Square.h
  9. 4
      src/Primitives/UVSphere.h
  10. 28
      src/Primitives/magnumPrimitivesVisibility.h

7
src/Primitives/CMakeLists.txt

@ -15,10 +15,11 @@ set(MagnumPrimitives_HEADERS
Icosphere.h Icosphere.h
Plane.h Plane.h
Square.h Square.h
UVSphere.h) UVSphere.h
add_library(MagnumPrimitives STATIC ${MagnumPrimitives_SRCS}) magnumPrimitivesVisibility.h)
set_target_properties(MagnumPrimitives PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
add_library(MagnumPrimitives SHARED ${MagnumPrimitives_SRCS})
target_link_libraries(MagnumPrimitives Magnum) target_link_libraries(MagnumPrimitives Magnum)
install(TARGETS MagnumPrimitives DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}) install(TARGETS MagnumPrimitives DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})

4
src/Primitives/Capsule.h

@ -21,6 +21,8 @@
#include "Trade/MeshData3D.h" #include "Trade/MeshData3D.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -53,7 +55,7 @@ class Capsule: public Trade::MeshData3D {
* If texture coordinates are generated, vertices of one segment are * If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping. * 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: private:
Capsule(std::uint32_t segments, TextureCoords textureCoords); Capsule(std::uint32_t segments, TextureCoords textureCoords);

6
src/Primitives/Crosshair.h

@ -21,6 +21,8 @@
#include "Trade/Trade.h" #include "Trade/Trade.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -29,7 +31,7 @@ namespace Magnum { namespace Primitives {
2x2 wireframe crosshair (two crossed lines), non-indexed 2x2 wireframe crosshair (two crossed lines), non-indexed
@ref Mesh::Primitive "Lines". @ref Mesh::Primitive "Lines".
*/ */
class Crosshair2D { class MAGNUM_PRIMITIVES_EXPORT Crosshair2D {
public: public:
/** @brief Wireframe crosshair */ /** @brief Wireframe crosshair */
static Trade::MeshData2D wireframe(); static Trade::MeshData2D wireframe();
@ -43,7 +45,7 @@ class Crosshair2D {
2x2x2 wireframe crosshair (three crossed lines), non-indexed 2x2x2 wireframe crosshair (three crossed lines), non-indexed
@ref Mesh::Primitive "Lines". @ref Mesh::Primitive "Lines".
*/ */
class Crosshair3D { class MAGNUM_PRIMITIVES_EXPORT Crosshair3D {
public: public:
/** @brief Wireframe crosshair */ /** @brief Wireframe crosshair */
static Trade::MeshData3D wireframe(); static Trade::MeshData3D wireframe();

4
src/Primitives/Cube.h

@ -21,6 +21,8 @@
#include "Trade/Trade.h" #include "Trade/Trade.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives {
2x2x2 cube. 2x2x2 cube.
*/ */
class Cube { class MAGNUM_PRIMITIVES_EXPORT Cube {
public: public:
/** /**
* @brief Solid cube * @brief Solid cube

4
src/Primitives/Cylinder.h

@ -23,6 +23,8 @@
#include "Primitives/Capsule.h" #include "Primitives/Capsule.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -58,7 +60,7 @@ class Cylinder: public Capsule {
* If texture coordinates are generated, vertices of one segment are * If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping. * 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: private:
void capVertexRing(GLfloat y, GLfloat textureCoordsV, const Vector3& normal); void capVertexRing(GLfloat y, GLfloat textureCoordsV, const Vector3& normal);

4
src/Primitives/Icosphere.h

@ -24,11 +24,13 @@
#include "MeshTools/Clean.h" #include "MeshTools/Clean.h"
#include "Trade/MeshData3D.h" #include "Trade/MeshData3D.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** @todoc Remove `ifndef` when Doxygen is sane again */ /** @todoc Remove `ifndef` when Doxygen is sane again */
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<std::size_t subdivisions> class Icosphere; template<std::size_t subdivisions> class MAGNUM_PRIMITIVES_EXPORT Icosphere;
#endif #endif
/** /**

4
src/Primitives/Plane.h

@ -21,6 +21,8 @@
#include "Trade/Trade.h" #include "Trade/Trade.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives {
2x2 plane. 2x2 plane.
*/ */
class Plane { class MAGNUM_PRIMITIVES_EXPORT Plane {
public: public:
/** /**
* @brief Solid plane * @brief Solid plane

4
src/Primitives/Square.h

@ -21,6 +21,8 @@
#include "Trade/Trade.h" #include "Trade/Trade.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -28,7 +30,7 @@ namespace Magnum { namespace Primitives {
2x2 square. 2x2 square.
*/ */
class Square { class MAGNUM_PRIMITIVES_EXPORT Square {
public: public:
/** /**
* @brief Solid square * @brief Solid square

4
src/Primitives/UVSphere.h

@ -21,6 +21,8 @@
#include "Primitives/Capsule.h" #include "Primitives/Capsule.h"
#include "Primitives/magnumPrimitivesVisibility.h"
namespace Magnum { namespace Primitives { namespace Magnum { namespace Primitives {
/** /**
@ -40,7 +42,7 @@ class UVSphere: public Capsule {
* If texture coordinates are generated, vertices of one segment are * If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping. * 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);
}; };
}} }}

28
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š <mosra@centrum.cz>
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
Loading…
Cancel
Save