49 lines
1.7 KiB
Ruby
49 lines
1.7 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"
|
|
revision 2
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "de1b2b9fa513d372b7f53a9354b1d0ff4675b6055f9bf0d42a4dad0a693064ac" => :catalina
|
|
sha256 "da83304cfc31d4b07693b64271dcceb940446616551aaf3ccd82945be923116c" => :mojave
|
|
sha256 "15e9971b298bfaf56193a982e161e3011f7af31717486343892a1186f56466d3" => :high_sierra
|
|
sha256 "93bdbe8c2cef3dbd89358a3c92ad19f4ed51e9060dafb2d04196c4333ebd8da3" => :sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "gcc" # for gfortran
|
|
depends_on "open-mpi"
|
|
depends_on "openblas"
|
|
depends_on "suite-sparse"
|
|
|
|
def install
|
|
blas = "-L#{Formula["openblas"].opt_lib} -lopenblas"
|
|
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
|
|
-DBLA_VENDOR=OpenBLAS
|
|
-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
|