kumquat-buildroot/package/eigen/0001-Adds-new-CMake-Options-for-controlling-build-components.patch
Fabrice Fontaine aeeb621e72 package/eigen: fix build without Fortran
Fix the following build failure without a working Fortran compiler:

CMake Error at /nvmedata/autobuild/instance-17/output-1/host/share/cmake-3.18/Modules/CMakeTestFortranCompiler.cmake:51 (message):
  The Fortran compiler

    "/usr/bin/f95"

  is not able to compile a simple test program.

Fixes:
 - http://autobuild.buildroot.org/results/37f3f40ee39739b5e557d634b71a448762107a4b

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-06-06 14:57:12 +02:00

86 lines
2.7 KiB
Diff

From cf82186416d04ea5df2a397d8fe09dc78d40ca65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= <cantonios@google.com>
Date: Sat, 5 Mar 2022 05:49:45 +0000
Subject: [PATCH] Adds new CMake Options for controlling build components.
[Retrieved from:
https://gitlab.com/libeigen/eigen/-/commit/cf82186416d04ea5df2a397d8fe09dc78d40ca65]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
CMakeLists.txt | 6 ++++++
blas/CMakeLists.txt | 3 ++-
lapack/CMakeLists.txt | 5 +++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de1c23e91..0af36a53a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -477,6 +477,9 @@ if(EIGEN_BUILD_TESTING)
add_subdirectory(failtest)
endif()
+include(CMakeDetermineFortranCompiler)
+option(EIGEN_BUILD_BLAS "Toggles the building of the Eigen Blas library" ${CMAKE_Fortran_COMPILER})
+option(EIGEN_BUILD_LAPACK "Toggles the building of the included Eigen LAPACK library" ${CMAKE_Fortran_COMPILER})
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
add_subdirectory(blas)
add_subdirectory(lapack)
@@ -611,6 +614,8 @@ set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen)
install (TARGETS eigen EXPORT Eigen3Targets)
+option(EIGEN_BUILD_CMAKE_PACKAGE "Enables the creation of EigenConfig.cmake and related files" ON)
+if(EIGEN_BUILD_CMAKE_PACKAGE)
configure_package_config_file (
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
@@ -655,6 +660,7 @@ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
# Add uninstall target
add_custom_target ( uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake)
+endif()
if (EIGEN_SPLIT_TESTSUITE)
ei_split_testsuite("${EIGEN_SPLIT_TESTSUITE}")
diff --git a/blas/CMakeLists.txt b/blas/CMakeLists.txt
index 8d3cb86dc..c530957fb 100644
--- a/blas/CMakeLists.txt
+++ b/blas/CMakeLists.txt
@@ -1,6 +1,7 @@
project(EigenBlas CXX)
+if(EIGEN_BUILD_BLAS)
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
@@ -59,4 +60,4 @@ if(EIGEN_BUILD_TESTING)
endif()
endif()
-
+endif()
diff --git a/lapack/CMakeLists.txt b/lapack/CMakeLists.txt
index c8ca64001..8d6d75401 100644
--- a/lapack/CMakeLists.txt
+++ b/lapack/CMakeLists.txt
@@ -1,5 +1,7 @@
project(EigenLapack CXX)
+if(EIGEN_BUILD_LAPACK AND EIGEN_BUILD_BLAS)
+
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
@@ -457,3 +459,6 @@ if(EXISTS ${eigen_full_path_to_testing_lapack})
endif()
+elseif(EIGEN_BUILD_LAPACK AND NOT EIGEN_BUILD_BLAS)
+ message(FATAL_ERROR "EIGEN_BUILD_LAPACK requires EIGEN_BUILD_BLAS")
+endif() #EIGEN_BUILD_LAPACK
--
GitLab