diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..2dd184d --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,17 @@ +version: "{branch}-ci-{build}" +image: Visual Studio 2017 + +build: msvc +platform: x86 +configuration: Debug + +install: +- choco install opencppcoverage codecov +- set PATH=C:\Program Files\OpenCppCoverage;%PATH% + +build_script: +- mkdir build && cd build +- cmake .. +- MSBuild Example.sln /p:Configuration=%configuration% /p:Platform="Win32" /nologo /m /verbosity:minimal +- OpenCppCoverage --export_type cobertura:coverage.xml --modules "*.exe" --cover_children -- ctest -C %configuration% --output-on-failure +- codecov -f coverage.xml --root %APPVEYOR_BUILD_FOLDER% diff --git a/CMakeLists.txt b/CMakeLists.txt index 84dc1b9..f6cba29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") else() target_link_libraries(coverage_config INTERFACE --coverage) endif() -endif(CODE_COVERAGE) +endif(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") add_subdirectory(src) diff --git a/README.md b/README.md index dc440e0..039c846 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ The goal of this project is to build project with following tools: * C++ version: `C++11` * Build system: [`CMake`](https://cmake.org/) - * C++ compiler: `g++` + * C++ compiler: `g++` or Visual Studio * Libraries: `STL` only - * Code coverage report: [`lcov`](http://ltp.sourceforge.net/coverage/lcov.php) (note: it should show the code coverage is below 100%) + * Code coverage report: [`lcov`](http://ltp.sourceforge.net/coverage/lcov.php) and [`OpenCppCoverage`](https://github.com/OpenCppCoverage/OpenCppCoverage)(note: it should show the code coverage is below 100%) * [`CodeCov`](https://codecov.io/) (code coverage is measured by CodeCov). * Source: multiple files diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0d80f9..5062715 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,9 @@ add_library(example complex.cpp) target_include_directories(example PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) # Setting this to the library only avoids errors in 3rd party dependencies which are compile with e.g. -Werror -target_compile_options(example PUBLIC -Wall -pedantic) +if(NOT MSVC) + target_compile_options(example PUBLIC -Wall -pedantic) +endif(NOT MSVC) # Include code-coverage settings: target_link_libraries(example PUBLIC coverage_config)