Browse Source

Build fixup + more ignores

main
Ludovic 'Archivist' Lagouardette 2 years ago
parent
commit
1677f4a105
3 changed files with 52 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +4
    -0
      Tests/CMakeLists.txt
  3. +47
    -0
      tools/build_coverage.sh

+ 1
- 0
.gitignore View File

@ -2,4 +2,5 @@
/.idea/
/docs/
/coverage/
/coverage/*
/tools/config/override

+ 4
- 0
Tests/CMakeLists.txt View File

@ -1,5 +1,7 @@
Include(FetchContent)
include(../code-coverage.cmake)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
@ -13,6 +15,8 @@ target_link_libraries(tests PRIVATE LibSnugLog)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
include_directories(../LibSnugLog/public_include)
target_code_coverage(tests EXCLUDE catch2 Tests)
include(CTest)
include(Catch)
catch_discover_tests(tests)

+ 47
- 0
tools/build_coverage.sh View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
SNUGLOG_DIR=.
if [ $# -ge 1 ]; then
SNUGLOG_DIR=$1
fi
SNUGLOG_DIR=$(realpath "$SNUGLOG_DIR")
source "$SNUGLOG_DIR/tools/config/defaults"
if [ $# -ge 2 ]; then
source "$2"
elif [ -f "$SNUGLOG_DIR/tools/config/override" ]; then
source "$SNUGLOG_DIR/tools/config/override"
fi
BUILD_DIR="$SNUGLOG_DIR/coverage"
IS_NOISY_CMAKE=""
if [ "$NOISY_CMAKE" -eq 1 ]; then
IS_NOISY_CMAKE="-DCMAKE_VERBOSE_MAKEFILE=ON"
fi
if test "$MUST_REWRITE_PATHS" -eq 1 && test ! "$REWRITE_ENABLED" && [[ ! "$1" =~ /\s/g ]] && [[ ! "$2" =~ /\s/g ]]; then
export REWRITE_ENABLED=1
(echo "$0 $@" | /usr/bin/env bash) 2>&1 | sed $REWRITE_PATHS
export REWRITE_ENABLED=0
else
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR" || exit
cmake \
-DCODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Debug \
"-DCMAKE_C_COMPILER=$C_COMPILER" \
"-DCMAKE_CXX_COMPILER=$CXX_COMPILER" \
$IS_NOISY_CMAKE \
"-DLLVM_COV_PATH=$LLVM_COV" \
"-DLLVM_PROFDATA_PATH=$LLVM_PROFDATA" \
"$SNUGLOG_DIR"
make -j3 ccov-tests
fi

Loading…
Cancel
Save