This is an automated email from the ASF dual-hosted git repository.

jinyewu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git


The following commit(s) were added to refs/heads/main by this push:
     new 6b2d7eef build(C++/cmake): add `GRAPHAR_ENABLE_COVERAGE` for Debug 
coverage builds
6b2d7eef is described below

commit 6b2d7eef9272d01968987048cfed80155426b806
Author: 姚军 <[email protected]>
AuthorDate: Thu Feb 12 23:39:18 2026 +0800

    build(C++/cmake): add `GRAPHAR_ENABLE_COVERAGE` for Debug coverage builds
---
 .github/workflows/ci.yml | 2 +-
 cpp/CMakeLists.txt       | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e0199b5f..69ad69a6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,7 +85,7 @@ jobs:
       run: |
         mkdir build
         cd build
-        cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON 
-DBUILD_BENCHMARKS=ON  -DCMAKE_CXX_FLAGS="--coverage" 
-DCMAKE_C_FLAGS="--coverage"
+        cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON 
-DBUILD_BENCHMARKS=ON -DGRAPHAR_ENABLE_COVERAGE=ON
 
     - name: clang-format
       run: |
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 14b63df5..39a026ff 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -50,6 +50,7 @@ option(USE_STATIC_ARROW "Link arrow static library" OFF)
 option(GRAPHAR_BUILD_STATIC "Build GraphAr as static libraries" OFF)
 option(BUILD_ARROW_FROM_SOURCE "Build Arrow from source" OFF)
 option(GRAPHAR_ENABLE_SANITIZER "Enable address sanitizer (Debug builds only)" 
ON)
+option(GRAPHAR_ENABLE_COVERAGE "Enable coverage instrumentation (Debug builds 
only)" OFF)
 
 if (USE_STATIC_ARROW)
     set(GRAPHAR_BUILD_STATIC ON)
@@ -123,6 +124,10 @@ if (GRAPHAR_ENABLE_SANITIZER)
   set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} 
-fsanitize=address")
   set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} 
-fsanitize=address")
 endif()
+if (GRAPHAR_ENABLE_COVERAGE)
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
+  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} --coverage")
+endif()
 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -g")
 
 message(STATUS "[graphar] will build in type: ${CMAKE_BUILD_TYPE}")
@@ -130,6 +135,7 @@ message(STATUS "[graphar] will build in type: 
${CMAKE_BUILD_TYPE}")
 string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
 if (CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
   message(STATUS "[graphar] GRAPHAR_ENABLE_SANITIZER: 
${GRAPHAR_ENABLE_SANITIZER}")
+  message(STATUS "[graphar] GRAPHAR_ENABLE_COVERAGE: 
${GRAPHAR_ENABLE_COVERAGE}")
 endif()
 
 # 
------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to