Skip to content

Commit

Permalink
Enable coverage generation for GCC.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhuggett committed Nov 18, 2023
1 parent ad1a123 commit 83f271e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
-G Ninja \
-S . \
-B "$BUILD_DIR" \
-D COVERAGE=Yes \
-D PEEJAY_COVERAGE=Yes \
-D CMAKE_C_COMPILER="gcc-$GCC_VERSION" \
-D CMAKE_CXX_COMPILER="g++-$GCC_VERSION"
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cmake_policy (SET CMP0077 NEW)
option (WERROR "Compiler warnings are errors")
option (PEEJAY_CXX17 "Use C++17 (rather than C++20" Yes)
option (LIBCXX "Use libc++ rather than libstdc++ (clang only)")
option (COVERAGE "Generate LLVM Source-based Coverage")
option (PEEJAY_COVERAGE "Generate Source-based Coverage")

if (PEEJAY_CXX17)
set (STANDARD 17)
Expand Down Expand Up @@ -92,9 +92,11 @@ function (setup_target target)
list (APPEND msvc_options /WX)
endif ()

if (COVERAGE)
if (PEEJAY_COVERAGE)
list (APPEND gcc_options -fprofile-arcs -ftest-coverage)
list (APPEND clang_options -fprofile-instr-generate -fcoverage-mapping)
endif ()

if (LIBCXX)
list (APPEND clang_options -stdlib=libc++)
endif ()
Expand Down

0 comments on commit 83f271e

Please sign in to comment.