46 lines
1.6 KiB
Ruby
46 lines
1.6 KiB
Ruby
class Sundials < Formula
|
|
desc "Nonlinear and differential/algebraic equations solver"
|
|
homepage "https://computation.llnl.gov/casc/sundials/main.html"
|
|
url "https://computation.llnl.gov/projects/sundials/download/sundials-4.1.0.tar.gz"
|
|
sha256 "280de1c27b2360170a6f46cb3799b2aee9dff3bddbafc8b08c291a47ab258aa5"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "f0d3b4aa8224d34bded3dcb334af01413418c76803805d4c52202cb5d1acd41f" => :mojave
|
|
sha256 "a892a1e43042b3bf22027f949efdead295a211cfba492cef2613dadf67ed79fe" => :high_sierra
|
|
sha256 "a934b8dc4ca9ef13c001d5e75196e51858ffc58dd1de3c22b018ac10bc6effdc" => :sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "gcc" # for gfortran
|
|
depends_on "open-mpi"
|
|
depends_on "suite-sparse"
|
|
depends_on "veclibfort"
|
|
|
|
def install
|
|
blas = "-L#{Formula["veclibfort"].opt_lib} -lvecLibFort"
|
|
args = std_cmake_args + %W[
|
|
-DCMAKE_C_COMPILER=#{ENV["CC"]}
|
|
-DBUILD_SHARED_LIBS=ON
|
|
-DKLU_ENABLE=ON
|
|
-DKLU_LIBRARY_DIR=#{Formula["suite-sparse"].opt_lib}
|
|
-DKLU_INCLUDE_DIR=#{Formula["suite-sparse"].opt_include}
|
|
-DLAPACK_ENABLE=ON
|
|
-DLAPACK_LIBRARIES=#{blas};#{blas}
|
|
-DMPI_ENABLE=ON
|
|
]
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *args
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
cp Dir[prefix/"examples/nvector/serial/*"], testpath
|
|
system ENV.cc, "-I#{include}", "test_nvector.c", "sundials_nvector.c",
|
|
"test_nvector_serial.c", "-L#{lib}", "-lsundials_nvecserial"
|
|
assert_match "SUCCESS: NVector module passed all tests",
|
|
shell_output("./a.out 42 0")
|
|
end
|
|
end
|