From 044d52f7d309e340939d7cae449fd83209da317f Mon Sep 17 00:00:00 2001 From: David Gardner Date: Sat, 22 Feb 2025 20:59:40 -0800 Subject: [PATCH] Update SUNDIALS GNUMake (#4344) Update `Make.sundials` to align with the other external package makefiles --- Tools/GNUMake/packages/Make.sundials | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Tools/GNUMake/packages/Make.sundials b/Tools/GNUMake/packages/Make.sundials index 81dfdf21bc8..7941875d1fd 100644 --- a/Tools/GNUMake/packages/Make.sundials +++ b/Tools/GNUMake/packages/Make.sundials @@ -1,3 +1,41 @@ CPPFLAGS += -DAMREX_USE_SUNDIALS include $(AMREX_HOME)/Src/Extern/SUNDIALS/Make.package + +ifndef AMREX_SUNDIALS_HOME +ifdef SUNDIALS_DIR + AMREX_SUNDIALS_HOME = $(SUNDIALS_DIR) +endif +ifdef SUNDIALS_HOME + AMREX_SUNDIALS_HOME = $(SUNDIALS_HOME) +endif +endif + +ifdef AMREX_SUNDIALS_HOME + SUNDIALS_ABSPATH = $(abspath $(AMREX_SUNDIALS_HOME)) + SYSTEM_INCLUDE_LOCATIONS += $(SUNDIALS_ABSPATH)/include + LIBRARY_LOCATIONS += $(SUNDIALS_ABSPATH)/lib + LIBRARY_LOCATIONS += $(SUNDIALS_ABSPATH)/lib64 + # libraries are usually installed under lib or lib64 depending on the system + LIBRARIES += -Wl,-rpath,$(SUNDIALS_ABSPATH)/lib + LIBRARIES += -Wl,-rpath,$(SUNDIALS_ABSPATH)/lib64 + LIBRARIES += -lsundials_arkode -lsundials_cvode -lsundials_nvecmanyvector + + ifeq ($(USE_CUDA),TRUE) + LIBRARIES += -lsundials_nveccuda + endif + + ifeq ($(USE_HIP),TRUE) + LIBRARIES += -lsundials_nvechip + endif + + ifeq ($(USE_SYCL),TRUE) + LIBRARIES += -lsundials_nvecsycl + endif + + # sundials_core library added in sundials v7.0.0 + ifneq ($(wildcard $(SUNDIALS_ABSPATH)/lib*/libsundials_core.*),) + LIBRARIES += -lsundials_core + endif + +endif