diff --git a/.appveyor.yml b/.appveyor.yml index 43dc79e..d33d14a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,13 +3,7 @@ os: Visual Studio 2015 clone_depth: 1 environment: matrix: - # Note that we can't build any executables with MSVC for now because SDL2 depends - # are built for VC 2012, and we build with VC 2015 (old VC doesn't support C++11), - # and there's binary incompatibility which shows itself when linking an executable, - # I couldn't resolve, see [1] for more info - # - # [1] http://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2 - - CMAKE_ARGS: -DSDL2PP_WITH_TESTS=OFF -DSDL2PP_WITH_EXAMPLES=OFF -G "Visual Studio 14 2015" + - CMAKE_ARGS: -DSDL2PP_ENABLE_LIVE_TESTS=OFF -DCMAKE_CXX_FLAGS=/wd4275 -G "Visual Studio 14 2015" PREFIX: c:\usr_msvc MSVC: MINGW32: rem @@ -18,8 +12,8 @@ environment: MINGW32: MSVC: rem cache: - - c:\usr_msvc - - c:\usr_mingw32 + - c:\usr_msvc -> appveyor.yml + - c:\usr_mingw32 -> appveyor.yml before_build: - |- set MINGW32_ARCH=i686-w64-mingw32 @@ -34,45 +28,45 @@ before_build: # Depends for MSVC - |- - %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip - %NEEDDEPENDS% %MSVC% 7z x SDL2-devel-2.0.3-VC.zip > nul - %NEEDDEPENDS% %MSVC% copy SDL2-2.0.3\include\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MSVC% copy SDL2-2.0.3\lib\x86\* %PREFIX%\lib > nul + %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip + %NEEDDEPENDS% %MSVC% 7z x SDL2-devel-2.0.4-VC.zip > nul + %NEEDDEPENDS% %MSVC% copy SDL2-2.0.4\include\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MSVC% copy SDL2-2.0.4\lib\x86\* %PREFIX%\lib > nul - |- - %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.0-VC.zip - %NEEDDEPENDS% %MSVC% 7z x SDL2_image-devel-2.0.0-VC.zip > nul - %NEEDDEPENDS% %MSVC% copy SDL2_image-2.0.0\include\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MSVC% copy SDL2_image-2.0.0\lib\x86\* %PREFIX%\lib > nul + %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.1-VC.zip + %NEEDDEPENDS% %MSVC% 7z x SDL2_image-devel-2.0.1-VC.zip > nul + %NEEDDEPENDS% %MSVC% copy SDL2_image-2.0.1\include\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MSVC% copy SDL2_image-2.0.1\lib\x86\* %PREFIX%\lib > nul - |- - %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.0-VC.zip - %NEEDDEPENDS% %MSVC% 7z x SDL2_mixer-devel-2.0.0-VC.zip > nul - %NEEDDEPENDS% %MSVC% copy SDL2_mixer-2.0.0\include\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MSVC% copy SDL2_mixer-2.0.0\lib\x86\* %PREFIX%\lib > nul + %NEEDDEPENDS% %MSVC% appveyor DownloadFile http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-VC.zip + %NEEDDEPENDS% %MSVC% 7z x SDL2_mixer-devel-2.0.1-VC.zip > nul + %NEEDDEPENDS% %MSVC% copy SDL2_mixer-2.0.1\include\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MSVC% copy SDL2_mixer-2.0.1\lib\x86\* %PREFIX%\lib > nul - |- - %NEEDDEPENDS% %MSVC% appveyor DownloadFile https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.12-VC.zip - %NEEDDEPENDS% %MSVC% 7z x SDL2_ttf-devel-2.0.12-VC.zip > nul - %NEEDDEPENDS% %MSVC% copy SDL2_ttf-2.0.12\include\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MSVC% copy SDL2_ttf-2.0.12\lib\x86\* %PREFIX%\lib > nul + %NEEDDEPENDS% %MSVC% appveyor DownloadFile https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.14-VC.zip + %NEEDDEPENDS% %MSVC% 7z x SDL2_ttf-devel-2.0.14-VC.zip > nul + %NEEDDEPENDS% %MSVC% copy SDL2_ttf-2.0.14\include\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MSVC% copy SDL2_ttf-2.0.14\lib\x86\* %PREFIX%\lib > nul # Depends for MinGW32 - |- - %NEEDDEPENDS% %MINGW32% appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz - %NEEDDEPENDS% %MINGW32% 7z x SDL2-devel-2.0.3-mingw.tar.gz > nul - %NEEDDEPENDS% %MINGW32% 7z x SDL2-devel-2.0.3-mingw.tar > nul - %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.3\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.3\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul - %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.3\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul + %NEEDDEPENDS% %MINGW32% appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz + %NEEDDEPENDS% %MINGW32% 7z x SDL2-devel-2.0.4-mingw.tar.gz > nul + %NEEDDEPENDS% %MINGW32% 7z x SDL2-devel-2.0.4-mingw.tar > nul + %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.4\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.4\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul + %NEEDDEPENDS% %MINGW32% copy SDL2-2.0.4\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul - |- - %NEEDDEPENDS% %MINGW32% appveyor DownloadFile http://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.0-mingw.tar.gz - %NEEDDEPENDS% %MINGW32% 7z x SDL2_image-devel-2.0.0-mingw.tar.gz > nul - %NEEDDEPENDS% %MINGW32% 7z x SDL2_image-devel-2.0.0-mingw.tar > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.0\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.0\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.0\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul + %NEEDDEPENDS% %MINGW32% appveyor DownloadFile http://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.1-mingw.tar.gz + %NEEDDEPENDS% %MINGW32% 7z x SDL2_image-devel-2.0.1-mingw.tar.gz > nul + %NEEDDEPENDS% %MINGW32% 7z x SDL2_image-devel-2.0.1-mingw.tar > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.1\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.1\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_image-2.0.1\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul - |- %NEEDDEPENDS% %MINGW32% appveyor DownloadFile https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz @@ -83,26 +77,28 @@ before_build: %NEEDDEPENDS% %MINGW32% copy SDL2_mixer-2.0.1\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul - |- - %NEEDDEPENDS% %MINGW32% appveyor DownloadFile https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.12-mingw.tar.gz - %NEEDDEPENDS% %MINGW32% 7z x SDL2_ttf-devel-2.0.12-mingw.tar.gz > nul - %NEEDDEPENDS% %MINGW32% 7z x SDL2_ttf-devel-2.0.12-mingw.tar > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.12\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.12\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul - %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.12\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul - - - |- - %NEEDDEPENDS% %MINGW32% appveyor DownloadFile https://hg.libsdl.org/SDL/raw-file/e217ed463f25/include/SDL_platform.h - %NEEDDEPENDS% %MINGW32% copy SDL_platform.h %PREFIX%\include\SDL2 + %NEEDDEPENDS% %MINGW32% appveyor DownloadFile https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.14-mingw.tar.gz + %NEEDDEPENDS% %MINGW32% 7z x SDL2_ttf-devel-2.0.14-mingw.tar.gz > nul + %NEEDDEPENDS% %MINGW32% 7z x SDL2_ttf-devel-2.0.14-mingw.tar > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.14\%MINGW32_ARCH%\include\SDL2\* %PREFIX%\include\SDL2 > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.14\%MINGW32_ARCH%\lib\*.a %PREFIX%\lib > nul + %NEEDDEPENDS% %MINGW32% copy SDL2_ttf-2.0.14\%MINGW32_ARCH%\bin\*.dll %PREFIX%\lib > nul build_script: # build - |- - %MINGW% set PATH=c:\mingw\bin;%Path% + set PATH=%PREFIX%\lib;%PATH% + + %MINGW% set PATH=c:\mingw\bin;%PATH% + cd %APPVEYOR_BUILD_FOLDER% - echo Running "cmake -DCMAKE_PREFIX_PATH=%PREFIX% %CMAKE_ARGS%" - cmake -DCMAKE_PREFIX_PATH=%PREFIX% %CMAKE_ARGS% - %MSVC% msbuild "libSDL2pp.sln" /verbosity:normal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - %MINGW32% mingw32-make + cmake -DCMAKE_PREFIX_PATH=%PREFIX% %CMAKE_ARGS% . + cmake --build . + + %MSVC% set PATH=%APPVEYOR_BUILD_FOLDER%\Debug;%PATH% + %MINGW% set PATH=%APPVEYOR_BUILD_FOLDER%;%PATH% + ctest -V + %MINGW32% type FindSDL2PP.cmake %MINGW32% type sdl2pp.pc diff --git a/.gitignore b/.gitignore index e2eec75..f270676 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ install_manifest.txt Doxyfile FindSDL2PP.cmake SDL2pp/Config.hh +SDL2pp/Export.hh sdl2pp.pc *.vcxproj* *.sln diff --git a/CHANGES.md b/CHANGES.md index 7f78609..57f9650 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## 0.13.0 - unreleased +### Fixed +* Fixed MSVC compiler support and .dll generation + ### Changed * ```Renderer::GetClipRect``` now returns ```Optional``` instead of (possibly empty) ```Rect``` * Fixed SDL 2.0.4 specific ```AudioDevice``` methods: ```AudioDevice::QueueAudio()```, ```AudioDevice::GetQueuedAudioSize()``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a22b54..70f9bb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,11 +105,6 @@ CHECK_COMPILE( "#include \nint main() { std::experimental::optional o; return !o; }" "experimental/optional header" ) -CHECK_COMPILE( - SDL2PP_WITH_DEPRECATED - "[[deprecated]]\nstatic void f() {} int main() { return 0; }" - "[[deprecated]] attribute" -) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SDL2PP_WARNINGS}") @@ -213,6 +208,8 @@ ENDIF(SDL2PP_WITH_MIXER) IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) # library ADD_LIBRARY(SDL2pp SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS}) + INCLUDE(GenerateExportHeader) + GENERATE_EXPORT_HEADER(SDL2pp EXPORT_FILE_NAME SDL2pp/Export.hh) TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_ALL_LIBRARIES}) SET_TARGET_PROPERTIES(SDL2pp PROPERTIES VERSION 7.0.0 SOVERSION 7) @@ -269,7 +266,12 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) ) # install - INSTALL(FILES ${LIBRARY_HEADERS} ${PROJECT_BINARY_DIR}/SDL2pp/Config.hh DESTINATION include/SDL2pp) + INSTALL(FILES + ${LIBRARY_HEADERS} + ${PROJECT_BINARY_DIR}/SDL2pp/Config.hh + ${PROJECT_BINARY_DIR}/SDL2pp/Export.hh + DESTINATION include/SDL2pp + ) INSTALL(FILES ${LIBRARY_EXTERNAL_HEADERS} DESTINATION include/SDL2pp/external) INSTALL(TARGETS SDL2pp RUNTIME DESTINATION bin diff --git a/SDL2pp/AudioDevice.hh b/SDL2pp/AudioDevice.hh index 61c44fa..a224078 100644 --- a/SDL2pp/AudioDevice.hh +++ b/SDL2pp/AudioDevice.hh @@ -30,6 +30,7 @@ #include #include +#include namespace SDL2pp { @@ -46,7 +47,7 @@ class AudioSpec; /// audio functionality. /// //////////////////////////////////////////////////////////// -class AudioDevice { +class SDL2PP_EXPORT AudioDevice { public: //////////////////////////////////////////////////////////// /// \brief SDL2pp::AudioDevice lock @@ -82,7 +83,7 @@ public: /// \endcode /// //////////////////////////////////////////////////////////// - class LockHandle { + class SDL2PP_EXPORT LockHandle { friend class AudioDevice; private: AudioDevice* device_; ///< SDL2pp::AudioDevice the lock belongs to diff --git a/SDL2pp/AudioSpec.hh b/SDL2pp/AudioSpec.hh index c719e80..ef1ab5d 100644 --- a/SDL2pp/AudioSpec.hh +++ b/SDL2pp/AudioSpec.hh @@ -24,6 +24,8 @@ #include +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -41,7 +43,7 @@ namespace SDL2pp { /// \see http://wiki.libsdl.org/SDL_AudioSpec /// //////////////////////////////////////////////////////////// -class AudioSpec : public SDL_AudioSpec { +class SDL2PP_EXPORT AudioSpec : public SDL_AudioSpec { public: //////////////////////////////////////////////////////////// /// \brief Create empty (invalid) audio format specification diff --git a/SDL2pp/Chunk.hh b/SDL2pp/Chunk.hh index b8a9f7b..bed45fb 100644 --- a/SDL2pp/Chunk.hh +++ b/SDL2pp/Chunk.hh @@ -26,6 +26,8 @@ #include +#include + namespace SDL2pp { class RWops; @@ -38,7 +40,7 @@ class RWops; /// \headerfile SDL2pp/Chunk.hh /// //////////////////////////////////////////////////////////// -class Chunk { +class SDL2PP_EXPORT Chunk { private: Mix_Chunk* chunk_; ///< Managed Mix_Chunk object diff --git a/SDL2pp/Config.hh.in b/SDL2pp/Config.hh.in index f45abb9..f7d1803 100644 --- a/SDL2pp/Config.hh.in +++ b/SDL2pp/Config.hh.in @@ -32,12 +32,5 @@ #cmakedefine SDL2PP_WITH_TTF #cmakedefine SDL2PP_WITH_MIXER #cmakedefine SDL2PP_WITH_EXPERIMENTAL_OPTIONAL -#cmakedefine SDL2PP_WITH_DEPRECATED - -#if defined(SDL2PP_WITH_DEPRECATED) -# define SDL2PP_DEPRECATED [[deprecated]] -#else -# define SDL2PP_DEPRECATED -#endif #endif diff --git a/SDL2pp/Exception.hh b/SDL2pp/Exception.hh index 356e109..fe6b73c 100644 --- a/SDL2pp/Exception.hh +++ b/SDL2pp/Exception.hh @@ -25,6 +25,8 @@ #include #include +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -66,7 +68,7 @@ namespace SDL2pp { /// \endcode /// //////////////////////////////////////////////////////////// -class Exception : public std::runtime_error { +class SDL2PP_EXPORT Exception : public std::runtime_error { private: std::string sdl_function_; ///< SDL function which caused an error std::string sdl_error_; ///< SDL error string diff --git a/SDL2pp/Font.hh b/SDL2pp/Font.hh index ef0aa99..32abb8f 100644 --- a/SDL2pp/Font.hh +++ b/SDL2pp/Font.hh @@ -29,6 +29,7 @@ #include #include #include +#include namespace SDL2pp { @@ -44,7 +45,7 @@ class RWops; /// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC56 /// //////////////////////////////////////////////////////////// -class Font { +class SDL2PP_EXPORT Font { private: TTF_Font* font_; ///< Managed TTF_Font object diff --git a/SDL2pp/Mixer.hh b/SDL2pp/Mixer.hh index 23dc96d..b1609c6 100644 --- a/SDL2pp/Mixer.hh +++ b/SDL2pp/Mixer.hh @@ -26,9 +26,10 @@ #include #include - #include +#include + namespace SDL2pp { class Chunk; @@ -46,7 +47,7 @@ class Music; /// SDL2pp:Chunk's. /// //////////////////////////////////////////////////////////// -class Mixer { +class SDL2PP_EXPORT Mixer { public: typedef void (*ChannelFinishedHandler)(int); ///< Function type for channel finished callback typedef void (*MusicFinishedHandler)(); ///< Function type for music finished callback diff --git a/SDL2pp/Music.hh b/SDL2pp/Music.hh index 0740ba7..3a1a7b5 100644 --- a/SDL2pp/Music.hh +++ b/SDL2pp/Music.hh @@ -26,6 +26,8 @@ #include +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -36,7 +38,7 @@ namespace SDL2pp { /// \headerfile SDL2pp/Music.hh /// //////////////////////////////////////////////////////////// -class Music { +class SDL2PP_EXPORT Music { private: Mix_Music* music_; ///< Managed Mix_Music object diff --git a/SDL2pp/Point.hh b/SDL2pp/Point.hh index de188b6..3d7bffb 100644 --- a/SDL2pp/Point.hh +++ b/SDL2pp/Point.hh @@ -27,6 +27,8 @@ #include +#include + namespace SDL2pp { class Rect; @@ -46,7 +48,7 @@ class Rect; /// \see http://wiki.libsdl.org/SDL_Point /// //////////////////////////////////////////////////////////// -class Point : public SDL_Point { +class SDL2PP_EXPORT Point : public SDL_Point { public: //////////////////////////////////////////////////////////// /// \brief Default constructor @@ -459,7 +461,7 @@ constexpr bool operator!=(const SDL2pp::Point& a, const SDL2pp::Point& b) { /// \returns True if a < b /// //////////////////////////////////////////////////////////// -bool operator<(const SDL2pp::Point& a, const SDL2pp::Point& b); +SDL2PP_EXPORT bool operator<(const SDL2pp::Point& a, const SDL2pp::Point& b); //////////////////////////////////////////////////////////// /// \brief Stream output operator overload for SDL2pp::Point @@ -470,7 +472,7 @@ bool operator<(const SDL2pp::Point& a, const SDL2pp::Point& b); /// \returns stream /// //////////////////////////////////////////////////////////// -std::ostream& operator<<(std::ostream& stream, const SDL2pp::Point& point); +SDL2PP_EXPORT std::ostream& operator<<(std::ostream& stream, const SDL2pp::Point& point); namespace std { diff --git a/SDL2pp/RWops.hh b/SDL2pp/RWops.hh index 6fc9b98..4b8c3e2 100644 --- a/SDL2pp/RWops.hh +++ b/SDL2pp/RWops.hh @@ -26,6 +26,7 @@ #include #include +#include namespace SDL2pp { @@ -44,7 +45,7 @@ namespace SDL2pp { /// \see SDL2pp::ContainerRWops, SDL2pp::StreamRWops /// //////////////////////////////////////////////////////////// -class CustomRWops { +class SDL2PP_EXPORT CustomRWops { public: //////////////////////////////////////////////////////////// /// \brief Destructor @@ -142,7 +143,7 @@ public: /// make it possible to write pure C++ %RWops classes, in a safe way. /// //////////////////////////////////////////////////////////// -class RWops { +class SDL2PP_EXPORT RWops { protected: SDL_RWops* rwops_; ///< Managed SDL_RWops object diff --git a/SDL2pp/Rect.hh b/SDL2pp/Rect.hh index 39bb54f..90f949f 100644 --- a/SDL2pp/Rect.hh +++ b/SDL2pp/Rect.hh @@ -28,6 +28,7 @@ #include #include +#include namespace SDL2pp { @@ -46,7 +47,7 @@ namespace SDL2pp { /// \see http://wiki.libsdl.org/SDL_Rect /// //////////////////////////////////////////////////////////// -class Rect : public SDL_Rect { +class SDL2PP_EXPORT Rect : public SDL_Rect { public: //////////////////////////////////////////////////////////// /// \brief Default constructor @@ -620,7 +621,7 @@ constexpr bool operator!=(const SDL2pp::Rect& a, const SDL2pp::Rect& b) { /// \returns True if a < b /// //////////////////////////////////////////////////////////// -bool operator<(const SDL2pp::Rect& a, const SDL2pp::Rect& b); +SDL2PP_EXPORT bool operator<(const SDL2pp::Rect& a, const SDL2pp::Rect& b); //////////////////////////////////////////////////////////// /// \brief Stream output operator overload for SDL2pp::Rect @@ -631,7 +632,7 @@ bool operator<(const SDL2pp::Rect& a, const SDL2pp::Rect& b); /// \returns stream /// //////////////////////////////////////////////////////////// -std::ostream& operator<<(std::ostream& stream, const SDL2pp::Rect& rect); +SDL2PP_EXPORT std::ostream& operator<<(std::ostream& stream, const SDL2pp::Rect& rect); namespace std { diff --git a/SDL2pp/Renderer.hh b/SDL2pp/Renderer.hh index 665d0fc..4635bfc 100644 --- a/SDL2pp/Renderer.hh +++ b/SDL2pp/Renderer.hh @@ -29,6 +29,7 @@ #include #include #include +#include struct SDL_RendererInfo; struct SDL_Renderer; @@ -47,7 +48,7 @@ class Point; /// \headerfile SDL2pp/Renderer.hh /// //////////////////////////////////////////////////////////// -class Renderer { +class SDL2PP_EXPORT Renderer { private: SDL_Renderer* renderer_; ///< Managed SDL_Renderer object diff --git a/SDL2pp/SDL.hh b/SDL2pp/SDL.hh index 9043d70..df95549 100644 --- a/SDL2pp/SDL.hh +++ b/SDL2pp/SDL.hh @@ -24,6 +24,8 @@ #include +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -54,7 +56,7 @@ namespace SDL2pp { /// \endcode /// //////////////////////////////////////////////////////////// -class SDL { +class SDL2PP_EXPORT SDL { public: //////////////////////////////////////////////////////////// /// \brief Initializes SDL2 library diff --git a/SDL2pp/SDLImage.hh b/SDL2pp/SDLImage.hh index 264e4d7..9e645a1 100644 --- a/SDL2pp/SDLImage.hh +++ b/SDL2pp/SDLImage.hh @@ -22,6 +22,8 @@ #ifndef SDL2PP_SDLIMAGE_HH #define SDL2PP_SDLIMAGE_HH +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -53,7 +55,7 @@ namespace SDL2pp { /// \endcode /// //////////////////////////////////////////////////////////// -class SDLImage { +class SDL2PP_EXPORT SDLImage { public: //////////////////////////////////////////////////////////// /// \brief Initializes SDL_image library diff --git a/SDL2pp/SDLMixer.hh b/SDL2pp/SDLMixer.hh index e33a26c..9b45134 100644 --- a/SDL2pp/SDLMixer.hh +++ b/SDL2pp/SDLMixer.hh @@ -22,6 +22,8 @@ #ifndef SDL2PP_SDLMIXER_HH #define SDL2PP_SDLMIXER_HH +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -44,7 +46,7 @@ namespace SDL2pp { /// \endcode /// //////////////////////////////////////////////////////////// -class SDLMixer { +class SDL2PP_EXPORT SDLMixer { public: //////////////////////////////////////////////////////////// /// \brief Initializes SDL_mixer library diff --git a/SDL2pp/SDLTTF.hh b/SDL2pp/SDLTTF.hh index e8a4c9f..3c75fff 100644 --- a/SDL2pp/SDLTTF.hh +++ b/SDL2pp/SDLTTF.hh @@ -22,6 +22,8 @@ #ifndef SDL2PP_SDLTTF_HH #define SDL2PP_SDLTTF_HH +#include + namespace SDL2pp { //////////////////////////////////////////////////////////// @@ -51,7 +53,7 @@ namespace SDL2pp { /// \endcode /// //////////////////////////////////////////////////////////// -class SDLTTF { +class SDL2PP_EXPORT SDLTTF { public: //////////////////////////////////////////////////////////// /// \brief Initializes SDL_ttf library diff --git a/SDL2pp/Surface.hh b/SDL2pp/Surface.hh index d932c2d..4eb1620 100644 --- a/SDL2pp/Surface.hh +++ b/SDL2pp/Surface.hh @@ -29,6 +29,7 @@ #include #include #include +#include struct SDL_Surface; struct SDL_PixelFormat; @@ -48,7 +49,7 @@ class RWops; /// \see http://wiki.libsdl.org/SDL_Surface /// //////////////////////////////////////////////////////////// -class Surface { +class SDL2PP_EXPORT Surface { private: SDL_Surface* surface_; ///< Managed SDL_Surface object diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index b481a22..b886815 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -30,6 +30,7 @@ #include #include #include +#include struct SDL_Texture; @@ -48,7 +49,7 @@ class Surface; /// \headerfile SDL2pp/Texture.hh /// //////////////////////////////////////////////////////////// -class Texture { +class SDL2PP_EXPORT Texture { private: SDL_Texture* texture_; ///< Managed SDL_Texture object diff --git a/SDL2pp/Wav.hh b/SDL2pp/Wav.hh index afe0432..1ec79f5 100644 --- a/SDL2pp/Wav.hh +++ b/SDL2pp/Wav.hh @@ -25,6 +25,7 @@ #include #include +#include namespace SDL2pp { @@ -48,7 +49,7 @@ class RWops; /// See audio_wav demo for an example. /// //////////////////////////////////////////////////////////// -class Wav { +class SDL2PP_EXPORT Wav { private: Uint8* audio_buffer_; ///< Raw audio data Uint32 audio_length_; ///< Raw audio data length in bytes diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index a9903c8..e2bf4e1 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -28,6 +28,7 @@ #include #include +#include struct SDL_Window; @@ -62,7 +63,7 @@ class Surface; /// \endcode /// //////////////////////////////////////////////////////////// -class Window { +class SDL2PP_EXPORT Window { private: SDL_Window* window_; ///< Managed SDL2_Window object diff --git a/tests/test_font.cc b/tests/test_font.cc index fca63df..e5dae58 100644 --- a/tests/test_font.cc +++ b/tests/test_font.cc @@ -89,9 +89,11 @@ BEGIN_TEST(int, char*[]) { // Glyphs provided EXPECT_TRUE(font.IsGlyphProvided(u'A')); +#ifndef _MSC_VER // MSVC has problems with unicode literals EXPECT_TRUE(font.IsGlyphProvided(u'¼')); EXPECT_TRUE(!font.IsGlyphProvided(u'л')); EXPECT_TRUE(!font.IsGlyphProvided(u'Ы')); +#endif } { diff --git a/tests/testing.h b/tests/testing.h index 4be9699..c9e4651 100644 --- a/tests/testing.h +++ b/tests/testing.h @@ -369,7 +369,7 @@ public: # define EXPECT_TRUE(expr, ...) do { tester_.ExpectTrue(#expr, expr, __VA_ARGS__, Tester::DummyArgument()); } while(0) # define EXPECT_EQUAL(expr, ...) do { tester_.ExpectEqual(#expr, expr, __VA_ARGS__, Tester::DummyArgument()); } while(0) # define EXPECT_EXCEPTION(expr, exception, ...) do { tester_.ExpectException(#expr, [&](){expr;}, #exception, __VA_ARGS__, Tester::DummyArgument()); } while(0) -# define EXPECT_NO_EXCEPTION(expr, ...) do { tester_.ExpectNoException(#expr, [&](){expr;}, __VA_ARGS__, Tester::DummyArgument()); } while(0) +# define EXPECT_NO_EXCEPTION(expr, ...) do { tester_.ExpectNoException(#expr, [&](){expr;}, __VA_ARGS__, Tester::DummyArgument()); } while(0) #else # define EXPECT_TRUE(...) do { METHOD_WRAPPER(ExpectTrue, __VA_ARGS__, Tester::DummyArgument()); } while(0) # define EXPECT_EQUAL(...) do { METHOD_WRAPPER(ExpectEqual, __VA_ARGS__, Tester::DummyArgument()); } while(0)