From 240ed42c6e8ce1a014912ea0b42b590c955ce284 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 29 Oct 2024 05:58:32 -0700 Subject: [PATCH] [open3d] fix finding of blas/lapack libraries --- ports/open3d/0002-blas.patch | 41 ++++++++++++++++++++++++++++++++++++ ports/open3d/portfile.cmake | 1 + ports/open3d/vcpkg.json | 3 +-- versions/o-/open3d.json | 2 +- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 ports/open3d/0002-blas.patch diff --git a/ports/open3d/0002-blas.patch b/ports/open3d/0002-blas.patch new file mode 100644 index 00000000000000..f95ebf1a2288f2 --- /dev/null +++ b/ports/open3d/0002-blas.patch @@ -0,0 +1,41 @@ +diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake +index d694621ad..a2b45e8ff 100644 +--- a/3rdparty/find_dependencies.cmake ++++ b/3rdparty/find_dependencies.cmake +@@ -1597,11 +1597,29 @@ else(OPEN3D_USE_ONEAPI_PACKAGES) + find_package(LAPACKE) + if(BLAS_FOUND AND LAPACK_FOUND AND LAPACKE_FOUND) + message(STATUS "System BLAS/LAPACK/LAPACKE found.") +- list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM +- ${BLAS_LIBRARIES} +- ${LAPACK_LIBRARIES} +- ${LAPACKE_LIBRARIES} +- ) ++ if("${BLAS_LIBRARIES}" MATCHES ".*openblas.*") ++ find_package(OpenBLAS) ++ if(OpenBLAS_FOUND) ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM OpenBLAS::OpenBLAS) ++ endif() ++ endif() ++ if(NOT TARGET OpenBlas::OpenBLAS) ++ if(TARGET BLAS::BLAS) ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM BLAS::BLAS) ++ else() ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM ${BLAS_LIBRARIES}) ++ endif() ++ endif() ++ if(TARGET LAPACK::LAPACK) ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM LAPACK::LAPACK) ++ else() ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM ${LAPACK_LIBRARIES}) ++ endif() ++ if(TARGET LAPACK::LAPACKE) ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM LAPACK::LAPACKE) ++ else() ++ list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM ${LAPACKE_LIBRARIES}) ++ endif() + else() + message(STATUS "System BLAS/LAPACK/LAPACKE not found, setting USE_SYSTEM_BLAS=OFF.") + set(USE_SYSTEM_BLAS OFF) +-- +2.45.2 diff --git a/ports/open3d/portfile.cmake b/ports/open3d/portfile.cmake index 8a2219edc72433..6cedc08b70c543 100644 --- a/ports/open3d/portfile.cmake +++ b/ports/open3d/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( HEAD_REF master PATCHES 0001-uvatlas.patch + 0002-blas.patch 0003-liblzf.patch 0004-tiny_gltf.patch 0005-jsoncpp.patch diff --git a/ports/open3d/vcpkg.json b/ports/open3d/vcpkg.json index 9144020771f3cb..ca8ff65744a66c 100644 --- a/ports/open3d/vcpkg.json +++ b/ports/open3d/vcpkg.json @@ -48,10 +48,9 @@ ] }, "blas": { - "description": "Use BLAS/LAPACK/LAPACKE instead of MKL", + "description": "Use BLAS, LAPACK, and LAPACKE", "dependencies": [ "blas", - "lapack", { "name": "lapack-reference", "features": [ diff --git a/versions/o-/open3d.json b/versions/o-/open3d.json index 8d7e1e93551d99..477b1dff468a34 100644 --- a/versions/o-/open3d.json +++ b/versions/o-/open3d.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "d9454d03d3c0f08fbd18f29cc4715b031f824bd9", + "git-tree": "91ea7e67e84d7a715f9945b103b5f8f47ee04563", "version-semver": "0.18.0", "port-version": 0 }