nbklu 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. nbklu-0.1.0/.gitignore +8 -0
  2. nbklu-0.1.0/.python-version +1 -0
  3. nbklu-0.1.0/.vscode/settings.json +10 -0
  4. nbklu-0.1.0/CMakeLists.txt +14 -0
  5. nbklu-0.1.0/LICENSE +13 -0
  6. nbklu-0.1.0/PKG-INFO +46 -0
  7. nbklu-0.1.0/README.md +31 -0
  8. nbklu-0.1.0/examples/raw_klu_simple.py +21 -0
  9. nbklu-0.1.0/pyproject.toml +48 -0
  10. nbklu-0.1.0/src/_ext/main.cc +103 -0
  11. nbklu-0.1.0/src/nbklu/__init__.py +0 -0
  12. nbklu-0.1.0/src/nbklu/_ext.pyi +81 -0
  13. nbklu-0.1.0/src/nbklu/py.typed +0 -0
  14. nbklu-0.1.0/src/suitesparse/CMakeLists.txt +30 -0
  15. nbklu-0.1.0/src/suitesparse/LICENSE.txt +1077 -0
  16. nbklu-0.1.0/src/suitesparse/amd/include/amd.h +399 -0
  17. nbklu-0.1.0/src/suitesparse/amd/include/amd_internal.h +277 -0
  18. nbklu-0.1.0/src/suitesparse/amd/src/amd_1.c +180 -0
  19. nbklu-0.1.0/src/suitesparse/amd/src/amd_2.c +1842 -0
  20. nbklu-0.1.0/src/suitesparse/amd/src/amd_aat.c +184 -0
  21. nbklu-0.1.0/src/suitesparse/amd/src/amd_order.c +199 -0
  22. nbklu-0.1.0/src/suitesparse/amd/src/amd_post_tree.c +120 -0
  23. nbklu-0.1.0/src/suitesparse/amd/src/amd_postorder.c +206 -0
  24. nbklu-0.1.0/src/suitesparse/amd/src/amd_preprocess.c +114 -0
  25. nbklu-0.1.0/src/suitesparse/amd/src/amd_valid.c +93 -0
  26. nbklu-0.1.0/src/suitesparse/btf/include/btf.h +281 -0
  27. nbklu-0.1.0/src/suitesparse/btf/include/btf_internal.h +65 -0
  28. nbklu-0.1.0/src/suitesparse/btf/src/btf_maxtrans.c +391 -0
  29. nbklu-0.1.0/src/suitesparse/btf/src/btf_order.c +135 -0
  30. nbklu-0.1.0/src/suitesparse/btf/src/btf_strongcomp.c +596 -0
  31. nbklu-0.1.0/src/suitesparse/colamd/include/colamd.h +243 -0
  32. nbklu-0.1.0/src/suitesparse/colamd/src/colamd.c +3581 -0
  33. nbklu-0.1.0/src/suitesparse/klu/include/klu.h +856 -0
  34. nbklu-0.1.0/src/suitesparse/klu/include/klu_internal.h +245 -0
  35. nbklu-0.1.0/src/suitesparse/klu/include/klu_version.h +710 -0
  36. nbklu-0.1.0/src/suitesparse/klu/src/klu.c +773 -0
  37. nbklu-0.1.0/src/suitesparse/klu/src/klu_analyze.c +488 -0
  38. nbklu-0.1.0/src/suitesparse/klu/src/klu_analyze_given.c +375 -0
  39. nbklu-0.1.0/src/suitesparse/klu/src/klu_defaults.c +60 -0
  40. nbklu-0.1.0/src/suitesparse/klu/src/klu_factor.c +549 -0
  41. nbklu-0.1.0/src/suitesparse/klu/src/klu_free_numeric.c +77 -0
  42. nbklu-0.1.0/src/suitesparse/klu/src/klu_free_symbolic.c +40 -0
  43. nbklu-0.1.0/src/suitesparse/klu/src/klu_kernel.c +1016 -0
  44. nbklu-0.1.0/src/suitesparse/klu/src/klu_memory.c +222 -0
  45. nbklu-0.1.0/src/suitesparse/klu/src/klu_scale.c +165 -0
  46. nbklu-0.1.0/src/suitesparse/klu/src/klu_solve.c +402 -0
  47. nbklu-0.1.0/src/suitesparse/suitesparse_config/include/SuiteSparse_config.h +2341 -0
  48. nbklu-0.1.0/src/suitesparse/suitesparse_config/src/SuiteSparse_config.c +820 -0
  49. nbklu-0.1.0/uv.lock +352 -0
