sundials: migrate from homebrew/science

Closes #16832.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
master
FX Coudert 2017-08-15 21:47:58 +02:00
parent 36d16aa917
commit 033d563b94
2 changed files with 45 additions and 1 deletions

45
Formula/sundials.rb Normal file
View File

@ -0,0 +1,45 @@
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-2.7.0.tar.gz"
sha256 "d39fcac7175d701398e4eb209f7e92a5b30a78358d4a0c0fcc23db23c11ba104"
revision 2
option "with-openmp", "Enable OpenMP multithreading"
depends_on "cmake" => :build
depends_on "suite-sparse"
depends_on "veclibfort"
depends_on :fortran
depends_on :mpi => [:cc, :f77, :recommended]
needs :openmp if build.with?("openmp")
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}
]
args << "-DOPENMP_ENABLE=ON" if build.with? "openmp"
args << "-DMPI_ENABLE=ON" if build.with? "mpi"
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

View File

@ -52,7 +52,6 @@
"shark": "homebrew/science",
"slicot": "homebrew/science",
"sqlitebrowser": "caskroom/cask",
"sundials": "homebrew/science",
"tetgen": "homebrew/science",
"ticcutils": "homebrew/science",
"timbl": "homebrew/science",