Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at master 3.0 kB view raw
1From 0293de5a5bd209386b3c021ee661e85eee1985a9 Mon Sep 17 00:00:00 2001 2From: Guilhem Saurel <guilhem.saurel@laas.fr> 3Date: Sun, 21 Sep 2025 14:55:32 +0200 4Subject: [PATCH] Use up-to-date qdldl for CMake v4 5 6--- 7 c/CMakeLists.txt | 5 +++-- 8 c/amd/include/SuiteSparse_config.h | 2 +- 9 c/amd/include/perm.h | 2 +- 10 cpp/qdldl.hpp | 2 +- 11 setup.py | 3 ++- 12 5 files changed, 8 insertions(+), 6 deletions(-) 13 14diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt 15index 728204d..df15d84 100644 16--- a/c/CMakeLists.txt 17+++ b/c/CMakeLists.txt 18@@ -12,7 +12,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) 19 20 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/out) 21 22-add_subdirectory(qdldl EXCLUDE_FROM_ALL) 23+find_package(qdldl REQUIRED CONFIG) 24 25 set( 26 amd_src 27@@ -37,7 +37,8 @@ set( 28 29 30 # Add QDLDL+AMD library 31-add_library(qdldlamd STATIC ${amd_src} $<TARGET_OBJECTS:qdldlobject>) 32+add_library(qdldlamd STATIC ${amd_src}) 33+target_link_libraries(qdldlamd qdldl::qdldl) 34 target_include_directories(qdldlamd PRIVATE 35 ${CMAKE_CURRENT_SOURCE_DIR}/amd/include 36 ${CMAKE_CURRENT_SOURCE_DIR}/qdldl/include 37diff --git a/c/amd/include/SuiteSparse_config.h b/c/amd/include/SuiteSparse_config.h 38index ea3cea4..19ac8df 100644 39--- a/c/amd/include/SuiteSparse_config.h 40+++ b/c/amd/include/SuiteSparse_config.h 41@@ -42,7 +42,7 @@ 42 extern "C" { 43 #endif 44 45-#include "qdldl_types.h" 46+#include "qdldl/qdldl_types.h" 47 #define DLONG 48 typedef QDLDL_float c_float; 49 50diff --git a/c/amd/include/perm.h b/c/amd/include/perm.h 51index 16c2617..841abe1 100644 52--- a/c/amd/include/perm.h 53+++ b/c/amd/include/perm.h 54@@ -2,7 +2,7 @@ 55 extern "C" { 56 # endif // ifdef __cplusplus 57 58-#include "qdldl_types.h" 59+#include "qdldl/qdldl_types.h" 60 61 /** 62 * C = A(p,p)= PAP' where A and C are symmetric the upper part stored; 63diff --git a/cpp/qdldl.hpp b/cpp/qdldl.hpp 64index 83b4970..1a7b5d1 100644 65--- a/cpp/qdldl.hpp 66+++ b/cpp/qdldl.hpp 67@@ -1,5 +1,5 @@ 68 // Source code for QDLDL, AMD and permutations 69-#include "qdldl/include/qdldl.h" 70+#include "qdldl/qdldl.h" 71 #include "amd/include/amd.h" 72 #include "amd/include/perm.h" 73 #include <stdexcept> 74diff --git a/setup.py b/setup.py 75index edb50ed..c0e4c23 100644 76--- a/setup.py 77+++ b/setup.py 78@@ -97,10 +97,11 @@ class build_ext_qdldl(build_ext): 79 qdldl = Extension('qdldl', 80 sources=glob(os.path.join('cpp', '*.cpp')), 81 include_dirs=[os.path.join('c'), 82- os.path.join('c', 'qdldl', 'include'), 83+ os.path.join("@qdldl@", "include"), 84 get_pybind_include(), 85 get_pybind_include(user=False)], 86 language='c++', 87+ extra_link_args=['-lqdldl'], 88 extra_compile_args=compile_args + ['-std=c++11'], 89 extra_objects=[qdldl_lib]) 90 91-- 922.51.0 93