cmake: add minimum required eigen3 version

This commit is contained in:
Andrej730
2026-09-16 13:59:44 +05:00
parent a5dec54719
commit 8c2ea9eb8b
7 changed files with 25 additions and 7 deletions
+4
View File
@@ -398,6 +398,10 @@ if(USE_MMAP)
endif() endif()
endif() endif()
# 3.3.9 is the version currently used on the Windows build.
# 3.4.0 is the version shipped with Ubuntu 22.04.
set(EIGEN_MIN_VERSION 3.3.9)
# 1.74 is the version shipped with Ubuntu 22.04. # 1.74 is the version shipped with Ubuntu 22.04.
set(BOOST_MIN_VERSION 1.74) set(BOOST_MIN_VERSION 1.74)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
+15 -1
View File
@@ -10,11 +10,25 @@
UNIFY_ENVVARS_AND_CACHE(EIGEN_DIR) UNIFY_ENVVARS_AND_CACHE(EIGEN_DIR)
if(EXISTS "${EIGEN_DIR}") if(EXISTS "${EIGEN_DIR}")
file(STRINGS "${EIGEN_DIR}/Eigen/src/Core/util/Macros.h" eigen_version_world_line REGEX "^#define EIGEN_WORLD_VERSION")
file(STRINGS "${EIGEN_DIR}/Eigen/src/Core/util/Macros.h" eigen_version_major_line REGEX "^#define EIGEN_MAJOR_VERSION")
file(STRINGS "${EIGEN_DIR}/Eigen/src/Core/util/Macros.h" eigen_version_minor_line REGEX "^#define EIGEN_MINOR_VERSION")
string(REGEX REPLACE "^#define EIGEN_WORLD_VERSION ([0-9]+)$" "\\1" eigen_version_world "${eigen_version_world_line}")
string(REGEX REPLACE "^#define EIGEN_MAJOR_VERSION ([0-9]+)$" "\\1" eigen_version_major "${eigen_version_major_line}")
string(REGEX REPLACE "^#define EIGEN_MINOR_VERSION ([0-9]+)$" "\\1" eigen_version_minor "${eigen_version_minor_line}")
set(Eigen3_VERSION "${eigen_version_world}.${eigen_version_major}.${eigen_version_minor}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3
REQUIRED_VARS EIGEN_DIR
VERSION_VAR Eigen3_VERSION
)
# Mimic Eigen3Config.cmake target. # Mimic Eigen3Config.cmake target.
add_library(Eigen3::Eigen INTERFACE IMPORTED) add_library(Eigen3::Eigen INTERFACE IMPORTED)
target_include_directories(Eigen3::Eigen INTERFACE "${EIGEN_DIR}") target_include_directories(Eigen3::Eigen INTERFACE "${EIGEN_DIR}")
else() else()
find_package(Eigen3 CONFIG) find_package(Eigen3 ${Eigen3_FIND_VERSION} CONFIG)
if(Eigen3_DIR) if(Eigen3_DIR)
message(STATUS "Eigen3: found config at '${Eigen3_DIR}'.") message(STATUS "Eigen3: found config at '${Eigen3_DIR}'.")
else() else()
+1 -1
View File
@@ -34,7 +34,7 @@ message("Running CMakeLists.txt in /src/helpers")
# (ifcopenshell.util.element) # (ifcopenshell.util.element)
# * Element — get_predefined_type (ifcopenshell.util.element) # * Element — get_predefined_type (ifcopenshell.util.element)
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
# helpers_math: the schema-free subset — unit conversion tables and Helmert # helpers_math: the schema-free subset — unit conversion tables and Helmert
# matrix math over plain numbers. No IfcParse, no Qt, no schema dispatch, so it # matrix math over plain numbers. No IfcParse, no Qt, no schema dispatch, so it
+1 -1
View File
@@ -41,7 +41,7 @@ if(UNIX)
find_package(Threads) find_package(Threads)
endif() endif()
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
add_subdirectory(kernels) add_subdirectory(kernels)
set(kernel_libraries ${kernel_libraries} PARENT_SCOPE) set(kernel_libraries ${kernel_libraries} PARENT_SCOPE)
+1 -1
View File
@@ -1,4 +1,4 @@
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
set(mapping_plugin_runtime_dir "$<TARGET_FILE_DIR:IfcGeom>") set(mapping_plugin_runtime_dir "$<TARGET_FILE_DIR:IfcGeom>")
+1 -1
View File
@@ -30,7 +30,7 @@ endif()
# Eigen3 — used by Federation matrices, ViewportWindow's instance compose, # Eigen3 — used by Federation matrices, ViewportWindow's instance compose,
# the per-model coordinate-operation matrices stored on ModelGpuData, and # the per-model coordinate-operation matrices stored on ModelGpuData, and
# everywhere a 4x4 transform shows up. Header-only, works under Emscripten. # everywhere a 4x4 transform shows up. Header-only, works under Emscripten.
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
# wgpu-native — fetched as a pre-built binary release from upstream. # wgpu-native — fetched as a pre-built binary release from upstream.
# Under Emscripten this whole block is skipped; the web build links # Under Emscripten this whole block is skipped; the web build links
+2 -2
View File
@@ -93,7 +93,7 @@ add_ifcviewer_unit_test(test_sidecar_layout
# InstanceCompose: matrix composition + cross-model object_id lookup. # InstanceCompose: matrix composition + cross-model object_id lookup.
# Pulls in wgpu_native for the WGPUBuffer typedef via ModelGpuData.h # Pulls in wgpu_native for the WGPUBuffer typedef via ModelGpuData.h
# (never touched at runtime). Eigen for Matrix4d. # (never touched at runtime). Eigen for Matrix4d.
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
add_ifcviewer_unit_test(test_instance_compose add_ifcviewer_unit_test(test_instance_compose
SOURCES ${IFCVIEWER_SRC}/InstanceCompose.cpp SOURCES ${IFCVIEWER_SRC}/InstanceCompose.cpp
LIBS wgpu_native Eigen3::Eigen LIBS wgpu_native Eigen3::Eigen
@@ -150,7 +150,7 @@ endif()
# directly and enable AUTOMOC for the Q_OBJECT moc-generation. # directly and enable AUTOMOC for the Q_OBJECT moc-generation.
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test REQUIRED PATHS ${QT_DIR}) find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test REQUIRED PATHS ${QT_DIR})
find_package(Eigen3 REQUIRED) find_package(Eigen3 ${EIGEN_MIN_VERSION} REQUIRED)
add_executable(test_federation add_executable(test_federation
test_federation.cpp test_federation.cpp