Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Add the CLAD prefix to the CODE_COVERAGE option. #697

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ jobs:
if: ${{ (matrix.debug_build != true) && (runner.os != 'windows') }}
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
echo "CLAD_CODE_COVERAGE=0" >> $GITHUB_ENV
- name: Setup default Build Type on *nux (build_debug & asserts)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
run: |
Expand All @@ -449,9 +449,9 @@ jobs:
if: runner.os == 'windows'
run: |
$env:BUILD_TYPE="Release"
$env:CODE_COVERAGE="0"
$env:CLAD_CODE_COVERAGE="0"
echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV
echo "CODE_COVERAGE=0" >> $env:GITHUB_ENV
echo "CLAD_CODE_COVERAGE=0" >> $env:GITHUB_ENV
- name: Download Coverity Build Tool - Linux
if: ${{ (matrix.coverity == true) && (runner.os == 'Linux') }}
run: |
Expand Down Expand Up @@ -686,7 +686,7 @@ jobs:
if: ${{ (matrix.coverage == true) }}
run: |
sudo apt install lcov
echo "CODE_COVERAGE=1" >> $GITHUB_ENV
echo "CLAD_CODE_COVERAGE=1" >> $GITHUB_ENV
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Display config *nix
if: ${{ runner.os != 'windows' }}
Expand Down Expand Up @@ -725,7 +725,7 @@ jobs:
cmake -DClang_DIR="$PATH_TO_LLVM_BUILD" \
-DLLVM_DIR="$PATH_TO_LLVM_BUILD" \
-DCMAKE_BUILD_TYPE=$([[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE) \
-DCODE_COVERAGE=${CODE_COVERAGE} \
-DCLAD_CODE_COVERAGE=${CLAD_CODE_COVERAGE} \
-DLLVM_EXTERNAL_LIT="`which lit`" \
$GITHUB_WORKSPACE \
${{ matrix.extra_cmake_options }}
Expand All @@ -740,13 +740,13 @@ jobs:
{
$env:BUILD_TYPE="RelWithDebInfo"
}
if ( "$env:CODE_COVERAGE" -eq "" )
if ( "$env:CLAD_CODE_COVERAGE" -eq "" )
{
$env:CODE_COVERAGE="0"
$env:CLAD_CODE_COVERAGE="0"
}
((Get-Content -path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake -Raw) -replace 'LLVM_ENABLE_DIA_SDK ON','LLVM_ENABLE_DIA_SDK OFF') | Set-Content -Path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake
$lit = @(which lit)
cmake -DClang_DIR="$env:PATH_TO_LLVM_BUILD" -DLLVM_DIR="$env:PATH_TO_LLVM_BUILD" -DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" -DCODE_COVERAGE="$env:CODE_COVERAGE" -DCLAD_BUILD_STATIC_ONLY="ON" -DLLVM_EXTERNAL_LIT="$lit" "$env:GITHUB_WORKSPACE" ${{ matrix.extra_cmake_options }}
cmake -DClang_DIR="$env:PATH_TO_LLVM_BUILD" -DLLVM_DIR="$env:PATH_TO_LLVM_BUILD" -DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" -DCLAD_CODE_COVERAGE="$env:CLAD_CODE_COVERAGE" -DCLAD_BUILD_STATIC_ONLY="ON" -DLLVM_EXTERNAL_LIT="$lit" "$env:GITHUB_WORKSPACE" ${{ matrix.extra_cmake_options }}
cmake --build . --config Release
- name: Build Clad for Coverity Scan
if: ${{ matrix.coverity == true }}
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ endif()

## Code Coverage Configuration
add_library(coverage_config INTERFACE)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
option(CLAD_CODE_COVERAGE "Enable coverage reporting" OFF)
if(CLAD_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if(NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
message(FATAL_ERROR "CodeCov enabled on non-debug build!")
Expand Down
Loading