Skip to content

Commit 38eedb3

Browse files
committed
netgen@6.2.2601: checkin new version of netgen
Closes #755. Signed-off-by: Chris <chris.r.jones.1983@gmail.com>
1 parent 20dc5d4 commit 38eedb3

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

Formula/netgen@6.2.2601.rb

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
# SPDX-FileNotice: Part of the FreeCAD project.
3+
4+
class NetgenAT622601 < Formula
5+
desc "C++ Library of NETGEN's tetrahedral mesh generator"
6+
homepage "https://github.com/ngsolve/netgen"
7+
url "https://github.com/ngsolve/netgen.git",
8+
tag: "v6.2.2601"
9+
license "LGPL-2.1-only"
10+
head "https://github.com/ngsolve/netgen.git", branch: "master"
11+
12+
keg_only :versioned_formula
13+
14+
depends_on "cmake" => :build
15+
depends_on "llvm" => [:build, :test]
16+
depends_on "ninja" => :build
17+
depends_on "opencascade"
18+
depends_on "pybind11"
19+
depends_on "python@3.13"
20+
depends_on "zlib-ng-compat"
21+
22+
def install
23+
ENV["CC"] = Formula["llvm"].opt_bin/"clang"
24+
ENV["CXX"] = Formula["llvm"].opt_bin/"clang++"
25+
26+
python3 = Formula["python@3.13"].opt_bin/"python3.13"
27+
28+
ENV["PYTHON"] = python3.to_s
29+
30+
# Get the Python includes directory without duplicates
31+
py_inc_output = `#{python3}-config --includes`
32+
py_inc_dirs = py_inc_output.scan(/-I([^\s]+)/).flatten.uniq
33+
py_inc_dir = py_inc_dirs.join(" ")
34+
35+
puts "----------------------------------------------------"
36+
puts "PYTHON=#{ENV["PYTHON"]}"
37+
puts "----------------------------------------------------"
38+
39+
args = %W[
40+
-DCMAKE_INSTALL_PREFIX=#{prefix}
41+
-DUSE_PYTHON=ON
42+
-DPython3_EXECUTABLE=#{python3}
43+
-DPython3_INCLUDE_DIR=#{py_inc_dir}
44+
-DUSE_GUI=OFF
45+
-DUSE_OCC=ON
46+
-DUSE_SUPERBUILD=OFF
47+
-DBUILD_FOR_CONDA=OFF
48+
-G Ninja
49+
-L
50+
]
51+
52+
system "cmake", "-S", ".", "-B", "build", *args
53+
system "cmake", "--build", "build"
54+
system "cmake", "--install", "build"
55+
end
56+
57+
def caveats
58+
<<~EOS
59+
this is a versioned formula so it is NOT linked in HOMBREW_PREFIX by default
60+
running brew test netgen currently fails with gcc if built with llvm
61+
EOS
62+
end
63+
64+
test do
65+
ENV["CC"] = Formula["llvm"].opt_bin/"clang"
66+
ENV["CXX"] = Formula["llvm"].opt_bin/"clang++"
67+
68+
puts "-----------------------------------------------"
69+
puts "prefix = #{prefix}"
70+
puts "include = #{include}"
71+
puts "-----------------------------------------------"
72+
73+
ng_include = if OS.mac?
74+
prefix/"Contents/Resources/include"
75+
else
76+
include/"include"
77+
end
78+
79+
ng_lib = if OS.mac?
80+
prefix/"Contents/MacOS"
81+
else
82+
lib
83+
end
84+
85+
(testpath/"test.cpp").write <<~EOS
86+
#include <meshing/meshing.hpp>
87+
int main() { return 0; }
88+
EOS
89+
90+
if OS.mac?
91+
res = prefix/"Contents/Resources/include"
92+
system ENV.cxx, "test.cpp", "-I#{res}", "-I#{res}/include", "-L#{ng_lib}", "-lnglib", "-o", "test"
93+
else
94+
system ENV.cxx, "test.cpp", "-I#{ng_include}", "-L#{ng_lib}", "-lnglib", "-o", "test"
95+
end
96+
system "./test"
97+
end
98+
end

0 commit comments

Comments
 (0)