summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-04 10:22:15 +0100
committerskal <pascal.massimino@gmail.com>2026-02-04 10:22:15 +0100
commit4194c8d4bbd5bc48c2f50a7377c616f147385016 (patch)
tree06b17897a068a45466cfa751a1a1d3449fc6ebf5 /CMakeLists.txt
parent24d39afe882c92da8a2dfb543b97008cf50d7ec1 (diff)
feat(tooling): Implement code coverage reporting (Task #44)
Added CMake support for coverage builds and a script to generate HTML reports using lcov on macOS. Also cleaned up .gitignore.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e96bea..0029adf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ option(DEMO_SIZE_OPT "Enable size optimization flags" OFF)
option(DEMO_STRIP_ALL "Strip all unnecessary code for final build" OFF)
option(DEMO_BUILD_TESTS "Build tests" OFF)
option(DEMO_BUILD_TOOLS "Build tools" OFF)
+option(DEMO_ENABLE_COVERAGE "Enable code coverage generation (macOS only)" OFF)
option(DEMO_ALL_OPTIONS "Activate all options at once" OFF)
if (DEMO_ALL_OPTIONS)
@@ -23,6 +24,14 @@ if (DEMO_STRIP_ALL)
set(DEMO_SIZE_OPT ON)
endif()
+if (DEMO_ENABLE_COVERAGE AND APPLE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
+ # Coverage requires debug info
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
#-- - Platform Detection and Core Setup -- -
if(APPLE)
add_definitions(-DGLFW_EXPOSE_NATIVE_COCOA)