class Cgal < Formula desc "Computational Geometry Algorithm Library" homepage "https://www.cgal.org/" url "https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.14.1/CGAL-4.14.1.tar.xz" sha256 "d4ec2528b88a7c3a07b0b86db96c216822f85b951bf4bc7f9d1f26bf6c369afe" bottle do cellar :any sha256 "d9b8e3f6b52853ac92f6eaa4023a074dc8ce317ceea9e9be8b98e5a9eb06aa88" => :catalina sha256 "d5899f80357aaf49b2c318813ea6c39fd4c02b354495d9a5f488452808af0ccf" => :mojave sha256 "f7354a832cf0eb5ec2558a288ca21b9e5d4664370597d2a079ec35bce80e7ff7" => :high_sierra end depends_on "cmake" => [:build, :test] depends_on "boost" depends_on "eigen" depends_on "gmp" depends_on "mpfr" 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 -DWITH_CGAL_Qt5=OFF -DWITH_CGAL_ImageIO=OFF ] 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 (testpath/"CMakeLists.txt").write <<~EOS cmake_minimum_required(VERSION 3.1...3.13) find_package(CGAL) add_executable(surprise surprise.cpp) target_link_libraries(surprise PRIVATE CGAL::CGAL) EOS system "cmake", "-L", "-DCMAKE_BUILD_RPATH=#{HOMEBREW_PREFIX}/lib", "-DCMAKE_PREFIX_PATH=#{prefix}", "." system "cmake", "--build", ".", "-v" assert_equal "15\n15", shell_output("./surprise").chomp end end