Skip to content

Commit 48f9b6c

Browse files
authored
sundials: add version 7.5.0 (#28784)
* add version sundials/7.5.0 * fix dependencies and add new libs * fix * fix * add fix_apple_shared_install_name
1 parent 83b9be9 commit 48f9b6c

File tree

6 files changed

+53
-91
lines changed

6 files changed

+53
-91
lines changed

recipes/sundials/all/conandata.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
sources:
2-
"5.4.0":
3-
url: "https://github.com/LLNL/sundials/releases/download/v5.4.0/sundials-5.4.0.tar.gz"
4-
sha256: "a60ba8155ca12261cf7623efcf9fd4232e95bcfefe480993ef71324176cb395b"
5-
"5.3.0":
6-
url: "https://github.com/LLNL/sundials/releases/download/v5.3.0/sundials-5.3.0.tar.gz"
7-
sha256: "88dff7e11a366853d8afd5de05bf197a8129a804d9d4461fb64297f1ef89bca7"
8-
"5.2.0":
9-
url: "https://github.com/LLNL/sundials/releases/download/v5.2.0/sundials-5.2.0.tar.gz"
10-
sha256: "95f058acce5bd66e654de65acdbb1c9f44c90cf1b4e28f8d933cdb4415ebba3e"
2+
"7.5.0":
3+
url: "https://github.com/LLNL/sundials/releases/download/v7.5.0/sundials-7.5.0.tar.gz"
4+
sha256: "089ac659507def738b7a65b574ffe3a900d38569e3323d9709ebed3e445adecc"

recipes/sundials/all/conanfile.py

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from conan import ConanFile
22
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
3-
from conan.tools.files import copy, get, mkdir
3+
from conan.tools.files import copy, get, mkdir, rmdir
4+
from conan.tools.apple import fix_apple_shared_install_name
45
import glob
56
import os
67
import shutil
@@ -56,6 +57,9 @@ def configure(self):
5657
def layout(self):
5758
cmake_layout(self, src_folder="src")
5859

60+
def build_requirements(self):
61+
self.tool_requires("cmake/[>=3.18]")
62+
5963
def source(self):
6064
get(self, **self.conan_data["sources"][self.version], strip_root=True)
6165

@@ -81,62 +85,51 @@ def package(self):
8185
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
8286
cmake = CMake(self)
8387
cmake.install()
88+
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
8489
if self.settings.os == "Windows" and self.options.shared:
8590
mkdir(self, os.path.join(self.package_folder, "bin"))
8691
for dll_path in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")):
8792
shutil.move(dll_path, os.path.join(self.package_folder, "bin", os.path.basename(dll_path)))
93+
fix_apple_shared_install_name(self)
8894

8995
def package_info(self):
90-
self.cpp_info.components["sundials_nvecmanyvector"].libs = ["sundials_nvecmanyvector"]
91-
self.cpp_info.components["sundials_nvecserial"].libs = ["sundials_nvecserial"]
92-
self.cpp_info.components["sundials_sunlinsolband"].libs = ["sundials_sunlinsolband"]
93-
self.cpp_info.components["sundials_sunlinsolband"].requires = ["sundials_sunmatrixband"]
94-
self.cpp_info.components["sundials_sunlinsoldense"].libs = ["sundials_sunlinsoldense"]
95-
self.cpp_info.components["sundials_sunlinsoldense"].requires = ["sundials_sunmatrixdense"]
96-
self.cpp_info.components["sundials_sunlinsolpcg"].libs = ["sundials_sunlinsolpcg"]
97-
self.cpp_info.components["sundials_sunlinsolspbcgs"].libs = ["sundials_sunlinsolspbcgs"]
98-
self.cpp_info.components["sundials_sunlinsolspfgmr"].libs = ["sundials_sunlinsolspfgmr"]
99-
self.cpp_info.components["sundials_sunlinsolspgmr"].libs = ["sundials_sunlinsolspgmr"]
100-
self.cpp_info.components["sundials_sunlinsolsptfqmr"].libs = ["sundials_sunlinsolsptfqmr"]
101-
self.cpp_info.components["sundials_sunmatrixband"].libs = ["sundials_sunmatrixband"]
102-
self.cpp_info.components["sundials_sunmatrixdense"].libs = ["sundials_sunmatrixdense"]
103-
self.cpp_info.components["sundials_sunmatrixsparse"].libs = ["sundials_sunmatrixsparse"]
104-
self.cpp_info.components["sundials_sunnonlinsolfixedpoint"].libs = ["sundials_sunnonlinsolfixedpoint"]
105-
self.cpp_info.components["sundials_sunnonlinsolnewton"].libs = ["sundials_sunnonlinsolnewton"]
106-
if self.settings.os in ["Linux", "FreeBSD"]:
107-
self.cpp_info.components["sundials_nvecmanyvector"].system_libs = ["m"]
108-
self.cpp_info.components["sundials_nvecserial"].system_libs = ["m"]
109-
self.cpp_info.components["sundials_sunlinsolpcg"].system_libs = ["m"]
110-
self.cpp_info.components["sundials_sunlinsolspbcgs"].system_libs = ["m"]
111-
self.cpp_info.components["sundials_sunlinsolspfgmr"].system_libs = ["m"]
112-
self.cpp_info.components["sundials_sunlinsolspgmr"].system_libs = ["m"]
113-
self.cpp_info.components["sundials_sunlinsolsptfqmr"].system_libs = ["m"]
114-
self.cpp_info.components["sundials_sunmatrixband"].system_libs = ["m"]
115-
self.cpp_info.components["sundials_sunmatrixdense"].system_libs = ["m"]
116-
self.cpp_info.components["sundials_sunmatrixsparse"].system_libs = ["m"]
117-
self.cpp_info.components["sundials_sunnonlinsolfixedpoint"].system_libs = ["m"]
118-
self.cpp_info.components["sundials_sunnonlinsolnewton"].system_libs = ["m"]
119-
if self.options.build_arkode:
120-
self.cpp_info.components["sundials_arkode"].libs = ["sundials_arkode"]
96+
97+
def _add_library(name):
98+
# SundialsAddLibrary.cmake#377, where the first branch is always taken.
99+
library_suffix = "_static" if not self.options.shared and self.settings.compiler == "msvc" else ""
100+
self.cpp_info.components[name].libs = ["sundials_" + name + library_suffix]
101+
target_suffix = "_shared" if self.options.shared else "_static"
102+
self.cpp_info.components[name].set_property("cmake_target_name", f"SUNDIALS::{name}{target_suffix}")
121103
if self.settings.os in ["Linux", "FreeBSD"]:
122-
self.cpp_info.components["sundials_arkode"].system_libs = ["m"]
104+
self.cpp_info.components[name].system_libs.append("m")
105+
return self.cpp_info.components[name]
106+
107+
_add_library("core")
108+
_add_library("nvecserial").requires = ["core"]
109+
_add_library("nvecmanyvector").requires = ["core"]
110+
_add_library("sunmatrixdense").requires = ["core"]
111+
_add_library("sunmatrixband").requires = ["core"]
112+
_add_library("sunmatrixsparse").requires = ["core"]
113+
_add_library("sundomeigestpower").requires = ["core"]
114+
_add_library("sunlinsoldense").requires = ["core", "sunmatrixdense"]
115+
_add_library("sunlinsolband").requires = ["core", "sunmatrixband"]
116+
_add_library("sunlinsolpcg").requires = ["core"]
117+
_add_library("sunlinsolspbcgs").requires = ["core"]
118+
_add_library("sunlinsolspfgmr").requires = ["core"]
119+
_add_library("sunlinsolspgmr").requires = ["core"]
120+
_add_library("sunlinsolsptfqmr").requires = ["core"]
121+
_add_library("sunnonlinsolfixedpoint").requires = ["core"]
122+
_add_library("sunnonlinsolnewton").requires = ["core"]
123+
124+
if self.options.build_arkode:
125+
_add_library("arkode").requires = ["core"]
123126
if self.options.build_cvode:
124-
self.cpp_info.components["sundials_cvode"].libs = ["sundials_cvode"]
125-
if self.settings.os in ["Linux", "FreeBSD"]:
126-
self.cpp_info.components["sundials_cvode"].system_libs = ["m"]
127+
_add_library("cvode").requires = ["core"]
127128
if self.options.build_cvodes:
128-
self.cpp_info.components["sundials_cvodes"].libs = ["sundials_cvodes"]
129-
if self.settings.os in ["Linux", "FreeBSD"]:
130-
self.cpp_info.components["sundials_cvodes"].system_libs = ["m"]
129+
_add_library("cvodes").requires = ["core"]
131130
if self.options.build_ida:
132-
self.cpp_info.components["sundials_ida"].libs = ["sundials_ida"]
133-
if self.settings.os in ["Linux", "FreeBSD"]:
134-
self.cpp_info.components["sundials_ida"].system_libs = ["m"]
131+
_add_library("ida").requires = ["core"]
135132
if self.options.build_idas:
136-
self.cpp_info.components["sundials_idas"].libs = ["sundials_idas"]
137-
if self.settings.os in ["Linux", "FreeBSD"]:
138-
self.cpp_info.components["sundials_idas"].system_libs = ["m"]
133+
_add_library("idas").requires = ["core"]
139134
if self.options.build_kinsol:
140-
self.cpp_info.components["sundials_kinsol"].libs = ["sundials_kinsol"]
141-
if self.settings.os in ["Linux", "FreeBSD"]:
142-
self.cpp_info.components["sundials_kinsol"].system_libs = ["m"]
135+
_add_library("kinsol").requires = ["core"]

recipes/sundials/all/test_package/test_package.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
#include <sunmatrix/sunmatrix_dense.h>
33
#include <sunlinsol/sunlinsol_dense.h>
44
#include <sundials/sundials_types.h>
5+
#include <sundials/sundials_context.h>
56

67
int main()
78
{
8-
N_Vector y = N_VNew_Serial(1);
9+
SUNContext sunctx;
10+
SUNContext_Create(0, &sunctx);
11+
12+
N_Vector y = N_VNew_Serial(1, sunctx);
913
NV_DATA_S(y)[0] = 2.0;
10-
SUNMatrix A = SUNDenseMatrix(1, 1);
11-
SUNLinearSolver LS = SUNLinSol_Dense(y, A);
14+
SUNMatrix A = SUNDenseMatrix(1, 1, sunctx);
15+
SUNLinearSolver LS = SUNLinSol_Dense(y, A, sunctx);
1216

13-
N_Vector v = N_VNew_Serial(1);;
17+
N_Vector v = N_VNew_Serial(1, sunctx);
1418
N_VScale(2.0, y, v);
1519
return 0;
1620
}

recipes/sundials/all/test_v1_package/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

recipes/sundials/all/test_v1_package/conanfile.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

recipes/sundials/config.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
versions:
2-
"5.4.0":
3-
folder: all
4-
"5.3.0":
5-
folder: all
6-
"5.2.0":
2+
"7.5.0":
73
folder: all

0 commit comments

Comments
 (0)