2011-03-10 05:11:03 +00:00
|
|
|
class Cgal < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "CGAL: Computational Geometry Algorithm Library"
|
2016-05-27 10:25:18 +00:00
|
|
|
homepage "https://www.cgal.org/"
|
2016-09-19 17:38:34 +00:00
|
|
|
url "https://github.com/CGAL/cgal/releases/download/releases/CGAL-4.9/CGAL-4.9.tar.xz"
|
|
|
|
sha256 "63ac5df71f912f34f2f0f2e54a303578df51f4ec2627db593a65407d791f9039"
|
2010-06-24 03:49:22 +00:00
|
|
|
|
2014-10-22 17:39:42 +00:00
|
|
|
bottle do
|
2015-07-19 03:21:56 +00:00
|
|
|
cellar :any
|
2016-09-25 16:26:26 +00:00
|
|
|
sha256 "bc2d75f374a2b7b801a243937553cdaf23c4ec1f3f3cbce0910f0c5357ed7820" => :sierra
|
|
|
|
sha256 "1347cfad615b487b11e083e7114ac2e3e0d2fb271cb7a9413ed1531d03c92f1b" => :el_capitan
|
|
|
|
sha256 "0014c368e53254801a2a1233424027156e2bdf0c09c12b17246119c8337fd02a" => :yosemite
|
2014-10-22 17:39:42 +00:00
|
|
|
end
|
|
|
|
|
2016-08-28 10:29:39 +00:00
|
|
|
option :cxx11
|
2016-08-28 12:51:49 +00:00
|
|
|
option "with-qt5", "Build ImageIO and QT5 compoments of CGAL"
|
|
|
|
option "with-eigen", "Build with Eigen3 support"
|
2015-08-03 12:55:31 +00:00
|
|
|
option "with-lapack", "Build with LAPACK support"
|
2012-08-26 06:29:51 +00:00
|
|
|
|
2016-08-28 12:51:49 +00:00
|
|
|
deprecated_option "imaging" => "with-qt5"
|
|
|
|
deprecated_option "with-imaging" => "with-qt5"
|
|
|
|
deprecated_option "with-eigen3" => "with-eigen"
|
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "cmake" => :build
|
2016-08-28 10:29:39 +00:00
|
|
|
depends_on "mpfr"
|
2016-08-28 12:51:49 +00:00
|
|
|
|
|
|
|
depends_on "qt5" => :optional
|
|
|
|
depends_on "eigen" => :optional
|
2016-08-28 10:29:39 +00:00
|
|
|
|
2014-01-07 08:52:59 +00:00
|
|
|
if build.cxx11?
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "boost" => "c++11"
|
|
|
|
depends_on "gmp" => "c++11"
|
2014-01-07 08:52:59 +00:00
|
|
|
else
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "boost"
|
|
|
|
depends_on "gmp"
|
2014-01-07 08:52:59 +00:00
|
|
|
end
|
2014-02-13 04:23:29 +00:00
|
|
|
|
2010-06-24 03:49:22 +00:00
|
|
|
def install
|
2014-01-07 08:52:59 +00:00
|
|
|
ENV.cxx11 if build.cxx11?
|
2016-08-28 12:51:49 +00:00
|
|
|
|
|
|
|
args = std_cmake_args + %W[
|
|
|
|
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
|
|
|
|
-DCMAKE_INSTALL_NAME_DIR=#{HOMEBREW_PREFIX}/lib
|
|
|
|
]
|
|
|
|
|
|
|
|
if build.without? "qt5"
|
|
|
|
args << "-DWITH_CGAL_Qt5=OFF" << "-DWITH_CGAL_ImageIO=OFF"
|
|
|
|
else
|
|
|
|
args << "-DWITH_CGAL_Qt5=ON" << "-DWITH_CGAL_ImageIO=ON"
|
2010-10-27 01:18:23 +00:00
|
|
|
end
|
2016-08-28 12:51:49 +00:00
|
|
|
|
|
|
|
if build.with? "eigen"
|
2013-05-30 16:41:42 +00:00
|
|
|
args << "-DWITH_Eigen3=ON"
|
2016-08-28 12:51:49 +00:00
|
|
|
else
|
|
|
|
args << "-DWITH_Eigen3=OFF"
|
2013-05-30 16:41:42 +00:00
|
|
|
end
|
2016-08-28 12:51:49 +00:00
|
|
|
|
2014-03-06 20:40:26 +00:00
|
|
|
if build.with? "lapack"
|
2013-05-30 16:41:42 +00:00
|
|
|
args << "-DWITH_LAPACK=ON"
|
2016-08-28 12:51:49 +00:00
|
|
|
else
|
|
|
|
args << "-DWITH_LAPACK=OFF"
|
2013-05-30 16:41:42 +00:00
|
|
|
end
|
2016-08-28 12:51:49 +00:00
|
|
|
|
|
|
|
system "cmake", ".", *args
|
2015-08-03 12:55:31 +00:00
|
|
|
system "make", "install"
|
2010-06-24 03:49:22 +00:00
|
|
|
end
|
2014-02-13 04:23:29 +00:00
|
|
|
|
2016-08-28 10:29:39 +00:00
|
|
|
test do
|
2016-09-11 07:50:35 +00:00
|
|
|
# https://doc.cgal.org/latest/Algebraic_foundations/Algebraic_foundations_2interoperable_8cpp-example.html
|
2016-08-28 10:29:39 +00:00
|
|
|
(testpath/"surprise.cpp").write <<-EOS.undent
|
|
|
|
#include <CGAL/basic.h>
|
|
|
|
#include <CGAL/Coercion_traits.h>
|
|
|
|
#include <CGAL/IO/io.h>
|
|
|
|
template <typename A, typename B>
|
|
|
|
typename CGAL::Coercion_traits<A,B>::Type
|
|
|
|
binary_func(const A& a , const B& b){
|
|
|
|
typedef CGAL::Coercion_traits<A,B> CT;
|
|
|
|
CGAL_static_assertion((CT::Are_explicit_interoperable::value));
|
|
|
|
typename CT::Cast cast;
|
|
|
|
return cast(a)*cast(b);
|
|
|
|
}
|
|
|
|
int main(){
|
|
|
|
std::cout<< binary_func(double(3), int(5)) << std::endl;
|
|
|
|
std::cout<< binary_func(int(3), double(5)) << std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cxx, "-I#{include}", "-L#{lib}", "-lCGAL",
|
|
|
|
"surprise.cpp", "-o", "test"
|
|
|
|
assert_equal "15\n15", shell_output("./test").chomp
|
|
|
|
end
|
|
|
|
end
|