73 lines
2.7 KiB
Ruby
73 lines
2.7 KiB
Ruby
class Ibex < Formula
|
|
desc "C++ library for constraint processing over real numbers."
|
|
homepage "http://www.ibex-lib.org/"
|
|
url "https://github.com/ibex-team/ibex-lib/archive/ibex-2.3.3.tar.gz"
|
|
sha256 "0eef37cbfd3ea0f6f8645fb375c83d407c61dfa4d7ac9d7fedfd71f0b1191c7e"
|
|
head "https://github.com/ibex-team/ibex-lib.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "a1972a6f268b7fd01c66d0754ec6c068ee77c5cefccc8482bdc28b225354cef3" => :sierra
|
|
sha256 "91e62c090a2fdc6b617daf74e99e8d3ea7731cc31a4086c9305ddfdd01605a6f" => :el_capitan
|
|
sha256 "1fc9b7764cd3fb2de926491b0725a8a961ec0558e9a0e2c5c24e7a2553c69bd4" => :yosemite
|
|
end
|
|
|
|
option "with-java", "Enable Java bindings for CHOCO solver."
|
|
option "with-ampl", "Use AMPL file loader plugin"
|
|
option "without-ensta-robotics", "Don't build the Contractors for robotics (SLAM) plugin"
|
|
option "without-param-estim", "Don't build the Parameter Estimation (enhanced Q-intersection algorithm) plugin"
|
|
|
|
depends_on :java => ["1.8+", :optional]
|
|
depends_on "bison" => :build
|
|
depends_on "flex" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
def install
|
|
if build.with?("java") && build.with?("ampl")
|
|
odie "Cannot set options --with-java and --with-ampl simultaneously for now."
|
|
end
|
|
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--enable-shared
|
|
--with-affine
|
|
--with-optim
|
|
]
|
|
|
|
args << "--with-jni" if build.with? "java"
|
|
args << "--with-ampl" if build.with? "ampl"
|
|
args << "--with-ensta-robotics" if build.with? "ensta-robotics"
|
|
args << "--with-param-estim" if build.with? "param-estim"
|
|
|
|
system "./waf", "configure", *args
|
|
system "make", "-C", "3rd/filibsrc"
|
|
system "./waf", "build"
|
|
system "./waf", "install"
|
|
|
|
pkgshare.install %w[examples benchs]
|
|
(pkgshare/"examples/symb01.txt").write <<-EOS.undent
|
|
function f(x)
|
|
return ((2*x,-x);(-x,3*x));
|
|
end
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
cp_r (pkgshare/"examples").children, testpath
|
|
cp pkgshare/"benchs/cyclohexan3D.bch", testpath/"c3D.bch"
|
|
|
|
# so that pkg-config can remain a build-time only dependency
|
|
inreplace %w[makefile slam/makefile] do |s|
|
|
s.gsub! /CXXFLAGS.*pkg-config --cflags ibex./,
|
|
"CXXFLAGS := -ffloat-store -I#{include} -I#{include}/ibex"
|
|
s.gsub! /LIBS.*pkg-config --libs ibex./,
|
|
"LIBS := -L#{lib} -libex -lprim -lClp -lCoinUtils -lm"
|
|
end
|
|
|
|
system "make", "ctc01", "ctc02", "symb01", "solver01", "solver02"
|
|
system "make", "-C", "slam", "slam1", "slam2", "slam3"
|
|
%w[ctc01 ctc02 symb01].each { |a| system "./#{a}" }
|
|
%w[solver01 solver02].each { |a| system "./#{a}", "c3D.bch", "1e-05", "10" }
|
|
%w[slam1 slam2 slam3].each { |a| system "./slam/#{a}" }
|
|
end
|
|
end
|