Files
ConformalLabpp/code/examples/CMakeLists.txt
Tarik Moussa b7593e3f6d feat(phase5): Layout, CLI, JSON/XML serialisation — 95 tests
Phase 5 complete:

layout.hpp
  - euclidean_layout(): BFS unfolding in ℝ² using trilaterate_2d
  - spherical_layout(): BFS on S² using trilaterate_sph (spherical law of cosines)
  - hyper_ideal_layout(): BFS in Poincaré disk (tanh(d/2) Euclidean approx)
  - save_layout_off(): convenience OFF writer for 2-D and 3-D layouts

serialization.hpp
  - save/load_result_json(): nlohmann/json; stores DOF vector + uv/pos layout
  - save/load_result_xml(): hand-written writer/parser; same schema

conformallab_cli.cpp (rewritten)
  - CLI11 interface: -i/-o/-g/-j/-x/-s/-v
  - Dispatches to euclidean / spherical / hyper_ideal pipeline
  - Runs Newton, computes layout, saves OFF + JSON + XML

examples/example_layout.cpp
  - Full round-trip demo: solve → layout → JSON/XML → reload → verify

tests/cgal/test_layout.cpp (8 tests)
  - Euclidean_PreservesEdgeLengths, CorrectVertexCount, TriangleIsNonDegenerate
  - Spherical_PreservesArcLengths, PositionsOnUnitSphere
  - HyperIdeal_SuccessAndFinitePositions
  - Serialization.JSON_RoundTrip, XML_RoundTrip

All 95 CGAL tests pass (2 skipped — Hessian stubs unchanged).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 00:53:47 +02:00

57 lines
3.0 KiB
CMake

# examples/CMakeLists.txt
#
# Example programs for conformallab++.
# All examples require -DWITH_CGAL=ON.
# example_viewer additionally requires -DWITH_VIEWER=ON.
#
# Run after building:
# ./build/examples/example_euclidean [input.off] [output.off]
# ./build/examples/example_hyper_ideal [input.off] [output.off]
# ./build/examples/example_viewer [input.off] (requires WITH_VIEWER)
# ── Shared include paths for all examples ─────────────────────────────────────
set(EXAMPLE_INCLUDES
${CMAKE_SOURCE_DIR}/deps/eigen-3.4.0
${CMAKE_SOURCE_DIR}/deps/CGAL-6.1.1/include
${CMAKE_SOURCE_DIR}/deps/single_includes
${Boost_INCLUDE_DIRS}
)
set(EXAMPLE_PRIVATE_INCLUDES
${CMAKE_SOURCE_DIR}/include
)
set(EXAMPLE_DEFS
CGAL_DISABLE_GMP
CGAL_DISABLE_MPFR
)
# ── example_euclidean ─────────────────────────────────────────────────────────
add_executable(example_euclidean example_euclidean.cpp)
target_include_directories(example_euclidean SYSTEM PRIVATE ${EXAMPLE_INCLUDES})
target_include_directories(example_euclidean PRIVATE ${EXAMPLE_PRIVATE_INCLUDES})
target_compile_definitions(example_euclidean PRIVATE ${EXAMPLE_DEFS})
# ── example_hyper_ideal ───────────────────────────────────────────────────────
add_executable(example_hyper_ideal example_hyper_ideal.cpp)
target_include_directories(example_hyper_ideal SYSTEM PRIVATE ${EXAMPLE_INCLUDES})
target_include_directories(example_hyper_ideal PRIVATE ${EXAMPLE_PRIVATE_INCLUDES})
target_compile_definitions(example_hyper_ideal PRIVATE ${EXAMPLE_DEFS})
# ── example_layout ───────────────────────────────────────────────────────────
add_executable(example_layout example_layout.cpp)
target_include_directories(example_layout SYSTEM PRIVATE ${EXAMPLE_INCLUDES})
target_include_directories(example_layout PRIVATE ${EXAMPLE_PRIVATE_INCLUDES})
target_compile_definitions(example_layout PRIVATE ${EXAMPLE_DEFS})
# ── example_viewer (requires WITH_VIEWER) ─────────────────────────────────────
if(WITH_VIEWER)
add_executable(example_viewer example_viewer.cpp)
target_include_directories(example_viewer SYSTEM PRIVATE
${EXAMPLE_INCLUDES}
${CMAKE_SOURCE_DIR}/deps/libigl-2.6.0/include
${CMAKE_SOURCE_DIR}/deps/libigl-glad/include
)
target_include_directories(example_viewer PRIVATE ${EXAMPLE_PRIVATE_INCLUDES})
target_compile_definitions(example_viewer PRIVATE ${EXAMPLE_DEFS})
target_link_libraries(example_viewer PRIVATE viewer)
endif()