Created
August 23, 2019 23:05
-
-
Save mseri/60d26461b764e77b45d82ad7f0b0d7de to your computer and use it in GitHub Desktop.
Homebrew formula to install Sundials3 for sundialsml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sundials3 < Formula | |
desc "Nonlinear and differential/algebraic equations solver" | |
homepage "https://computation.llnl.gov/casc/sundials/main.html" | |
url "https://computing.llnl.gov/projects/sundials/download/sundials-3.2.1.tar.gz" | |
version "3.2.1" | |
sha256 "47d94d977ab2382cdcdd02f72a25ebd4ba8ca2634bbb2f191fe1636e71c86808" | |
revision 1 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment