Package: csound-plugins / 1.0.2~dfsg1-5

gmm544.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Description: Allow building with gmm-5.4.4
 newer versions of gmm-5.4.4 have changed the type of gmm::lapack_ipvt to
 std::vector, which means that elements now have to be accessed via the []
 operator, rather than via a get() accessor
Author: IOhannes m zmölnig
Origin: Debian
Bug: https://github.com/csound/plugins/issues/29
Last-Update: 2025-02-09
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- csound-plugins.orig/linear_algebra/CMakeLists.txt
+++ csound-plugins/linear_algebra/CMakeLists.txt
@@ -3,10 +3,15 @@
 check_deps(BUILD_LINEAR_ALGEBRA_OPCODES USE_DOUBLE)
 find_package(GMM)
 if(BUILD_LINEAR_ALGEBRA_OPCODES AND GMM_FOUND)
+    try_compile(HAVE_LAPACK_IPVT_GET "${PROJECT_BINARY_DIR}/compile_tests"
+        ${PROJECT_SOURCE_DIR}/debian/cmake/lapack_ipvt_get.cpp)
     make_plugin(linear_algebra linear_algebra.cpp)
     target_include_directories(linear_algebra PRIVATE ${GMM_INCLUDE_DIR})
     target_include_directories(linear_algebra PRIVATE ${CSOUND_INCLUDE_DIR})
     target_compile_options(linear_algebra PRIVATE "-DGMM_VERSION")
+    if (HAVE_LAPACK_IPVT_GET)
+        target_compile_options(linear_algebra PRIVATE "-DHAVE_LAPACK_IPVT_GET=1")
+    endif()
     if (MSVC)
         target_compile_options(linear_algebra PRIVATE "/D_SCL_SECURE_NO_DEPRECATE")
     endif()
--- csound-plugins.orig/linear_algebra/linear_algebra.cpp
+++ csound-plugins/linear_algebra/linear_algebra.cpp
@@ -3503,7 +3503,7 @@
     gmm::copy(rhs->mr, lhs->mr);
     *isize = gmm::lu_factor(lhs->mr, pivot__);
     for (size_t i = 0; i < pivot_size; ++i) {
-#if defined(GMM_VERSION)
+#if HAVE_LAPACK_IPVT_GET
       pivot->vr[i] = pivot__.get(i);
 #else
       pivot->vr[i] = pivot__[i];
@@ -3540,7 +3540,7 @@
     gmm::copy(rhs->mr, lhs->mr);
     *ksize = gmm::lu_factor(lhs->mr, pivot__);
     for (size_t i = 0; i < pivot_size; ++i) {
-#if defined(GMM_VERSION)
+#if HAVE_LAPACK_IPVT_GET
       pivot->vr[i] = pivot__.get(i);
 #else
       pivot->vr[i] = pivot__[i];
@@ -3574,7 +3574,7 @@
     gmm::copy(rhs->mc, lhs->mc);
     *isize = gmm::lu_factor(lhs->mc, pivot__);
     for (size_t i = 0; i < pivot_size; ++i) {
-#if defined(GMM_VERSION)
+#if HAVE_LAPACK_IPVT_GET
       pivot->vr[i] = pivot__.get(i);
 #else
       pivot->vr[i] = pivot__[i];
@@ -3611,7 +3611,7 @@
     gmm::copy(rhs->mc, lhs->mc);
     *ksize = gmm::lu_factor(lhs->mc, pivot__);
     for (size_t i = 0; i < pivot_size; ++i) {
-#if defined(GMM_VERSION)
+#if HAVE_LAPACK_IPVT_GET
       pivot->vr[i] = pivot__.get(i);
 #else
       pivot->vr[i] = pivot__[i];