class Cgal < Formula desc "Computational Geometry Algorithm Library" homepage "https://www.cgal.org/" url "https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.13/CGAL-4.13.tar.xz" sha256 "3e3dd7a64febda58be54c3cbeba329ab6a73b72d4d7647ba4931ecd1fad0e3bc" bottle do cellar :any sha256 "d969597f4c3fb993bf19363e4e92f0f74427e25f6f855fa28d1f9792084aea9b" => :mojave sha256 "e6978f966bdd5a050f80185d8e506a38016a8adad6010b039b9ef42558ed14eb" => :high_sierra sha256 "349890c9c6f40272b3173c15412701f6588003047e5ebc3e0cd2a03c870ba83d" => :sierra end option "with-qt", "Build ImageIO and Qt components of CGAL" deprecated_option "imaging" => "with-qt" deprecated_option "with-imaging" => "with-qt" deprecated_option "with-qt5" => "with-qt" depends_on "cmake" => :build depends_on "boost" depends_on "eigen" depends_on "gmp" depends_on "mpfr" depends_on "qt" => :optional def install args = std_cmake_args + %W[ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_NAME_DIR=#{HOMEBREW_PREFIX}/lib -DWITH_Eigen3=ON -DWITH_LAPACK=ON ] if build.without? "qt" args << "-DWITH_CGAL_Qt5=OFF" << "-DWITH_CGAL_ImageIO=OFF" else args << "-DWITH_CGAL_Qt5=ON" << "-DWITH_CGAL_ImageIO=ON" end system "cmake", ".", *args system "make", "install" end test do # https://doc.cgal.org/latest/Algebraic_foundations/Algebraic_foundations_2interoperable_8cpp-example.html (testpath/"surprise.cpp").write <<~EOS #include #include #include template typename CGAL::Coercion_traits::Type binary_func(const A& a , const B& b){ typedef CGAL::Coercion_traits 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