/
coin3d.rb
96 lines (82 loc) 路 3.17 KB
/
coin3d.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
class Coin3d < Formula
desc "Open Inventor 2.1 API implementation (Coin) with Python bindings (Pivy)"
homepage "https://coin3d.github.io/"
license all_of: ["BSD-3-Clause", "ISC"]
stable do
url "https://github.com/coin3d/coin/releases/download/v4.0.2/coin-4.0.2-src.zip"
sha256 "b764a88674f96fa540df3a9520d80586346843779858dcb6cd8657725fcb16f0"
# TODO: migrate pyside@2 -> pyside and python@3.10 -> python@3.12 on next pivy release
resource "pivy" do
url "https://github.com/coin3d/pivy/archive/refs/tags/0.6.8.tar.gz"
sha256 "c443dd7dd724b0bfa06427478b9d24d31e0c3b5138ac5741a2917a443b28f346"
end
end
bottle do
sha256 cellar: :any, arm64_sonoma: "109634fdffabd73998545546b0608fb74e325744326e8d5e6e5a7911c0c47c47"
sha256 cellar: :any, arm64_ventura: "99d3003891e5b8b7264d74feb424acfaeab6b721d82c0e90a908b79536ff9f13"
sha256 cellar: :any, arm64_monterey: "ce73bef75ed4334d2a880bebb4f96c729eeac891bd73ef6ca042fef7ed7c9509"
sha256 cellar: :any, sonoma: "9940156cce6b8569b81dfb790b958e2b9d9c370daa15888bdca668b0deb230d9"
sha256 cellar: :any, ventura: "2b85535a188812a6211ec7f4aa80962b6786a9ed7a9010a3384d5b4e1b09fed4"
sha256 cellar: :any, monterey: "e63ea57db53d46dcbf42ad69021b3c1a4363621ccae6a6995481cc0a70f88f68"
end
head do
url "https://github.com/coin3d/coin.git", branch: "master"
resource "pivy" do
url "https://github.com/coin3d/pivy.git", branch: "master"
end
end
depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "ninja" => :build
depends_on "swig" => :build
depends_on "boost"
depends_on "pyside@2"
depends_on "python@3.10"
on_linux do
depends_on "mesa"
depends_on "mesa-glu"
end
def python3
"python3.10"
end
def install
system "cmake", "-S", ".", "-B", "_build",
"-DCOIN_BUILD_MAC_FRAMEWORK=OFF",
"-DCOIN_BUILD_DOCUMENTATION=ON",
"-DCOIN_BUILD_TESTS=OFF",
*std_cmake_args
system "cmake", "--build", "_build"
system "cmake", "--install", "_build"
resource("pivy").stage do
ENV.append_path "CMAKE_PREFIX_PATH", prefix.to_s
ENV["LDFLAGS"] = "-Wl,-rpath,#{opt_lib}"
system python3, "-m", "pip", "install", *std_pip_args, "."
end
end
test do
(testpath/"test.cpp").write <<~EOS
#include <Inventor/SoDB.h>
int main() {
SoDB::init();
SoDB::cleanup();
return 0;
}
EOS
opengl_flags = if OS.mac?
["-Wl,-framework,OpenGL"]
else
["-L#{Formula["mesa"].opt_lib}", "-lGL"]
end
system ENV.cc, "test.cpp", "-L#{lib}", "-lCoin", *opengl_flags, "-o", "test"
system "./test"
ENV.append_path "PYTHONPATH", Formula["pyside@2"].opt_prefix/Language::Python.site_packages(python3)
# Set QT_QPA_PLATFORM to minimal to avoid error:
# "This application failed to start because no Qt platform plugin could be initialized."
ENV["QT_QPA_PLATFORM"] = "minimal" if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]
system python3, "-c", <<~EOS
import shiboken2
from pivy.sogui import SoGui
assert SoGui.init("test") is not None
EOS
end
end