nbklu-0.1.0/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ build/
3
+ dist/
4
+ .cache/
5
+ .venv/
6
+ compile_commands.json
7
+ tmp/
8
+ wheelhouse/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,10 @@
1
+ {
2
+ "cmake.generator": "Ninja",
3
+ "cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json",
4
+ "cmake.configureArgs": [
5
+ "-DSKBUILD_PROJECT_NAME=nbklu",
6
+ "-DPython_ROOT_DIR=${workspaceFolder}/.venv",
7
+ "-DPython_FIND_VIRTUALENV=FIRST",
8
+ "-DCMAKE_PREFIX_PATH=${workspaceFolder}/.venv/lib/site-packages"
9
+ ],
10
+ }
@@ -0,0 +1,14 @@
1
+ cmake_minimum_required(VERSION 3.15)
2
+ project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
3
+
4
+ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/suitesparse)
5
+
6
+ find_package(Python 3.10 REQUIRED
7
+ COMPONENTS Interpreter Development.Module
8
+ OPTIONAL_COMPONENTS Development.SABIModule
9
+ )
10
+ find_package(nanobind CONFIG REQUIRED)
11
+
12
+ nanobind_add_module(_ext NB_STATIC STABLE_ABI src/_ext/main.cc)
13
+ target_link_libraries(_ext PRIVATE klu)
14
+ install(TARGETS _ext LIBRARY DESTINATION nbklu)
nbklu-0.1.0/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Liangyu Zhang
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+ Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nbklu-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: nbklu
3
+ Version: 0.1.0
4
+ Summary: Python wrapper for KLU
5
+ Author-Email: Azuk 443 <me@azuk.top>
6
+ License-Expression: BSD-3-Clause
7
+ License-File: LICENSE
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Project-URL: Homepage, https://github.com/determ1ne/nbklu
11
+ Project-URL: Issues, https://github.com/determ1ne/nbklu/issues
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: numpy>=2.0.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ # nbklu: Python bindings for KLU in nanobind
17
+
18
+ ## Installation
19
+
20
+ ```
21
+ pip install nbklu
22
+ # or install from source
23
+ pip install git+https://github.com/determ1ne/nbklu.git
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ```python
29
+ import numpy as np
30
+ import nbklu._ext as klu
31
+
32
+ n = 5
33
+ Ap = np.array([0, 2, 5, 9, 10, 12])
34
+ Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4])
35
+ Ax = np.array([2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0])
36
+ b = np.array([8.0, 45.0, -3.0, 3.0, 19.0])
37
+
38
+ common = klu.Common()
39
+ common.defaults()
40
+ symbolic = klu.analyze(n, Ap, Ai, common)
41
+ numeric = klu.factor(Ap, Ai, Ax, symbolic, common)
42
+ klu.solve(symbolic, numeric, n, 1, b, common)
43
+ print(b)
44
+ ```
45
+
46
+ Detailed documentation can be found in the [KLU documentation](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/KLU/Doc/KLU_UserGuide.pdf).
nbklu-0.1.0/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # nbklu: Python bindings for KLU in nanobind
2
+
3
+ ## Installation
4
+
5
+ ```
6
+ pip install nbklu
7
+ # or install from source
8
+ pip install git+https://github.com/determ1ne/nbklu.git
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ import numpy as np
15
+ import nbklu._ext as klu
16
+
17
+ n = 5
18
+ Ap = np.array([0, 2, 5, 9, 10, 12])
19
+ Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4])
20
+ Ax = np.array([2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0])
21
+ b = np.array([8.0, 45.0, -3.0, 3.0, 19.0])
22
+
23
+ common = klu.Common()
24
+ common.defaults()
25
+ symbolic = klu.analyze(n, Ap, Ai, common)
26
+ numeric = klu.factor(Ap, Ai, Ax, symbolic, common)
27
+ klu.solve(symbolic, numeric, n, 1, b, common)
28
+ print(b)
29
+ ```
30
+
31
+ Detailed documentation can be found in the [KLU documentation](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/KLU/Doc/KLU_UserGuide.pdf).
@@ -0,0 +1,21 @@
1
+ import numpy as np
2
+ import nbklu._ext as klu
3
+
4
+
5
+ def main():
6
+ n = 5
7
+ Ap = np.array([0, 2, 5, 9, 10, 12])
8
+ Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4])
9
+ Ax = np.array([2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0])
10
+ b = np.array([8.0, 45.0, -3.0, 3.0, 19.0])
11
+
12
+ common = klu.Common()
13
+ common.defaults()
14
+ symbolic = klu.analyze(n, Ap, Ai, common)
15
+ numeric = klu.factor(Ap, Ai, Ax, symbolic, common)
16
+ klu.solve(symbolic, numeric, n, 1, b, common)
17
+ print(b)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,48 @@
1
+ [project]
2
+ name = "nbklu"
3
+ version = "0.1.0"
4
+ description = "Python wrapper for KLU"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Azuk 443", email = "me@azuk.top" }
8
+ ]
9
+ requires-python = ">=3.10"
10
+ dependencies = [
11
+ "numpy>=2.0.0",
12
+ ]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "Operating System :: OS Independent",
16
+ ]
17
+ license = "BSD-3-Clause"
18
+ license-files = ["LICENSE"]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/determ1ne/nbklu"
22
+ Issues = "https://github.com/determ1ne/nbklu/issues"
23
+
24
+ [tool.scikit-build]
25
+ minimum-version = "build-system.requires"
26
+ build-dir = "build/{wheel_tag}"
27
+ wheel.py-api = "cp312"
28
+
29
+ [tool.uv]
30
+ cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*.{h,c,hpp,cpp}" }, { file = "CMakeLists.txt" }]
31
+ no-build-isolation-package = ["nbklu"]
32
+
33
+ [tool.cibuildwheel]
34
+ build-frontend = "build[uv]"
35
+
36
+ [build-system]
37
+ requires = ["scikit-build-core>=0.10", "nanobind"]
38
+ build-backend = "scikit_build_core.build"
39
+
40
+ [dependency-groups]
41
+ dev = [
42
+ "pytest>=9.0.2",
43
+ "scikit-build-core",
44
+ "nanobind",
45
+ ]
46
+ build = [
47
+ "scikit-build-core",
48
+ ]
@@ -0,0 +1,103 @@
1
+ #include <nanobind/nanobind.h>
2
+ #include <nanobind/stl/string.h>
3
+ #include <nanobind/stl/vector.h>
4
+ #include <nanobind/ndarray.h>
5
+ #include <klu.h>
6
+
7
+ namespace nb = nanobind;
8
+
9
+ NB_MODULE(_ext, m) {
10
+ m.doc() = "KLU sparse solver Python bindings";
11
+
12
+ // Define klu_common struct wrapper
13
+ nb::class_<klu_common>(m, "Common")
14
+ .def(nb::init<>())
15
+ .def("defaults", &klu_defaults)
16
+ .def_rw("tol", &klu_common::tol)
17
+ .def_rw("memgrow", &klu_common::memgrow)
18
+ .def_rw("initmem_amd", &klu_common::initmem_amd)
19
+ .def_rw("initmem", &klu_common::initmem)
20
+ .def_rw("maxwork", &klu_common::maxwork)
21
+ .def_rw("btf", &klu_common::btf)
22
+ .def_rw("ordering", &klu_common::ordering)
23
+ .def_rw("scale", &klu_common::scale)
24
+ .def_rw("halt_if_singular", &klu_common::halt_if_singular)
25
+ .def_rw("status", &klu_common::status)
26
+ .def_rw("nrealloc", &klu_common::nrealloc)
27
+ .def_rw("structural_rank", &klu_common::structural_rank)
28
+ .def_rw("numerical_rank", &klu_common::numerical_rank)
29
+ .def_rw("singular_col", &klu_common::singular_col)
30
+ .def_rw("noffdiag", &klu_common::noffdiag)
31
+ .def_rw("flops", &klu_common::flops)
32
+ .def_rw("rcond", &klu_common::rcond)
33
+ .def_rw("condest", &klu_common::condest)
34
+ .def_rw("rgrowth", &klu_common::rgrowth)
35
+ .def_rw("work", &klu_common::work)
36
+ .def_rw("memusage", &klu_common::memusage)
37
+ .def_rw("mempeak", &klu_common::mempeak);
38
+
39
+ // Define klu_symbolic struct wrapper
40
+ nb::class_<klu_symbolic>(m, "Symbolic")
41
+ .def("free", [](klu_symbolic* self, klu_common* common) {
42
+ klu_free_symbolic(&self, common);
43
+ })
44
+ .def_rw("symmetry", &klu_symbolic::symmetry)
45
+ .def_rw("est_flops", &klu_symbolic::est_flops)
46
+ .def_rw("lnz", &klu_symbolic::lnz)
47
+ .def_rw("unz", &klu_symbolic::unz)
48
+ .def_rw("n", &klu_symbolic::n)
49
+ .def_rw("nz", &klu_symbolic::nz)
50
+ .def_rw("nzoff", &klu_symbolic::nzoff)
51
+ .def_rw("nblocks", &klu_symbolic::nblocks)
52
+ .def_rw("maxblock", &klu_symbolic::maxblock)
53
+ .def_rw("ordering", &klu_symbolic::ordering)
54
+ .def_rw("do_btf", &klu_symbolic::do_btf)
55
+ .def_rw("structural_rank", &klu_symbolic::structural_rank);
56
+
57
+ // Define klu_numeric struct wrapper
58
+ nb::class_<klu_numeric>(m, "Numeric")
59
+ .def("free", [](klu_numeric* self, klu_common* common) {
60
+ klu_free_numeric(&self, common);
61
+ })
62
+ .def_rw("n", &klu_numeric::n)
63
+ .def_rw("nblocks", &klu_numeric::nblocks)
64
+ .def_rw("lnz", &klu_numeric::lnz)
65
+ .def_rw("unz", &klu_numeric::unz)
66
+ .def_rw("max_lnz_block", &klu_numeric::max_lnz_block)
67
+ .def_rw("max_unz_block", &klu_numeric::max_unz_block)
68
+ .def_rw("nzoff", &klu_numeric::nzoff);
69
+
70
+ // KLU status constants
71
+ m.attr("KLU_OK") = KLU_OK;
72
+ m.attr("KLU_SINGULAR") = KLU_SINGULAR;
73
+ m.attr("KLU_OUT_OF_MEMORY") = KLU_OUT_OF_MEMORY;
74
+ m.attr("KLU_INVALID") = KLU_INVALID;
75
+ m.attr("KLU_TOO_LARGE") = KLU_TOO_LARGE;
76
+
77
+ // KLU functions
78
+ m.def("analyze", [](int32_t n, const nb::ndarray<int32_t>& Ap, const nb::ndarray<int32_t>& Ai, klu_common* common) {
79
+ return klu_analyze(n, Ap.data(), Ai.data(), common);
80
+ });
81
+
82
+ m.def("analyze_given", [](int32_t n, const nb::ndarray<int32_t>& Ap, const nb::ndarray<int32_t>& Ai, const nb::ndarray<int32_t>& P, const nb::ndarray<int32_t>& Q, klu_common* common) {
83
+ return klu_analyze_given(n, Ap.data(), Ai.data(), P.data(), Q.data(), common);
84
+ });
85
+
86
+ m.def("factor", [](const nb::ndarray<int32_t>& Ap, const nb::ndarray<int32_t>& Ai, const nb::ndarray<double>& Ax, klu_symbolic* symbolic, klu_common* common) {
87
+ return klu_factor(Ap.data(), Ai.data(), Ax.data(), symbolic, common);
88
+ });
89
+
90
+ m.def("solve",
91
+ [](klu_symbolic *symbolic, klu_numeric *numeric, int32_t ldim,
92
+ int32_t nrhs, nb::ndarray<double> &B, klu_common *common) {
93
+ return klu_solve(symbolic, numeric, ldim, nrhs, B.data(), common);
94
+ });
95
+
96
+ // m.def("tsolve", [](klu_symbolic* symbolic, klu_numeric* numeric, int32_t ldim, int32_t nrhs, double* B, klu_common* common) {
97
+ // return klu_tsolve(symbolic, numeric, ldim, nrhs, B, common);
98
+ // });
99
+
100
+ // m.def("refactor", [](const int32_t* Ap, const int32_t* Ai, const double* Ax, klu_symbolic* symbolic, klu_numeric* numeric, klu_common* common) {
101
+ // return klu_refactor(const_cast<int32_t*>(Ap), const_cast<int32_t*>(Ai), const_cast<double*>(Ax), symbolic, numeric, common);
102
+ // });
103
+ }
File without changes
@@ -0,0 +1,81 @@
1
+ """KLU sparse solver Python bindings"""
2
+
3
+ import numpy as np
4
+
5
+ # Type aliases
6
+ typedict = dict[str, np.ndarray]
7
+
8
+ # KLU status constants
9
+ KLU_OK: int
10
+ KLU_SINGULAR: int
11
+ KLU_OUT_OF_MEMORY: int
12
+ KLU_INVALID: int
13
+ KLU_TOO_LARGE: int
14
+
15
+ class Common:
16
+ """KLU common control parameters and statistics"""
17
+ def __init__(self) -> None: ...
18
+ def defaults(self) -> None: ...
19
+
20
+ # Parameters
21
+ tol: float
22
+ memgrow: float
23
+ initmem_amd: float
24
+ initmem: float
25
+ maxwork: float
26
+ btf: int
27
+ ordering: int
28
+ scale: int
29
+ halt_if_singular: int
30
+
31
+ # Statistics
32
+ status: int
33
+ nrealloc: int
34
+ structural_rank: int
35
+ numerical_rank: int
36
+ singular_col: int
37
+ noffdiag: int
38
+ flops: float
39
+ rcond: float
40
+ condest: float
41
+ rgrowth: float
42
+ work: float
43
+ memusage: int
44
+ mempeak: int
45
+
46
+ class Symbolic:
47
+ """KLU symbolic factorization object"""
48
+ def free(self, common: Common) -> None: ...
49
+
50
+ # Symbolic factorization properties
51
+ symmetry: float
52
+ est_flops: float
53
+ lnz: float
54
+ unz: float
55
+ n: int
56
+ nz: int
57
+ nzoff: int
58
+ nblocks: int
59
+ maxblock: int
60
+ ordering: int
61
+ do_btf: int
62
+ structural_rank: int
63
+
64
+ class Numeric:
65
+ """KLU numeric factorization object"""
66
+ def free(self, common: Common) -> None: ...
67
+
68
+ # Numeric factorization properties
69
+ n: int
70
+ nblocks: int
71
+ lnz: int
72
+ unz: int
73
+ max_lnz_block: int
74
+ max_unz_block: int
75
+ nzoff: int
76
+
77
+ # KLU functions
78
+ def analyze(n: int, Ap: np.ndarray[int], Ai: np.ndarray[int], common: Common) -> Symbolic: ...
79
+ def analyze_given(n: int, Ap: np.ndarray[int], Ai: np.ndarray[int], P: np.ndarray[int], Q: np.ndarray[int], common: Common) -> Symbolic: ...
80
+ def factor(Ap: np.ndarray[int], Ai: np.ndarray[int], Ax: np.ndarray[float], symbolic: Symbolic, common: Common) -> Numeric: ...
81
+ def solve(symbolic: Symbolic, numeric: Numeric, ldim: int, nrhs: int, B: np.ndarray[float], common: Common) -> int: ...
File without changes
@@ -0,0 +1,30 @@
1
+ project(suitesparse)
2
+
3
+ file(GLOB SUITESPARSE_CONFIG_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/suitesparse_config/src/*.c")
4
+ add_library(suitesparse_config ${SUITESPARSE_CONFIG_SOURCES})
5
+ target_compile_definitions(suitesparse_config PUBLIC NTIMER)
6
+ target_include_directories(suitesparse_config PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/suitesparse_config/include)
7
+
8
+ file(GLOB SUITESPARSE_AMD_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/amd/src/*.c")
9
+ add_library(amd ${SUITESPARSE_AMD_SOURCES})
10
+ target_include_directories(amd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/amd/include)
11
+ target_link_libraries(amd PUBLIC suitesparse_config)
12
+
13
+ file(GLOB SUITESPARSE_COLAMD_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/colamd/src/*.c")
14
+ add_library(colamd ${SUITESPARSE_COLAMD_SOURCES})
15
+ target_include_directories(colamd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/colamd/include)
16
+ target_link_libraries(colamd PUBLIC suitesparse_config)
17
+
18
+ file(GLOB SUITESPARSE_BTF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/btf/src/*.c")
19
+ add_library(btf ${SUITESPARSE_BTF_SOURCES})
20
+ target_include_directories(btf PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/btf/include)
21
+ target_link_libraries(btf PUBLIC suitesparse_config)
22
+
23
+ file(GLOB SUITESPARSE_KLU_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/klu/src/*.c")
24
+ add_library(klu ${SUITESPARSE_KLU_SOURCES})
25
+ target_include_directories(klu PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/klu/include)
26
+ target_link_libraries(klu PUBLIC suitesparse_config amd colamd btf)
27
+
28
+ set_target_properties(amd btf colamd klu suitesparse_config
29
+ PROPERTIES POSITION_INDEPENDENT_CODE ON
30
+ )