Files
ConformalLabpp/code/deps/CMakeLists.txt
Tarik Moussa 5859d78a37
Some checks failed
C++ Tests / test-fast (push) Successful in 2m43s
C++ Tests / test-cgal (push) Has been cancelled
fix(deps): extract CGAL for WITH_CGAL_TESTS=ON
deps/CMakeLists.txt only extracted CGAL when WITH_CGAL=ON.
With -DWITH_CGAL_TESTS=ON the CGAL include path was never populated,
causing fatal error: CGAL/Simple_cartesian.h: No such file or directory.

Fix: extract CGAL-6.1.1 for both WITH_CGAL and WITH_CGAL_TESTS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 21:37:02 +02:00

59 lines
2.7 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# deps/CMakeLists.txt
#
# Lazy tarball extraction a dependency is only extracted when its directory
# does not yet exist. Extraction happens at cmake configure time.
#
# Which deps are extracted depends on the active build mode:
#
# (default) Eigen only
# WITH_CGAL_TESTS=ON + Eigen, CGAL (headless CI — no viewer)
# WITH_VIEWER=ON + Eigen, libigl, libigl-glad, glfw
# WITH_CGAL=ON + Eigen, CGAL, libigl, libigl-glad, glfw
#
function(setup_dependency NAME SUBDIR)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${NAME}")
file(MAKE_DIRECTORY "${NAME}")
file(GLOB TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/tarballs/${NAME}.tar.*")
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
if(NOT TARBALL)
message(FATAL_ERROR "❌ No '${NAME}*.tar.*' in deps/tarballs/")
else()
message(STATUS "${CMAKE_COMMAND} ${TARBALL}")
if(SUBDIR STREQUAL "")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E tar xf "${TARBALL}"
RESULT_VARIABLE TAR_STATUS
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
else()
execute_process(
COMMAND "${CMAKE_COMMAND}" -E tar xf "${TARBALL}" "${NAME}/${SUBDIR}"
RESULT_VARIABLE TAR_STATUS
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
message(STATUS "Extracting ${NAME}... Status: ${TAR_STATUS}")
if(NOT TAR_STATUS EQUAL 0)
message(FATAL_ERROR "❌ Extract failed: ${NAME}")
endif()
endif()
else()
message(STATUS "✅ ${NAME} already exists, skipping extraction.")
endif()
endfunction()
# ── Always required ────────────────────────────────────────────────────────────
setup_dependency("eigen-3.4.0" "Eigen")
# ── Viewer mode ────────────────────────────────────────────────────────────────
if(WITH_VIEWER)
setup_dependency("libigl-2.6.0" "include")
setup_dependency("libigl-glad" "")
setup_dependency("glfw-3.4" "")
endif()
# ── CGAL mode ─────────────────────────────────────────────────────────────────
# Both WITH_CGAL_TESTS (headless CI) and WITH_CGAL (full build) need CGAL headers.
if(WITH_CGAL OR WITH_CGAL_TESTS)
setup_dependency("CGAL-6.1.1" "include")
endif()