diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index c13ad549d..26e2b80e8 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -102,6 +102,11 @@ macro(sfml_add_library target) # create the target add_library(${target} ${THIS_SOURCES}) + # define the export symbol of the module + string(REPLACE "-" "_" NAME_UPPER "${target}") + string(TOUPPER "${NAME_UPPER}" NAME_UPPER) + set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS) + # adjust the output file prefix/suffix to match our conventions if(BUILD_SHARED_LIBS) if(WINDOWS) diff --git a/include/SFML/Audio/Export.hpp b/include/SFML/Audio/Export.hpp new file mode 100644 index 000000000..f2df3af9c --- /dev/null +++ b/include/SFML/Audio/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_EXPORT_HPP +#define SFML_AUDIO_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_AUDIO_EXPORTS) + + #define SFML_AUDIO_API SFML_API_EXPORT + +#else + + #define SFML_AUDIO_API SFML_API_IMPORT + +#endif + + +#endif // SFML_AUDIO_EXPORT_HPP diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp index a8bc1b35d..0d36a9f5d 100644 --- a/include/SFML/Audio/Listener.hpp +++ b/include/SFML/Audio/Listener.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -39,7 +39,7 @@ namespace sf /// from where all the sounds are heard /// //////////////////////////////////////////////////////////// -class SFML_API Listener +class SFML_AUDIO_API Listener { public : diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 83367f561..6100b2e04 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -48,7 +49,7 @@ class InputStream; /// \brief Streamed music played from an audio file /// //////////////////////////////////////////////////////////// -class SFML_API Music : public SoundStream +class SFML_AUDIO_API Music : public SoundStream { public : diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index 8985a2b01..9d2fa6239 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -41,7 +42,7 @@ class SoundBuffer; /// \brief Regular sound that can be played in the audio environment /// //////////////////////////////////////////////////////////// -class SFML_API Sound : public SoundSource +class SFML_AUDIO_API Sound : public SoundSource { public : diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index 2144bbfc7..60d850b5f 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -49,7 +49,7 @@ class InputStream; /// \brief Storage for audio samples defining a sound /// //////////////////////////////////////////////////////////// -class SFML_API SoundBuffer +class SFML_AUDIO_API SoundBuffer { public : diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp index aeea49687..ec3603c31 100644 --- a/include/SFML/Audio/SoundBufferRecorder.hpp +++ b/include/SFML/Audio/SoundBufferRecorder.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -40,7 +41,7 @@ namespace sf /// audio data into a sound buffer /// //////////////////////////////////////////////////////////// -class SFML_API SoundBufferRecorder : public SoundRecorder +class SFML_AUDIO_API SoundBufferRecorder : public SoundRecorder { public : diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index 35567efcc..13b056ce7 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -38,7 +39,7 @@ namespace sf /// \brief Abstract base class for capturing sound data /// //////////////////////////////////////////////////////////// -class SFML_API SoundRecorder +class SFML_AUDIO_API SoundRecorder { public : diff --git a/include/SFML/Audio/SoundSource.hpp b/include/SFML/Audio/SoundSource.hpp index cc75a8016..c1352e93b 100644 --- a/include/SFML/Audio/SoundSource.hpp +++ b/include/SFML/Audio/SoundSource.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -38,7 +38,7 @@ namespace sf /// \brief Base class defining a sound's properties /// //////////////////////////////////////////////////////////// -class SFML_API SoundSource +class SFML_AUDIO_API SoundSource { public : diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index ff6d0c239..315dd731f 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -40,7 +41,7 @@ namespace sf /// \brief Abstract base class for streamed audio sources /// //////////////////////////////////////////////////////////// -class SFML_API SoundStream : public SoundSource +class SFML_AUDIO_API SoundStream : public SoundSource { public : diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp index d9df3f6cb..377202330 100644 --- a/include/SFML/Config.hpp +++ b/include/SFML/Config.hpp @@ -68,7 +68,7 @@ //////////////////////////////////////////////////////////// -// Identify the endianess +// Identify the endianness //////////////////////////////////////////////////////////// #if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__) @@ -95,27 +95,17 @@ //////////////////////////////////////////////////////////// -// Define portable import / export macros +// Define helpers to create portable import / export macros for each module //////////////////////////////////////////////////////////// #if !defined(SFML_STATIC) #if defined(SFML_SYSTEM_WINDOWS) - #ifdef SFML_EXPORTS + // Windows compilers need specific (and different) keywords for export and import + #define SFML_API_EXPORT __declspec(dllexport) + #define SFML_API_IMPORT __declspec(dllimport) - // From DLL side, we must export - #define SFML_API __declspec(dllexport) - - #else - - // From client application side, we must import - #define SFML_API __declspec(dllimport) - - #endif - - // For Visual C++ compilers, we also need to turn off this annoying C4251 warning. - // You can read lots ot different things about it, but the point is the code will - // just work fine, and so the simplest way to get rid of this warning is to disable it + // For Visual C++ compilers, we also need to turn off this annoying C4251 warning #ifdef _MSC_VER #pragma warning(disable : 4251) @@ -126,13 +116,16 @@ #if __GNUC__ >= 4 - // gcc 4 has special keywords for showing/hidding symbols - #define SFML_API __attribute__ ((__visibility__ ("default"))) + // GCC 4 has special keywords for showing/hidding symbols, + // the same keyword is used for both importing and exporting + #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default"))) + #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default"))) #else - // gcc < 4 has no mechanism to explicitely hide symbols, everything's exported - #define SFML_API + // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported + #define SFML_API_EXPORT + #define SFML_API_IMPORT #endif @@ -140,8 +133,9 @@ #else - // Static build doesn't need these export macros - #define SFML_API + // Static build doesn't need import/export macros + #define SFML_API_EXPORT + #define SFML_API_IMPORT #endif diff --git a/include/SFML/Graphics/CircleShape.hpp b/include/SFML/Graphics/CircleShape.hpp index d94ec5df4..84963c766 100644 --- a/include/SFML/Graphics/CircleShape.hpp +++ b/include/SFML/Graphics/CircleShape.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -37,7 +38,7 @@ namespace sf /// \brief Specialized shape representing a circle /// //////////////////////////////////////////////////////////// -class SFML_API CircleShape : public Shape +class SFML_GRAPHICS_API CircleShape : public Shape { public : diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 4838239de..d2c3864cc 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -37,7 +37,7 @@ namespace sf /// \brief Utility class for manpulating RGBA colors /// //////////////////////////////////////////////////////////// -class SFML_API Color +class SFML_GRAPHICS_API Color { public : @@ -95,7 +95,7 @@ public : /// \return True if colors are equal, false if they are different /// //////////////////////////////////////////////////////////// -SFML_API bool operator ==(const Color& left, const Color& right); +SFML_GRAPHICS_API bool operator ==(const Color& left, const Color& right); //////////////////////////////////////////////////////////// /// \relates Color @@ -109,7 +109,7 @@ SFML_API bool operator ==(const Color& left, const Color& right); /// \return True if colors are different, false if they are equal /// //////////////////////////////////////////////////////////// -SFML_API bool operator !=(const Color& left, const Color& right); +SFML_GRAPHICS_API bool operator !=(const Color& left, const Color& right); //////////////////////////////////////////////////////////// /// \relates Color @@ -124,7 +124,7 @@ SFML_API bool operator !=(const Color& left, const Color& right); /// \return Result of \a left + \a right /// //////////////////////////////////////////////////////////// -SFML_API Color operator +(const Color& left, const Color& right); +SFML_GRAPHICS_API Color operator +(const Color& left, const Color& right); //////////////////////////////////////////////////////////// /// \relates Color @@ -141,7 +141,7 @@ SFML_API Color operator +(const Color& left, const Color& right); /// \return Result of \a left * \a right /// //////////////////////////////////////////////////////////// -SFML_API Color operator *(const Color& left, const Color& right); +SFML_GRAPHICS_API Color operator *(const Color& left, const Color& right); //////////////////////////////////////////////////////////// /// \relates Color @@ -157,7 +157,7 @@ SFML_API Color operator *(const Color& left, const Color& right); /// \return Reference to \a left /// //////////////////////////////////////////////////////////// -SFML_API Color& operator +=(Color& left, const Color& right); +SFML_GRAPHICS_API Color& operator +=(Color& left, const Color& right); //////////////////////////////////////////////////////////// /// \relates Color @@ -175,7 +175,7 @@ SFML_API Color& operator +=(Color& left, const Color& right); /// \return Reference to \a left /// //////////////////////////////////////////////////////////// -SFML_API Color& operator *=(Color& left, const Color& right); +SFML_GRAPHICS_API Color& operator *=(Color& left, const Color& right); } // namespace sf diff --git a/include/SFML/Graphics/ConvexShape.hpp b/include/SFML/Graphics/ConvexShape.hpp index a45778690..a1441659d 100644 --- a/include/SFML/Graphics/ConvexShape.hpp +++ b/include/SFML/Graphics/ConvexShape.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -38,7 +39,7 @@ namespace sf /// \brief Specialized shape representing a convex polygon /// //////////////////////////////////////////////////////////// -class SFML_API ConvexShape : public Shape +class SFML_GRAPHICS_API ConvexShape : public Shape { public : diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp index 707068fd3..130ef3615 100644 --- a/include/SFML/Graphics/Drawable.hpp +++ b/include/SFML/Graphics/Drawable.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -41,7 +41,7 @@ class RenderTarget; /// to a render target /// //////////////////////////////////////////////////////////// -class SFML_API Drawable +class SFML_GRAPHICS_API Drawable { public : diff --git a/include/SFML/Graphics/Export.hpp b/include/SFML/Graphics/Export.hpp new file mode 100644 index 000000000..8db603441 --- /dev/null +++ b/include/SFML/Graphics/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_EXPORT_HPP +#define SFML_GRAPHICS_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_GRAPHICS_EXPORTS) + + #define SFML_GRAPHICS_API SFML_API_EXPORT + +#else + + #define SFML_GRAPHICS_API SFML_API_IMPORT + +#endif + + +#endif // SFML_GRAPHICS_EXPORT_HPP diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index dd33432cb..a02771e36 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -28,11 +28,12 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include -#include +#include #include #include #include +#include +#include #include #include #include @@ -46,7 +47,7 @@ class InputStream; /// \brief Class for loading and manipulating character fonts /// //////////////////////////////////////////////////////////// -class SFML_API Font +class SFML_GRAPHICS_API Font { public : diff --git a/include/SFML/Graphics/Glyph.hpp b/include/SFML/Graphics/Glyph.hpp index 38ff22e7e..ba452d6b1 100644 --- a/include/SFML/Graphics/Glyph.hpp +++ b/include/SFML/Graphics/Glyph.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -38,7 +38,7 @@ namespace sf /// \brief Structure describing a glyph /// //////////////////////////////////////////////////////////// -class SFML_API Glyph +class SFML_GRAPHICS_API Glyph { public : diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index d28c0f3d7..0e571031d 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -42,7 +43,7 @@ class InputStream; /// \brief Class for loading, manipulating and saving images /// //////////////////////////////////////////////////////////// -class SFML_API Image +class SFML_GRAPHICS_API Image { public : diff --git a/include/SFML/Graphics/RectangleShape.hpp b/include/SFML/Graphics/RectangleShape.hpp index 2f1f50b84..426c169e0 100644 --- a/include/SFML/Graphics/RectangleShape.hpp +++ b/include/SFML/Graphics/RectangleShape.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -37,7 +38,7 @@ namespace sf /// \brief Specialized shape representing a rectangle /// //////////////////////////////////////////////////////////// -class SFML_API RectangleShape : public Shape +class SFML_GRAPHICS_API RectangleShape : public Shape { public : diff --git a/include/SFML/Graphics/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp index 13d09d998..661878e1a 100644 --- a/include/SFML/Graphics/RenderStates.hpp +++ b/include/SFML/Graphics/RenderStates.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -41,7 +42,7 @@ class Texture; /// \brief Define the states used for drawing to a RenderTarget /// //////////////////////////////////////////////////////////// -class SFML_API RenderStates +class SFML_GRAPHICS_API RenderStates { public : diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index bc40ba7b5..94777a61d 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -37,6 +37,7 @@ #include #include #include +#include namespace sf @@ -47,7 +48,7 @@ class Drawable; /// \brief Base class for all render targets (window, texture, ...) /// //////////////////////////////////////////////////////////// -class SFML_API RenderTarget : NonCopyable +class SFML_GRAPHICS_API RenderTarget : NonCopyable { public : diff --git a/include/SFML/Graphics/RenderTexture.hpp b/include/SFML/Graphics/RenderTexture.hpp index 97f193657..4761920e2 100644 --- a/include/SFML/Graphics/RenderTexture.hpp +++ b/include/SFML/Graphics/RenderTexture.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -43,7 +44,7 @@ namespace priv /// \brief Target for off-screen 2D rendering into an texture /// //////////////////////////////////////////////////////////// -class SFML_API RenderTexture : public RenderTarget +class SFML_GRAPHICS_API RenderTexture : public RenderTarget { public : diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index a8d2e10bb..069ab9a32 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -40,7 +41,7 @@ namespace sf /// \brief Window that can serve as a target for 2D drawing /// //////////////////////////////////////////////////////////// -class SFML_API RenderWindow : public Window, public RenderTarget +class SFML_GRAPHICS_API RenderWindow : public Window, public RenderTarget { public : diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index 43621db94..3080c5353 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -48,7 +48,7 @@ class Texture; /// \brief Shader class (vertex and fragment) /// //////////////////////////////////////////////////////////// -class SFML_API Shader : GlResource, NonCopyable +class SFML_GRAPHICS_API Shader : GlResource, NonCopyable { public : diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index 6386cde75..61c123a2f 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -40,7 +41,7 @@ namespace sf /// \brief Base class for textured shapes with outline /// //////////////////////////////////////////////////////////// -class SFML_API Shape : public Drawable, public Transformable +class SFML_GRAPHICS_API Shape : public Drawable, public Transformable { public : diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index 675a920f8..330e87b38 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -43,7 +44,7 @@ class Texture; /// own transformations, color, etc. /// //////////////////////////////////////////////////////////// -class SFML_API Sprite : public Drawable, public Transformable +class SFML_GRAPHICS_API Sprite : public Drawable, public Transformable { public : diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index 5f92b8d16..f34140018 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -28,12 +28,13 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include #include #include +#include #include #include @@ -44,7 +45,7 @@ namespace sf /// \brief Graphical text that can be drawn to a render target /// //////////////////////////////////////////////////////////// -class SFML_API Text : public Drawable, public Transformable +class SFML_GRAPHICS_API Text : public Drawable, public Transformable { public : diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index 1cbb99628..fd40b5993 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -43,7 +44,7 @@ class InputStream; /// \brief Image living on the graphics card that can be used for drawing /// //////////////////////////////////////////////////////////// -class SFML_API Texture : GlResource +class SFML_GRAPHICS_API Texture : GlResource { public : diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp index 026fe43ed..8cd3f359d 100644 --- a/include/SFML/Graphics/Transform.hpp +++ b/include/SFML/Graphics/Transform.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -39,7 +39,7 @@ namespace sf /// \brief Define a 3x3 transform matrix /// //////////////////////////////////////////////////////////// -class SFML_API Transform +class SFML_GRAPHICS_API Transform { public : @@ -373,7 +373,7 @@ private: /// \return New combined transform /// //////////////////////////////////////////////////////////// -SFML_API Transform operator *(const Transform& left, const Transform& right); +SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right); //////////////////////////////////////////////////////////// /// \relates sf::Transform @@ -387,7 +387,7 @@ SFML_API Transform operator *(const Transform& left, const Transform& right); /// \return The combined transform /// //////////////////////////////////////////////////////////// -SFML_API Transform& operator *=(Transform& left, const Transform& right); +SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right); //////////////////////////////////////////////////////////// /// \relates sf::Transform @@ -401,7 +401,7 @@ SFML_API Transform& operator *=(Transform& left, const Transform& right); /// \return New transformed point /// //////////////////////////////////////////////////////////// -SFML_API Vector2f operator *(const Transform& left, const Vector2f& right); +SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right); } // namespace sf diff --git a/include/SFML/Graphics/Transformable.hpp b/include/SFML/Graphics/Transformable.hpp index e42af36ca..e5cffffe6 100644 --- a/include/SFML/Graphics/Transformable.hpp +++ b/include/SFML/Graphics/Transformable.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -37,7 +38,7 @@ namespace sf /// \brief Decomposed transform defined by a position, a rotation and a scale /// //////////////////////////////////////////////////////////// -class SFML_API Transformable +class SFML_GRAPHICS_API Transformable { public : diff --git a/include/SFML/Graphics/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp index f7e9ae60e..bbe70b75f 100644 --- a/include/SFML/Graphics/Vertex.hpp +++ b/include/SFML/Graphics/Vertex.hpp @@ -28,8 +28,9 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include +#include namespace sf @@ -38,7 +39,7 @@ namespace sf /// \brief Define a point with color and texture coordinates /// //////////////////////////////////////////////////////////// -class SFML_API Vertex +class SFML_GRAPHICS_API Vertex { public : diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp index b4320760e..94305eed9 100644 --- a/include/SFML/Graphics/VertexArray.hpp +++ b/include/SFML/Graphics/VertexArray.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -41,7 +42,7 @@ namespace sf /// \brief Define a set of one or more 2D primitives /// //////////////////////////////////////////////////////////// -class SFML_API VertexArray : public Drawable +class SFML_GRAPHICS_API VertexArray : public Drawable { public : diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index dee4eb491..f280c77ce 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -40,7 +40,7 @@ namespace sf /// \brief 2D camera that defines what region is shown on screen /// //////////////////////////////////////////////////////////// -class SFML_API View +class SFML_GRAPHICS_API View { public : diff --git a/include/SFML/Network/Export.hpp b/include/SFML/Network/Export.hpp new file mode 100644 index 000000000..1f6065ebe --- /dev/null +++ b/include/SFML/Network/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_EXPORT_HPP +#define SFML_NETWORK_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_NETWORK_EXPORTS) + + #define SFML_NETWORK_API SFML_API_EXPORT + +#else + + #define SFML_NETWORK_API SFML_API_IMPORT + +#endif + + +#endif // SFML_NETWORK_EXPORT_HPP diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp index c6466058a..afed5b984 100644 --- a/include/SFML/Network/Ftp.hpp +++ b/include/SFML/Network/Ftp.hpp @@ -28,9 +28,10 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include +#include #include #include -#include #include #include @@ -43,7 +44,7 @@ class IpAddress; /// \brief A FTP client /// //////////////////////////////////////////////////////////// -class SFML_API Ftp : NonCopyable +class SFML_NETWORK_API Ftp : NonCopyable { public : @@ -62,7 +63,7 @@ public : /// \brief Define a FTP response /// //////////////////////////////////////////////////////////// - class SFML_API Response + class SFML_NETWORK_API Response { public : @@ -184,7 +185,7 @@ public : /// \brief Specialization of FTP response returning a directory /// //////////////////////////////////////////////////////////// - class SFML_API DirectoryResponse : public Response + class SFML_NETWORK_API DirectoryResponse : public Response { public : @@ -217,7 +218,7 @@ public : /// \brief Specialization of FTP response returning a /// filename lisiting //////////////////////////////////////////////////////////// - class SFML_API ListingResponse : public Response + class SFML_NETWORK_API ListingResponse : public Response { public : diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index bfecb0757..d1e145268 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -28,10 +28,11 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include -#include +#include #include #include +#include +#include #include #include @@ -42,7 +43,7 @@ namespace sf /// \brief A HTTP client /// //////////////////////////////////////////////////////////// -class SFML_API Http : NonCopyable +class SFML_NETWORK_API Http : NonCopyable { public : @@ -50,7 +51,7 @@ public : /// \brief Define a HTTP request /// //////////////////////////////////////////////////////////// - class SFML_API Request + class SFML_NETWORK_API Request { public : @@ -187,7 +188,7 @@ public : /// \brief Define a HTTP response /// //////////////////////////////////////////////////////////// - class SFML_API Response + class SFML_NETWORK_API Response { public : diff --git a/include/SFML/Network/IpAddress.hpp b/include/SFML/Network/IpAddress.hpp index a919ebcdb..eed193ba7 100644 --- a/include/SFML/Network/IpAddress.hpp +++ b/include/SFML/Network/IpAddress.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -41,7 +41,7 @@ namespace sf /// \brief Encapsulate an IPv4 network address /// //////////////////////////////////////////////////////////// -class SFML_API IpAddress +class SFML_NETWORK_API IpAddress { public : @@ -201,7 +201,7 @@ private : /// \return True if both addresses are equal /// //////////////////////////////////////////////////////////// -SFML_API bool operator ==(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator ==(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of != operator to compare two IP addresses @@ -212,7 +212,7 @@ SFML_API bool operator ==(const IpAddress& left, const IpAddress& right); /// \return True if both addresses are different /// //////////////////////////////////////////////////////////// -SFML_API bool operator !=(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator !=(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of < operator to compare two IP addresses @@ -223,7 +223,7 @@ SFML_API bool operator !=(const IpAddress& left, const IpAddress& right); /// \return True if \a left is lesser than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of > operator to compare two IP addresses @@ -234,7 +234,7 @@ SFML_API bool operator <(const IpAddress& left, const IpAddress& right); /// \return True if \a left is greater than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator >(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of <= operator to compare two IP addresses @@ -245,7 +245,7 @@ SFML_API bool operator >(const IpAddress& left, const IpAddress& right); /// \return True if \a left is lesser or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <=(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator <=(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of >= operator to compare two IP addresses @@ -256,7 +256,7 @@ SFML_API bool operator <=(const IpAddress& left, const IpAddress& right); /// \return True if \a left is greater or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >=(const IpAddress& left, const IpAddress& right); +SFML_NETWORK_API bool operator >=(const IpAddress& left, const IpAddress& right); //////////////////////////////////////////////////////////// /// \brief Overload of >> operator to extract an IP address from an input stream @@ -267,7 +267,7 @@ SFML_API bool operator >=(const IpAddress& left, const IpAddress& right); /// \return Reference to the input stream /// //////////////////////////////////////////////////////////// -SFML_API std::istream& operator >>(std::istream& stream, IpAddress& address); +SFML_NETWORK_API std::istream& operator >>(std::istream& stream, IpAddress& address); //////////////////////////////////////////////////////////// /// \brief Overload of << operator to print an IP address to an output stream @@ -278,7 +278,7 @@ SFML_API std::istream& operator >>(std::istream& stream, IpAddress& address); /// \return Reference to the output stream /// //////////////////////////////////////////////////////////// -SFML_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address); +SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address); } // namespace sf diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 61baa2443..562b9f360 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -44,7 +44,7 @@ class UdpSocket; /// over the network /// //////////////////////////////////////////////////////////// -class SFML_API Packet +class SFML_NETWORK_API Packet { // A bool-like type that cannot be converted to integer or pointer types typedef bool (Packet::*BoolType)(std::size_t); diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp index 980252179..ae6c77f5e 100644 --- a/include/SFML/Network/Socket.hpp +++ b/include/SFML/Network/Socket.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -41,7 +42,7 @@ class SocketSelector; /// \brief Base class for all the socket types /// //////////////////////////////////////////////////////////// -class SFML_API Socket : NonCopyable +class SFML_NETWORK_API Socket : NonCopyable { public : diff --git a/include/SFML/Network/SocketSelector.hpp b/include/SFML/Network/SocketSelector.hpp index 50d915f23..a6cfdc71c 100644 --- a/include/SFML/Network/SocketSelector.hpp +++ b/include/SFML/Network/SocketSelector.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -40,7 +40,7 @@ class Socket; /// \brief Multiplexer that allows to read from multiple sockets /// //////////////////////////////////////////////////////////// -class SFML_API SocketSelector +class SFML_NETWORK_API SocketSelector { public : diff --git a/include/SFML/Network/TcpListener.hpp b/include/SFML/Network/TcpListener.hpp index 10ca2ce28..e9cb9df8a 100644 --- a/include/SFML/Network/TcpListener.hpp +++ b/include/SFML/Network/TcpListener.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -39,7 +40,7 @@ class TcpSocket; /// \brief Socket that listens to new TCP connections /// //////////////////////////////////////////////////////////// -class SFML_API TcpListener : public Socket +class SFML_NETWORK_API TcpListener : public Socket { public : diff --git a/include/SFML/Network/TcpSocket.hpp b/include/SFML/Network/TcpSocket.hpp index 23125e8b3..674ca113a 100644 --- a/include/SFML/Network/TcpSocket.hpp +++ b/include/SFML/Network/TcpSocket.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -42,7 +43,7 @@ class Packet; /// \brief Specialized socket using the TCP protocol /// //////////////////////////////////////////////////////////// -class SFML_API TcpSocket : public Socket +class SFML_NETWORK_API TcpSocket : public Socket { public : diff --git a/include/SFML/Network/UdpSocket.hpp b/include/SFML/Network/UdpSocket.hpp index 56f9ef18b..b85eecaa9 100644 --- a/include/SFML/Network/UdpSocket.hpp +++ b/include/SFML/Network/UdpSocket.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include @@ -41,7 +42,7 @@ class Packet; /// \brief Specialized socket using the UDP protocol /// //////////////////////////////////////////////////////////// -class SFML_API UdpSocket : public Socket +class SFML_NETWORK_API UdpSocket : public Socket { public : diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp index 344b41ef9..c4bff833a 100644 --- a/include/SFML/System/Clock.hpp +++ b/include/SFML/System/Clock.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -38,7 +38,7 @@ namespace sf /// \brief Utility class that measures the elapsed time /// //////////////////////////////////////////////////////////// -class SFML_API Clock +class SFML_SYSTEM_API Clock { public : diff --git a/include/SFML/System/Err.hpp b/include/SFML/System/Err.hpp index c66749d2c..5287723ee 100644 --- a/include/SFML/System/Err.hpp +++ b/include/SFML/System/Err.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -38,7 +38,7 @@ namespace sf /// \brief Standard stream used by SFML to output warnings and errors /// //////////////////////////////////////////////////////////// -SFML_API std::ostream& Err(); +SFML_SYSTEM_API std::ostream& Err(); } // namespace sf diff --git a/include/SFML/System/Export.hpp b/include/SFML/System/Export.hpp new file mode 100644 index 000000000..25b8d606f --- /dev/null +++ b/include/SFML/System/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_EXPORT_HPP +#define SFML_SYSTEM_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_EXPORTS) + + #define SFML_SYSTEM_API SFML_API_EXPORT + +#else + + #define SFML_SYSTEM_API SFML_API_IMPORT + +#endif + + +#endif // SFML_SYSTEM_EXPORT_HPP diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp index f7d082d99..775efde12 100644 --- a/include/SFML/System/Lock.hpp +++ b/include/SFML/System/Lock.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include @@ -39,7 +40,7 @@ class Mutex; /// \brief Automatic wrapper for locking and unlocking mutexes /// //////////////////////////////////////////////////////////// -class SFML_API Lock : NonCopyable +class SFML_SYSTEM_API Lock : NonCopyable { public : diff --git a/include/SFML/System/Mutex.hpp b/include/SFML/System/Mutex.hpp index a7d7fa03d..30d2930d2 100644 --- a/include/SFML/System/Mutex.hpp +++ b/include/SFML/System/Mutex.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -44,7 +44,7 @@ namespace priv /// from multiple threads /// //////////////////////////////////////////////////////////// -class SFML_API Mutex : NonCopyable +class SFML_SYSTEM_API Mutex : NonCopyable { public : diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp index deff871ea..1c6b75d76 100644 --- a/include/SFML/System/NonCopyable.hpp +++ b/include/SFML/System/NonCopyable.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -38,7 +38,7 @@ namespace sf /// class non-copyable /// //////////////////////////////////////////////////////////// -class SFML_API NonCopyable +class SFML_SYSTEM_API NonCopyable { protected : diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp index 9904fbeca..38ab210d7 100644 --- a/include/SFML/System/Sleep.hpp +++ b/include/SFML/System/Sleep.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -44,7 +44,7 @@ namespace sf /// \param duration Time to sleep /// //////////////////////////////////////////////////////////// -void SFML_API Sleep(Time duration); +void SFML_SYSTEM_API Sleep(Time duration); } // namespace sf diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp index 276c3b6e6..45ef43ce4 100644 --- a/include/SFML/System/String.hpp +++ b/include/SFML/System/String.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -40,7 +40,7 @@ namespace sf /// conversions between types and encodings /// //////////////////////////////////////////////////////////// -class SFML_API String +class SFML_SYSTEM_API String { public : @@ -394,8 +394,8 @@ public : private : - friend SFML_API bool operator ==(const String& left, const String& right); - friend SFML_API bool operator <(const String& left, const String& right); + friend SFML_SYSTEM_API bool operator ==(const String& left, const String& right); + friend SFML_SYSTEM_API bool operator <(const String& left, const String& right); //////////////////////////////////////////////////////////// // Member data @@ -413,7 +413,7 @@ private : /// \return True if both strings are equal /// //////////////////////////////////////////////////////////// -SFML_API bool operator ==(const String& left, const String& right); +SFML_SYSTEM_API bool operator ==(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -425,7 +425,7 @@ SFML_API bool operator ==(const String& left, const String& right); /// \return True if both strings are different /// //////////////////////////////////////////////////////////// -SFML_API bool operator !=(const String& left, const String& right); +SFML_SYSTEM_API bool operator !=(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -437,7 +437,7 @@ SFML_API bool operator !=(const String& left, const String& right); /// \return True if \a left is alphabetically lesser than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <(const String& left, const String& right); +SFML_SYSTEM_API bool operator <(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -449,7 +449,7 @@ SFML_API bool operator <(const String& left, const String& right); /// \return True if \a left is alphabetically greater than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >(const String& left, const String& right); +SFML_SYSTEM_API bool operator >(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -461,7 +461,7 @@ SFML_API bool operator >(const String& left, const String& right); /// \return True if \a left is alphabetically lesser or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <=(const String& left, const String& right); +SFML_SYSTEM_API bool operator <=(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -473,7 +473,7 @@ SFML_API bool operator <=(const String& left, const String& right); /// \return True if \a left is alphabetically greater or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >=(const String& left, const String& right); +SFML_SYSTEM_API bool operator >=(const String& left, const String& right); //////////////////////////////////////////////////////////// /// \relates String @@ -485,7 +485,7 @@ SFML_API bool operator >=(const String& left, const String& right); /// \return Concatenated string /// //////////////////////////////////////////////////////////// -SFML_API String operator +(const String& left, const String& right); +SFML_SYSTEM_API String operator +(const String& left, const String& right); } // namespace sf diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp index 837971397..852eb48ab 100644 --- a/include/SFML/System/Thread.hpp +++ b/include/SFML/System/Thread.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -45,7 +45,7 @@ namespace priv /// \brief Utility class to manipulate threads /// //////////////////////////////////////////////////////////// -class SFML_API Thread : NonCopyable +class SFML_SYSTEM_API Thread : NonCopyable { public : diff --git a/include/SFML/System/ThreadLocal.hpp b/include/SFML/System/ThreadLocal.hpp index 5d4d2e490..94d803099 100644 --- a/include/SFML/System/ThreadLocal.hpp +++ b/include/SFML/System/ThreadLocal.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -44,7 +44,7 @@ namespace priv /// \brief Defines variables with thread-local storage /// //////////////////////////////////////////////////////////// -class SFML_API ThreadLocal : NonCopyable +class SFML_SYSTEM_API ThreadLocal : NonCopyable { public : diff --git a/include/SFML/System/Time.hpp b/include/SFML/System/Time.hpp index 053db88ec..f36f69e01 100644 --- a/include/SFML/System/Time.hpp +++ b/include/SFML/System/Time.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -37,7 +37,7 @@ namespace sf /// \brief Represents a time value /// //////////////////////////////////////////////////////////// -class SFML_API Time +class SFML_SYSTEM_API Time { public : @@ -86,9 +86,9 @@ public : private : - friend SFML_API Time Seconds(float); - friend SFML_API Time Milliseconds(Int32); - friend SFML_API Time Microseconds(Int64); + friend SFML_SYSTEM_API Time Seconds(float); + friend SFML_SYSTEM_API Time Milliseconds(Int32); + friend SFML_SYSTEM_API Time Microseconds(Int64); //////////////////////////////////////////////////////////// /// \brief Construct from a number of microseconds @@ -120,7 +120,7 @@ private : /// \see Milliseconds, Microseconds /// //////////////////////////////////////////////////////////// -SFML_API Time Seconds(float amount); +SFML_SYSTEM_API Time Seconds(float amount); //////////////////////////////////////////////////////////// /// \relates Time @@ -133,7 +133,7 @@ SFML_API Time Seconds(float amount); /// \see Seconds, Microseconds /// //////////////////////////////////////////////////////////// -SFML_API Time Milliseconds(Int32 amount); +SFML_SYSTEM_API Time Milliseconds(Int32 amount); //////////////////////////////////////////////////////////// /// \relates Time @@ -146,7 +146,7 @@ SFML_API Time Milliseconds(Int32 amount); /// \see Seconds, Milliseconds /// //////////////////////////////////////////////////////////// -SFML_API Time Microseconds(Int64 amount); +SFML_SYSTEM_API Time Microseconds(Int64 amount); //////////////////////////////////////////////////////////// /// \relates Time @@ -158,7 +158,7 @@ SFML_API Time Microseconds(Int64 amount); /// \return True if both time values are equal /// //////////////////////////////////////////////////////////// -SFML_API bool operator ==(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator ==(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -170,7 +170,7 @@ SFML_API bool operator ==(const Time& left, const Time& right); /// \return True if both time values are different /// //////////////////////////////////////////////////////////// -SFML_API bool operator !=(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator !=(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -182,7 +182,7 @@ SFML_API bool operator !=(const Time& left, const Time& right); /// \return True if \a left is lesser than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator <(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -194,7 +194,7 @@ SFML_API bool operator <(const Time& left, const Time& right); /// \return True if \a left is greater than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator >(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -206,7 +206,7 @@ SFML_API bool operator >(const Time& left, const Time& right); /// \return True if \a left is lesser or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <=(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator <=(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -218,7 +218,7 @@ SFML_API bool operator <=(const Time& left, const Time& right); /// \return True if \a left is greater or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >=(const Time& left, const Time& right); +SFML_SYSTEM_API bool operator >=(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -229,7 +229,7 @@ SFML_API bool operator >=(const Time& left, const Time& right); /// \return Opposite of the time value /// //////////////////////////////////////////////////////////// -SFML_API Time operator -(const Time& right); +SFML_SYSTEM_API Time operator -(const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -241,7 +241,7 @@ SFML_API Time operator -(const Time& right); /// \return Sum of the two times values /// //////////////////////////////////////////////////////////// -SFML_API Time operator +(const Time& left, const Time& right); +SFML_SYSTEM_API Time operator +(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -253,7 +253,7 @@ SFML_API Time operator +(const Time& left, const Time& right); /// \return Sum of the two times values /// //////////////////////////////////////////////////////////// -SFML_API Time& operator +=(Time& left, const Time& right); +SFML_SYSTEM_API Time& operator +=(Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -265,7 +265,7 @@ SFML_API Time& operator +=(Time& left, const Time& right); /// \return Difference of the two times values /// //////////////////////////////////////////////////////////// -SFML_API Time operator -(const Time& left, const Time& right); +SFML_SYSTEM_API Time operator -(const Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -277,7 +277,7 @@ SFML_API Time operator -(const Time& left, const Time& right); /// \return Difference of the two times values /// //////////////////////////////////////////////////////////// -SFML_API Time& operator -=(Time& left, const Time& right); +SFML_SYSTEM_API Time& operator -=(Time& left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -289,7 +289,7 @@ SFML_API Time& operator -=(Time& left, const Time& right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator *(const Time& left, float right); +SFML_SYSTEM_API Time operator *(const Time& left, float right); //////////////////////////////////////////////////////////// /// \relates Time @@ -301,7 +301,7 @@ SFML_API Time operator *(const Time& left, float right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator *(const Time& left, Int64 right); +SFML_SYSTEM_API Time operator *(const Time& left, Int64 right); //////////////////////////////////////////////////////////// /// \relates Time @@ -313,7 +313,7 @@ SFML_API Time operator *(const Time& left, Int64 right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator *(float left, const Time& right); +SFML_SYSTEM_API Time operator *(float left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -325,7 +325,7 @@ SFML_API Time operator *(float left, const Time& right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator *(Int64 left, const Time& right); +SFML_SYSTEM_API Time operator *(Int64 left, const Time& right); //////////////////////////////////////////////////////////// /// \relates Time @@ -337,7 +337,7 @@ SFML_API Time operator *(Int64 left, const Time& right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time& operator *=(Time& left, float right); +SFML_SYSTEM_API Time& operator *=(Time& left, float right); //////////////////////////////////////////////////////////// /// \relates Time @@ -349,7 +349,7 @@ SFML_API Time& operator *=(Time& left, float right); /// \return \left multiplied by \right /// //////////////////////////////////////////////////////////// -SFML_API Time& operator *=(Time& left, Int64 right); +SFML_SYSTEM_API Time& operator *=(Time& left, Int64 right); //////////////////////////////////////////////////////////// /// \relates Time @@ -361,7 +361,7 @@ SFML_API Time& operator *=(Time& left, Int64 right); /// \return \left divided by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator /(const Time& left, float right); +SFML_SYSTEM_API Time operator /(const Time& left, float right); //////////////////////////////////////////////////////////// /// \relates Time @@ -373,7 +373,7 @@ SFML_API Time operator /(const Time& left, float right); /// \return \left divided by \right /// //////////////////////////////////////////////////////////// -SFML_API Time operator /(const Time& left, Int64 right); +SFML_SYSTEM_API Time operator /(const Time& left, Int64 right); //////////////////////////////////////////////////////////// /// \relates Time @@ -385,7 +385,7 @@ SFML_API Time operator /(const Time& left, Int64 right); /// \return \left divided by \right /// //////////////////////////////////////////////////////////// -SFML_API Time& operator /=(Time& left, float right); +SFML_SYSTEM_API Time& operator /=(Time& left, float right); //////////////////////////////////////////////////////////// /// \relates Time @@ -397,7 +397,7 @@ SFML_API Time& operator /=(Time& left, float right); /// \return \left divided by \right /// //////////////////////////////////////////////////////////// -SFML_API Time& operator /=(Time& left, Int64 right); +SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right); } // namespace sf diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index def5acf9f..1a3b408fa 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -45,7 +45,7 @@ namespace priv /// \brief Class holding a valid drawing context /// //////////////////////////////////////////////////////////// -class SFML_API Context : GlResource, NonCopyable +class SFML_WINDOW_API Context : GlResource, NonCopyable { public : diff --git a/include/SFML/Window/Export.hpp b/include/SFML/Window/Export.hpp new file mode 100644 index 000000000..757f58f27 --- /dev/null +++ b/include/SFML/Window/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_EXPORT_HPP +#define SFML_WINDOW_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_WINDOW_EXPORTS) + + #define SFML_WINDOW_API SFML_API_EXPORT + +#else + + #define SFML_WINDOW_API SFML_API_IMPORT + +#endif + + +#endif // SFML_WINDOW_EXPORT_HPP diff --git a/include/SFML/Window/GlResource.hpp b/include/SFML/Window/GlResource.hpp index 36e7ebd26..5b3acf6e0 100644 --- a/include/SFML/Window/GlResource.hpp +++ b/include/SFML/Window/GlResource.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -37,7 +37,7 @@ namespace sf /// \brief Base class for classes that require an OpenGL context /// //////////////////////////////////////////////////////////// -class SFML_API GlResource +class SFML_WINDOW_API GlResource { protected : diff --git a/include/SFML/Window/Joystick.hpp b/include/SFML/Window/Joystick.hpp index d4ec1a963..f239c74c9 100644 --- a/include/SFML/Window/Joystick.hpp +++ b/include/SFML/Window/Joystick.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -37,7 +37,7 @@ namespace sf /// \brief Give access to the real-time state of the joysticks /// //////////////////////////////////////////////////////////// -class SFML_API Joystick +class SFML_WINDOW_API Joystick { public : diff --git a/include/SFML/Window/Keyboard.hpp b/include/SFML/Window/Keyboard.hpp index abecde05e..cae90a6a8 100644 --- a/include/SFML/Window/Keyboard.hpp +++ b/include/SFML/Window/Keyboard.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include namespace sf @@ -37,7 +37,7 @@ namespace sf /// \brief Give access to the real-time state of the keyboard /// //////////////////////////////////////////////////////////// -class SFML_API Keyboard +class SFML_WINDOW_API Keyboard { public : diff --git a/include/SFML/Window/Mouse.hpp b/include/SFML/Window/Mouse.hpp index 4642d3217..1af586bcc 100644 --- a/include/SFML/Window/Mouse.hpp +++ b/include/SFML/Window/Mouse.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -40,7 +40,7 @@ class Window; /// \brief Give access to the real-time state of the mouse /// //////////////////////////////////////////////////////////// -class SFML_API Mouse +class SFML_WINDOW_API Mouse { public : diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp index bd04b17cb..759f9d019 100644 --- a/include/SFML/Window/VideoMode.hpp +++ b/include/SFML/Window/VideoMode.hpp @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -38,7 +38,7 @@ namespace sf /// \brief VideoMode defines a video mode (width, height, bpp) /// //////////////////////////////////////////////////////////// -class SFML_API VideoMode +class SFML_WINDOW_API VideoMode { public : @@ -114,7 +114,7 @@ public : /// \return True if modes are equal /// //////////////////////////////////////////////////////////// -SFML_API bool operator ==(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator ==(const VideoMode& left, const VideoMode& right); //////////////////////////////////////////////////////////// /// \relates VideoMode @@ -126,7 +126,7 @@ SFML_API bool operator ==(const VideoMode& left, const VideoMode& right); /// \return True if modes are different /// //////////////////////////////////////////////////////////// -SFML_API bool operator !=(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator !=(const VideoMode& left, const VideoMode& right); //////////////////////////////////////////////////////////// /// \relates VideoMode @@ -138,7 +138,7 @@ SFML_API bool operator !=(const VideoMode& left, const VideoMode& right); /// \return True if \a left is lesser than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator <(const VideoMode& left, const VideoMode& right); //////////////////////////////////////////////////////////// /// \relates VideoMode @@ -150,7 +150,7 @@ SFML_API bool operator <(const VideoMode& left, const VideoMode& right); /// \return True if \a left is greater than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator >(const VideoMode& left, const VideoMode& right); //////////////////////////////////////////////////////////// /// \relates VideoMode @@ -162,7 +162,7 @@ SFML_API bool operator >(const VideoMode& left, const VideoMode& right); /// \return True if \a left is lesser or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator <=(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator <=(const VideoMode& left, const VideoMode& right); //////////////////////////////////////////////////////////// /// \relates VideoMode @@ -174,7 +174,7 @@ SFML_API bool operator <=(const VideoMode& left, const VideoMode& right); /// \return True if \a left is greater or equal than \a right /// //////////////////////////////////////////////////////////// -SFML_API bool operator >=(const VideoMode& left, const VideoMode& right); +SFML_WINDOW_API bool operator >=(const VideoMode& left, const VideoMode& right); } // namespace sf diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index f226522f2..4272d6f43 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include @@ -53,7 +54,7 @@ class Event; /// \brief Window that serves as a target for OpenGL rendering /// //////////////////////////////////////////////////////////// -class SFML_API Window : GlResource, NonCopyable +class SFML_WINDOW_API Window : GlResource, NonCopyable { public : diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt index cead3b1f1..338748186 100644 --- a/src/SFML/Audio/CMakeLists.txt +++ b/src/SFML/Audio/CMakeLists.txt @@ -8,6 +8,7 @@ set(SRC ${SRCROOT}/ALCheck.hpp ${SRCROOT}/AudioDevice.cpp ${SRCROOT}/AudioDevice.hpp + ${INCROOT}/Export.hpp ${SRCROOT}/Listener.cpp ${INCROOT}/Listener.hpp ${SRCROOT}/Music.cpp diff --git a/src/SFML/CMakeLists.txt b/src/SFML/CMakeLists.txt index 9c83ce5ba..dcd798c6b 100644 --- a/src/SFML/CMakeLists.txt +++ b/src/SFML/CMakeLists.txt @@ -33,9 +33,6 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/") # set the output directory for SFML libraries set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib") -# define the export symbol -add_definitions(-DSFML_EXPORTS) - # add the modules subdirectories add_subdirectory(System) add_subdirectory(Window) diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt index 8856fb12e..df14eb7bf 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -9,6 +9,7 @@ set(SRC ${SRCROOT}/Color.cpp ${INCROOT}/Color.hpp ${INCROOT}/Drawable.hpp + ${INCROOT}/Export.hpp ${SRCROOT}/Font.cpp ${INCROOT}/Font.hpp ${INCROOT}/Glyph.hpp diff --git a/src/SFML/Network/CMakeLists.txt b/src/SFML/Network/CMakeLists.txt index a8b78117a..8dd27d37e 100644 --- a/src/SFML/Network/CMakeLists.txt +++ b/src/SFML/Network/CMakeLists.txt @@ -4,6 +4,7 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Network) # all source files set(SRC + ${INCROOT}/Export.hpp ${SRCROOT}/Ftp.cpp ${INCROOT}/Ftp.hpp ${SRCROOT}/Http.cpp diff --git a/src/SFML/System/CMakeLists.txt b/src/SFML/System/CMakeLists.txt index ec6ee945a..6efd948c3 100644 --- a/src/SFML/System/CMakeLists.txt +++ b/src/SFML/System/CMakeLists.txt @@ -8,6 +8,7 @@ set(SRC ${INCROOT}/Clock.hpp ${SRCROOT}/Err.cpp ${INCROOT}/Err.hpp + ${INCROOT}/Export.hpp ${SRCROOT}/Lock.cpp ${INCROOT}/Lock.hpp ${SRCROOT}/Mutex.cpp diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 77b6a8b83..c26d70091 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -6,6 +6,7 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Window) set(SRC ${SRCROOT}/Context.cpp ${INCROOT}/Context.hpp + ${INCROOT}/Export.hpp ${SRCROOT}/GlContext.cpp ${SRCROOT}/GlContext.hpp ${SRCROOT}/GlResource.cpp