mirror of
https://github.com/jlblancoc/nanoflann.git
synced 2026-01-16 21:01:17 +01:00
fix mismatch gcov error
This commit is contained in:
2
.github/workflows/ci-linux.yml
vendored
2
.github/workflows/ci-linux.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
||||
run: |
|
||||
# 1. Capture coverage data from the build directory
|
||||
# lcov finds all the .gcno and .gcda files
|
||||
lcov --capture --directory build/ --output-file coverage.info
|
||||
lcov --capture --directory build/ --output-file coverage.info --ignore-errors mismatch
|
||||
|
||||
# 2. Filter to *only* include the main header file
|
||||
# This fulfills your request to not include examples/tests
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING "Flags for C++ coverage build")
|
||||
set(CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING "Flags for C coverage build")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING "Linker flags for coverage build")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING "Linker flags for coverage build")
|
||||
|
||||
# Extract library version into "NANOFLANN_VERSION"
|
||||
# -----------------------------------------------------
|
||||
# Look for: "#define NANOFLANN_VERSION 0xABC"
|
||||
@@ -26,13 +31,8 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# The -Wno-variadic-macros was needed for Eigen3, StdVector.h
|
||||
add_compile_options(-Wall -Wshadow -Wno-long-long -Wno-variadic-macros)
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
|
||||
message(STATUS "Coverage build enabled. Adding gcov flags.")
|
||||
# Add gcov flags, ensure no optimization (-O0), and include debug symbols (-g)
|
||||
add_compile_options(-g -O0 --coverage)
|
||||
add_link_options(--coverage)
|
||||
elseif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
# Keep original logic for Release builds
|
||||
# Apply Release optimizations ONLY if it's not Debug and not Coverage
|
||||
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
|
||||
add_compile_options(-O2 -mtune=native)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user