From e3939f98bd7c6452887318fc354fa72a5d81f6fc Mon Sep 17 00:00:00 2001 From: Michal Date: Wed, 3 Jun 2026 16:22:12 +0200 Subject: [PATCH 1/5] refactor: create seperate libraries for scene, renderer and parser --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d0e94c..21b0383 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,8 @@ target_link_libraries(runtime_core PUBLIC renderer datawriter ) +target_include_directories(runtime_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include) +target_link_libraries(runtime_core PUBLIC scene parser renderer) add_executable(NeuronIDE main.cpp) target_link_libraries(NeuronIDE PRIVATE runtime_core) \ No newline at end of file From 7bba51aa745d8f1aba7beb2aafa8fa19fb15b145 Mon Sep 17 00:00:00 2001 From: Michal Date: Wed, 17 Jun 2026 20:30:56 +0200 Subject: [PATCH 2/5] refactor: create seperate target for datawriter --- src/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21b0383..9d0e94c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,8 +20,6 @@ target_link_libraries(runtime_core PUBLIC renderer datawriter ) -target_include_directories(runtime_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include) -target_link_libraries(runtime_core PUBLIC scene parser renderer) add_executable(NeuronIDE main.cpp) target_link_libraries(NeuronIDE PRIVATE runtime_core) \ No newline at end of file From 487a5b728c1629c4c411c57dce9aff659b162c91 Mon Sep 17 00:00:00 2001 From: Michal Date: Wed, 17 Jun 2026 22:13:19 +0200 Subject: [PATCH 3/5] refactor: mark lsl dependency as SYSTEM --- cmake/Dependencies.cmake | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 8b0b7c8..6f7de31 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -27,17 +27,6 @@ FetchContent_Declare( SYSTEM ) -# Suppress compiler warnings from third-party targets when compiling their source files -set(BACKUP_C_FLAGS "${CMAKE_C_FLAGS}") -set(BACKUP_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") -elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") -endif() - FetchContent_MakeAvailable(googletest liblsl concurrentqueue) # Restore compiler flags for our own project code From db49f98463b3ce268303f3231c54415c719e0a43 Mon Sep 17 00:00:00 2001 From: Michal Date: Wed, 17 Jun 2026 22:20:52 +0200 Subject: [PATCH 4/5] refactor: suppress third party compiler warnings --- cmake/Dependencies.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 6f7de31..8b0b7c8 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -27,6 +27,17 @@ FetchContent_Declare( SYSTEM ) +# Suppress compiler warnings from third-party targets when compiling their source files +set(BACKUP_C_FLAGS "${CMAKE_C_FLAGS}") +set(BACKUP_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") +endif() + FetchContent_MakeAvailable(googletest liblsl concurrentqueue) # Restore compiler flags for our own project code From 054131f7fca97bfb68e3eaed67d58f8734ab3d67 Mon Sep 17 00:00:00 2001 From: Michal Date: Thu, 18 Jun 2026 09:32:02 +0200 Subject: [PATCH 5/5] feat: add coverage target and new CI job for building that target --- .github/workflows/ci.yml | 9 ++++----- CMakeLists.txt | 1 + cmake/Coverage.cmake | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 cmake/Coverage.cmake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f722bd..4e9951c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,18 +17,17 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y cmake clang-format clang-tidy-20 libsdl2-dev protobuf-compiler + sudo apt-get install -y cmake clang-format clang-tidy-20 libsdl2-dev protobuf-compiler gcovr - name: Check Code Formatting run: | find src include tests -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" \) | xargs clang-format --dry-run -Werror - name: Configure CMake - run: cmake -B build -DCMAKE_BUILD_TYPE=Release + run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DNEURON_IDE_ENABLE_COVERAGE=ON - name: Build run: cmake --build build --config Release - - name: Run Tests - working-directory: build - run: ctest --output-on-failure -C Release + - name: Run Tests & Check Coverage + run: cmake --build build --target coverage diff --git a/CMakeLists.txt b/CMakeLists.txt index 23a1575..d7151dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(Dependencies) include(CompilerWarnings) include(StaticAnalysis) +include(Coverage) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/cmake/Coverage.cmake b/cmake/Coverage.cmake new file mode 100644 index 0000000..4219d95 --- /dev/null +++ b/cmake/Coverage.cmake @@ -0,0 +1,40 @@ +# cmake/Coverage.cmake + +option(NEURON_IDE_ENABLE_COVERAGE "Enable code coverage reporting" OFF) + +if(NEURON_IDE_ENABLE_COVERAGE) + find_program(GCOVR_PATH gcovr) + + if(NOT GCOVR_PATH) + message(FATAL_ERROR "gcovr not found! Aborting configuration...") + endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + message(STATUS "Adding coverage compiler flags") + add_compile_options(--coverage) + add_link_options(--coverage) + else() + message(FATAL_ERROR "Code coverage is only supported with GCC or Clang") + endif() + + set(COVERAGE_DIR "${CMAKE_BINARY_DIR}/coverage") + + add_custom_target(coverage + COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_DIR} + COMMAND ctest --output-on-failure + COMMAND ${GCOVR_PATH} + --root ${CMAKE_SOURCE_DIR} + --exclude ".*_deps.*" + --exclude ".*tests.*" + --exclude ".*test.*" + --exclude ".*protoFiles.*" + --exclude ".*pb.*" + --exclude ".*\\.hpp" + --fail-under-line 60 + --print-summary + --html-details ${COVERAGE_DIR}/index.html + --xml ${COVERAGE_DIR}/coverage.xml + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Running tests and generating code coverage report..." + ) +endif()