cppad: migrate from homebrew/science

Closes #17028.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
FX Coudert 2017-08-20 17:08:40 +02:00
parent 052c376156
commit b903a6de5d

37
Formula/cppad.rb Normal file
View file

@ -0,0 +1,37 @@
class Cppad < Formula
desc "Differentiation of C++ Algorithms"
homepage "https://www.coin-or.org/CppAD"
url "http://www.coin-or.org/download/source/CppAD/cppad-20170820.epl.tgz"
version "20170820"
sha256 "f491115fe0be06cc29cac938e90f6e3cfbddb9cb7f0a0ae1f68f17123e32d0c1"
head "https://github.com/coin-or/CppAD.git"
depends_on "cmake" => :build
def install
mkdir "build" do
system "cmake", "..", *std_cmake_args,
"-Dcppad_prefix=#{prefix}"
system "make", "install"
end
pkgshare.install "example"
end
test do
(testpath/"test.cpp").write <<-EOS
#include <cassert>
#include <cppad/utility/thread_alloc.hpp>
int main(void) {
extern bool acos(void);
bool ok = acos();
assert(ok);
return static_cast<int>(!ok);
}
EOS
system ENV.cxx, "#{pkgshare}/example/general/acos.cpp", "-I#{include}",
"test.cpp", "-o", "test"
system "./test"
end
end