Skip to content

Commit a1798b7

Browse files
authored
gz-plugin4: Bump gz-cmake and others in jetty (#3027)
Bumping gz-cmake and others except gz-tools. Signed-off-by: Steve Peters <[email protected]>
1 parent 45a4b6f commit a1798b7

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

Aliases/gz-plugin4

-1
This file was deleted.

Formula/gz-plugin4.rb

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
class GzPlugin4 < Formula
2+
desc "Plugin libraries for robotics applications"
3+
homepage "https://github.com/gazebosim/gz-plugin"
4+
url "https://github.com/gazebosim/gz-plugin.git", branch: "main"
5+
version "3.999.999-0-20250428"
6+
license "Apache-2.0"
7+
8+
head "https://github.com/gazebosim/gz-plugin.git", branch: "gz-plugin4"
9+
10+
depends_on "cmake"
11+
depends_on "gz-cmake5"
12+
depends_on "gz-tools2"
13+
depends_on "gz-utils4"
14+
depends_on macos: :high_sierra # c++17
15+
depends_on "pkgconf"
16+
17+
def install
18+
rpaths = [
19+
rpath,
20+
rpath(source: libexec/"gz/plugin4", target: lib),
21+
]
22+
cmake_args = std_cmake_args
23+
cmake_args << "-DBUILD_TESTING=OFF"
24+
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"
25+
26+
# Use a build folder
27+
mkdir "build" do
28+
system "cmake", "..", *cmake_args
29+
system "make", "install"
30+
end
31+
end
32+
33+
test do
34+
# test CLI executable
35+
system libexec/"gz/plugin4/gz-plugin"
36+
# build against API
37+
(testpath/"test.cpp").write <<-EOS
38+
#include <gz/plugin/Loader.hh>
39+
int main() {
40+
gz::plugin::Loader loader;
41+
return loader.InterfacesImplemented().size();
42+
}
43+
EOS
44+
(testpath/"CMakeLists.txt").write <<-EOS
45+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
46+
find_package(gz-plugin QUIET REQUIRED COMPONENTS loader)
47+
add_executable(test_cmake test.cpp)
48+
target_link_libraries(test_cmake gz-plugin::loader)
49+
EOS
50+
system "pkg-config", "gz-plugin-loader"
51+
cflags = `pkg-config --cflags gz-plugin-loader`.split
52+
system ENV.cc, "test.cpp",
53+
*cflags,
54+
"-L#{lib}",
55+
"-lgz-plugin-loader",
56+
"-lc++",
57+
"-o", "test"
58+
system "./test"
59+
# test building with cmake
60+
mkdir "build" do
61+
system "cmake", ".."
62+
system "make"
63+
system "./test_cmake"
64+
end
65+
# check for Xcode frameworks in bottle
66+
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
67+
system cmd_not_grep_xcode
68+
end
69+
end

0 commit comments

Comments
 (0)