diff --git a/.gitea/workflows/cpp-tests.yml b/.gitea/workflows/cpp-tests.yml index 84ee042..fa8030e 100644 --- a/.gitea/workflows/cpp-tests.yml +++ b/.gitea/workflows/cpp-tests.yml @@ -52,6 +52,9 @@ jobs: # Läuft nur auf main, dev und Pull Requests — nicht auf Feature-Branches. # Startet erst nach erfolgreichem test-fast. # +# Verwendet -DWITH_CGAL_TESTS=ON (nicht -DWITH_CGAL=ON), damit kein +# Viewer/GLFW gebaut wird — der CI-Container hat kein wayland-scanner. +# # Boost-Install-Schritt: solange das Docker-Image noch kein libboost-dev # enthält, wird es hier zur Laufzeit nachinstalliert (~15 s). # Nach dem nächsten Image-Rebuild (Dockerfile bereits aktualisiert) wird @@ -73,8 +76,8 @@ jobs: - name: Boost installieren (Übergang bis Image-Rebuild) run: apt-get update -qq && apt-get install -y --no-install-recommends libboost-dev - - name: Configure (WITH_CGAL) - run: cmake -S code -B build -DWITH_CGAL=ON -DCMAKE_BUILD_TYPE=Release + - name: Configure (WITH_CGAL_TESTS — kein Viewer, kein wayland-scanner) + run: cmake -S code -B build -DWITH_CGAL_TESTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build CGAL-Tests run: cmake --build build --target conformallab_cgal_tests -j$(nproc) diff --git a/README.md b/README.md index 4f5cbec..ac1c6d8 100644 --- a/README.md +++ b/README.md @@ -191,13 +191,16 @@ if (used_fallback) ## Build-Modi -| Modus | CMake-Flags | Was wird gebaut | -|-------|------------|-----------------| -| **Nur Tests** (Standard) | *(keine)* | `conformallab_tests` — Eigen + GTest | -| **CGAL-Tests + Beispiele** | `-DWITH_CGAL=ON` | `conformallab_cgal_tests`, Beispiel-Programme, CLI | -| **Interaktiver Viewer** | `-DWITH_CGAL=ON` | + `example_viewer`, Viewer in CLI integriert | +| Modus | CMake-Flags | Was wird gebaut | System-Deps | +|-------|------------|-----------------|-------------| +| **Nur Tests** (Standard / CI fast) | *(keine)* | `conformallab_tests` — 36 Tests | keine | +| **CGAL-Tests headless** (CI full) | `-DWITH_CGAL_TESTS=ON` | `conformallab_cgal_tests` — 158 Tests | Boost | +| **Vollständig** (lokal mit Viewer) | `-DWITH_CGAL=ON` | + CLI, Beispiel-Programme, interaktiver Viewer | Boost + Wayland/X11 | -Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und werden beim CMake-Configure-Schritt extrahiert (GTest via `FetchContent`). **Boost** wird nur mit `-DWITH_CGAL=ON` benötigt (Header-Only durch CGAL 6.x). +**`-DWITH_CGAL_TESTS=ON`** ist der empfohlene CI-Modus: kein GLFW, kein wayland-scanner, kein Display benötigt. +**`-DWITH_CGAL=ON`** aktiviert automatisch den Viewer — nur für lokale Entwicklung mit Display. + +Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und werden beim CMake-Configure-Schritt extrahiert (GTest via `FetchContent`). **Boost** wird nur mit `-DWITH_CGAL_TESTS=ON` oder `-DWITH_CGAL=ON` benötigt (Header-Only durch CGAL 6.x). --- @@ -207,7 +210,7 @@ Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und |------|---------| | C++ Compiler (GCC oder Clang) | C++17 | | CMake | 3.20 | -| Boost Headers | 1.70 *(nur mit `-DWITH_CGAL=ON`)* | +| Boost Headers | 1.70 *(nur mit `-DWITH_CGAL_TESTS=ON` oder `-DWITH_CGAL=ON`)* | --- @@ -226,24 +229,27 @@ cmake --build build --target conformallab_tests -j$(nproc) ctest --test-dir build --output-on-failure ``` -### CGAL-Tests + Beispiele (benötigt System-Boost) +### CGAL-Tests headless (CI — kein Display, kein wayland-scanner) ```bash -cmake -S code -B build -DWITH_CGAL=ON -cmake --build build -j$(nproc) +# benötigt: apt install libboost-dev (Ubuntu) / brew install boost (macOS) +cmake -S code -B build -DWITH_CGAL_TESTS=ON +cmake --build build --target conformallab_cgal_tests -j$(nproc) ctest --test-dir build -R "^cgal\." --output-on-failure -./build/examples/example_layout -./bin/conformallab_core -i input.off -g euclidean -o layout.off ``` Erwartet: **158 Tests bestanden, 2 skipped** (die zwei `@Ignore`-Hessian-Stubs). -### Interaktiver Viewer +### Vollständig lokal (CLI + Beispiele + interaktiver Viewer) ```bash +# benötigt zusätzlich: Wayland/X11 dev-Pakete (wayland-scanner, libx11-dev …) cmake -S code -B build -DWITH_CGAL=ON -cmake --build build -t example_viewer -j$(nproc) +cmake --build build -j$(nproc) +ctest --test-dir build -R "^cgal\." --output-on-failure +./build/examples/example_layout ./build/examples/example_viewer data/off/example.off +./bin/conformallab_core -i input.off -g euclidean -o layout.off ``` --- @@ -339,7 +345,7 @@ code/ Reine Mathe-Tests, nur Eigen: Clausen / Lobachevsky / ImLi₂, Hyper-ideal Geometrie, Tetraeder-Volumina. -### `conformallab_cgal_tests` (lokal — `-DWITH_CGAL=ON`) +### `conformallab_cgal_tests` (`-DWITH_CGAL_TESTS=ON` headless / `-DWITH_CGAL=ON` voll) | Suite | Tests | Was geprüft wird | |-------|------:|-----------------| diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 6f6dc19..45be564 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -7,24 +7,42 @@ message(STATUS "Configuring ${PROJECT_NAME}...") # ── Build modes ──────────────────────────────────────────────────────────────── # -# Default (CI / tests-only): only Eigen + GTest are required. +# Default (CI fast / pure-math tests): +# cmake -S code -B build +# Only Eigen + GTest required. 36 non-CGAL tests. # -# -DWITH_CGAL=ON builds the conformallab_core CLI app (needs CGAL). -# Automatically enables WITH_VIEWER because the app uses -# the viewer library for mesh visualisation. +# -DWITH_CGAL_TESTS=ON CGAL test suite only — no viewer, no CLI app. +# cmake -S code -B build -DWITH_CGAL_TESTS=ON +# Requires: system Boost headers (apt install libboost-dev). +# Builds: conformallab_cgal_tests (158 tests). +# Does NOT require wayland-scanner, GLFW, libigl or a display. +# Use this in headless CI. # -# -DWITH_VIEWER=ON builds the viewer library standalone (libigl/GLFW/GLAD). +# -DWITH_CGAL=ON Full build: CLI app + viewer + examples + CGAL tests. +# cmake -S code -B build -DWITH_CGAL=ON +# Requires: Boost + Wayland/X11 dev headers (wayland-scanner, libx11-dev …). +# Automatically enables WITH_VIEWER. +# Use this for local development with the interactive viewer. +# +# -DWITH_VIEWER=ON Viewer library only (libigl / GLFW / GLAD). # # ────────────────────────────────────────────────────────────────────────────── -option(WITH_CGAL "Build conformallab_core app (requires CGAL + Viewer)" OFF) -option(WITH_VIEWER "Build viewer library (libigl / GLFW / GLAD)" OFF) +option(WITH_CGAL_TESTS "Build CGAL test suite without viewer/CLI (headless CI)" OFF) +option(WITH_CGAL "Build conformallab_core CLI app + viewer + CGAL tests" OFF) +option(WITH_VIEWER "Build viewer library (libigl / GLFW / GLAD)" OFF) -# The CLI app always needs the viewer; enable it implicitly. +# WITH_CGAL_TESTS is a strict subset of WITH_CGAL — no viewer, no CLI. +# WITH_CGAL (full build) implies WITH_VIEWER. if(WITH_CGAL AND NOT WITH_VIEWER) message(STATUS "WITH_CGAL implies WITH_VIEWER – enabling automatically.") set(WITH_VIEWER ON CACHE BOOL "" FORCE) endif() +# Propagate Boost requirement for both CGAL modes. +if(WITH_CGAL OR WITH_CGAL_TESTS) + find_package(Boost REQUIRED) +endif() + # ── Standard settings ────────────────────────────────────────────────────────── set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -85,11 +103,6 @@ endif() # ── Core CLI app (optional, requires CGAL + Viewer) ─────────────────────────── if(WITH_CGAL) - # CGAL 6.x still needs Boost.Config headers unconditionally. - # Install via: brew install boost (macOS) - # apt install libboost-dev (Debian/Ubuntu) - find_package(Boost REQUIRED) - add_executable(${PROJECT_NAME} src/apps/v0/conformallab_cli.cpp) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/single_includes diff --git a/code/tests/CMakeLists.txt b/code/tests/CMakeLists.txt index 89b9387..b2bbf10 100644 --- a/code/tests/CMakeLists.txt +++ b/code/tests/CMakeLists.txt @@ -28,7 +28,9 @@ target_link_libraries(conformallab_tests PRIVATE GTest::gtest_main) include(GoogleTest) gtest_discover_tests(conformallab_tests DISCOVERY_TIMEOUT 60) -# ── CGAL test suite (requires -DWITH_CGAL=ON) ──────────────────────────────── -if(WITH_CGAL) +# ── CGAL test suite ────────────────────────────────────────────────────────── +# Built with -DWITH_CGAL_TESTS=ON (headless CI, no viewer) or +# -DWITH_CGAL=ON (full build with viewer + CLI). +if(WITH_CGAL OR WITH_CGAL_TESTS) add_subdirectory(cgal) endif()