Skip to content

Commit 63665a2

Browse files
authored
Merge pull request #247310 from Homebrew/cgal-deps
cgal: use specific Qt dependencies
2 parents 2b7c0e2 + 2f6470b commit 63665a2

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

Formula/c/cgal.rb

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Cgal < Formula
1010
end
1111

1212
depends_on "cmake" => [:build, :test]
13-
depends_on "qt" => :test
13+
depends_on "qtbase" => :test
1414
depends_on "boost"
1515
depends_on "eigen"
1616
depends_on "gmp"
@@ -30,7 +30,8 @@ def install
3030
end
3131

3232
test do
33-
# https://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2draw_triangulation_2_8cpp-example.html and https://doc.cgal.org/latest/Algebraic_foundations/Algebraic_foundations_2interoperable_8cpp-example.html
33+
# https://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2draw_triangulation_2_8cpp-example.html
34+
# https://doc.cgal.org/latest/Algebraic_foundations/Algebraic_foundations_2interoperable_8cpp-example.html
3435
(testpath/"surprise.cpp").write <<~CPP
3536
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
3637
#include <CGAL/Triangulation_2.h>
@@ -39,16 +40,17 @@ def install
3940
#include <CGAL/Coercion_traits.h>
4041
#include <CGAL/IO/io.h>
4142
#include <fstream>
43+
4244
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
43-
typedef CGAL::Triangulation_2<K> Triangulation;
44-
typedef Triangulation::Point Point;
45+
typedef CGAL::Triangulation_2<K> Triangulation;
46+
typedef Triangulation::Point Point;
4547
4648
template <typename A, typename B>
4749
typename CGAL::Coercion_traits<A,B>::Type
4850
binary_func(const A& a , const B& b){
49-
typedef CGAL::Coercion_traits<A,B> CT;
50-
typename CT::Cast cast;
51-
return cast(a)*cast(b);
51+
typedef CGAL::Coercion_traits<A,B> CT;
52+
typename CT::Cast cast;
53+
return cast(a)*cast(b);
5254
}
5355
5456
int main(int argc, char**) {
@@ -64,19 +66,18 @@ def install
6466
return EXIT_SUCCESS;
6567
}
6668
CPP
69+
6770
(testpath/"CMakeLists.txt").write <<~CMAKE
68-
cmake_minimum_required(VERSION 3.1...3.15)
71+
cmake_minimum_required(VERSION 3.15)
72+
project(surprise)
6973
find_package(CGAL COMPONENTS Qt6)
7074
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
71-
include_directories(surprise BEFORE SYSTEM #{Formula["qt"].opt_include})
7275
add_executable(surprise surprise.cpp)
73-
target_include_directories(surprise BEFORE PUBLIC #{Formula["qt"].opt_include})
7476
target_link_libraries(surprise PUBLIC CGAL::CGAL_Qt6)
7577
CMAKE
76-
system "cmake", "-L", "-DQt6_DIR=#{Formula["qt"].opt_lib}/cmake/Qt6",
77-
"-DCMAKE_PREFIX_PATH=#{Formula["qt"].opt_lib}",
78-
"-DCMAKE_BUILD_RPATH=#{HOMEBREW_PREFIX}/lib", "-DCMAKE_PREFIX_PATH=#{prefix}", "."
79-
system "cmake", "--build", ".", "-v"
80-
assert_equal "15\n15", shell_output("./surprise").chomp
78+
79+
system "cmake", "-S", ".", "-B", "build", *std_cmake_args
80+
system "cmake", "--build", "build"
81+
assert_equal "15\n15", shell_output("./build/surprise").chomp
8182
end
8283
end

0 commit comments

Comments
 (0)