From be235ffa941be74f6ccdcdc8d16713629caaece4 Mon Sep 17 00:00:00 2001 From: Jorrit Wronski Date: Wed, 28 Nov 2018 21:30:26 +0100 Subject: [PATCH 1/3] Add more tests with MSVC compilers --- appveyor.yml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 38032a7..7ac6b31 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,22 +5,45 @@ version: "{build}" # scripts that run after cloning repository install: - - git submodule update --init googletest - + - git submodule update --init --recursive + +image: + - Visual Studio 2017 + - Visual Studio 2015 + - Visual Studio 2013 + # configurations to add to build matrix # TODO: VS2010->VS2015 and Win32/Win64 (see https://github.com/google/googletest/blob/master/appveyor.yml) # TODO: MinGW Makefiles and MSYS Makefiles configuration: - Debug -# - Release # CMake can only build the default configuration on Visual Studio + - Release + +environment: + matrix: + - arch: Win32 + - arch: Win64 + +matrix: + allow_failures: + - image: Visual Studio 2013 + +init: + - echo %APPVEYOR_BUILD_WORKER_IMAGE% - %configuration% - %arch% + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (set vs=Visual Studio 15 2017) + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (set vs=Visual Studio 14 2015) + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (set vs=Visual Studio 12 2013) + - if "%arch%"=="Win64" (set generator="%vs% Win64") + - if "%arch%"=="Win32" (set generator="%vs%") + - echo %generator% # scripts to run before build before_build: - mkdir build - cd build - - cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_CPPCHECK=OFF .. + - cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON -DSQLITECPP_RUN_CPPCHECK=OFF .. -G %generator% # build examples, and run tests (ie make & make test) build_script: - - cmake --build . + - cmake --build . --config %configuration% - ctest --output-on-failure From f4c9aedf0971e1fbc3848a4022c79af165305cf3 Mon Sep 17 00:00:00 2001 From: Jorrit Wronski Date: Wed, 28 Nov 2018 21:37:05 +0100 Subject: [PATCH 2/3] Fix problems with MSVC 2017 and issue warnings for MSVC < 2015 --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d6f04c..d9ac931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,14 @@ if (MSVC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") endif (SQLITECPP_BUILD_TESTS) + # Handle the (partly supported) MSVC versions prior to 2015 + if (MSVC_TOOLSET_VERSION LESS 140) + message(WARNING "--------------- MSVC < 2015 detected ---------------") + message(WARNING "Visual Studio prior to 2015 is not fully supported." ) + message(WARNING "BLOB storage seems to be corrupted for the built-in" ) + message(WARNING "SQLite3 implementation." ) + message(WARNING "----------------------------------------------------") + endif (MSVC_TOOLSET_VERSION LESS 140) else (MSVC) set(CPPLINT_ARG_OUTPUT "--output=eclipse") set(CPPCHECK_ARG_TEMPLATE "--template=gcc") @@ -291,6 +299,14 @@ if (SQLITECPP_BUILD_TESTS) add_subdirectory(googletest) include_directories("${PROJECT_SOURCE_DIR}/googletest/googletest/include") + # Add definitions to keep googletest from making the compilation fail + if (MSVC_TOOLSET_VERSION EQUAL 141) + target_compile_definitions(gtest PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) + target_compile_definitions(gtest_main PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) + target_compile_definitions(gmock PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) + target_compile_definitions(gmock_main PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) + endif (MSVC_TOOLSET_VERSION EQUAL 141) + # add the unit test executable add_executable(SQLiteCpp_tests ${SQLITECPP_TESTS}) target_link_libraries(SQLiteCpp_tests gtest_main SQLiteCpp sqlite3) From a786257320508b4c951385720852b16373e1266a Mon Sep 17 00:00:00 2001 From: Jorrit Wronski Date: Wed, 28 Nov 2018 22:06:05 +0100 Subject: [PATCH 3/3] Formatted the MSVC<2015 warning properly --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ac931..a798571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,11 +32,7 @@ if (MSVC) endif (SQLITECPP_BUILD_TESTS) # Handle the (partly supported) MSVC versions prior to 2015 if (MSVC_TOOLSET_VERSION LESS 140) - message(WARNING "--------------- MSVC < 2015 detected ---------------") - message(WARNING "Visual Studio prior to 2015 is not fully supported." ) - message(WARNING "BLOB storage seems to be corrupted for the built-in" ) - message(WARNING "SQLite3 implementation." ) - message(WARNING "----------------------------------------------------") + message(WARNING " MSVC < 2015 detected: Visual Studio prior to 2015 is not fully supported. BLOB storage seems to be corrupted.") endif (MSVC_TOOLSET_VERSION LESS 140) else (MSVC) set(CPPLINT_ARG_OUTPUT "--output=eclipse")