Skip to content

Commit 4093321

Browse files
authored
gz-rendering10: Bump gz-cmake and others in jetty (#3032)
Bumping gz-cmake and others except gz-tools. Signed-off-by: Steve Peters <[email protected]>
1 parent bee56fd commit 4093321

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

Aliases/gz-rendering10

-1
This file was deleted.

Formula/gz-rendering10.rb

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
class GzRendering10 < Formula
2+
desc "Rendering library for robotics applications"
3+
homepage "https://gazebosim.org"
4+
url "https://github.com/gazebosim/gz-rendering.git", branch: "main"
5+
version "9.999.999-0-20250501"
6+
license "Apache-2.0"
7+
8+
head "https://github.com/gazebosim/gz-rendering.git", branch: "gz-rendering10"
9+
10+
depends_on "cmake" => [:build, :test]
11+
depends_on "pkgconf" => [:build, :test]
12+
13+
depends_on "freeimage"
14+
depends_on "gz-cmake5"
15+
depends_on "gz-common7"
16+
depends_on "gz-math9"
17+
depends_on "gz-plugin4"
18+
depends_on "gz-utils4"
19+
depends_on macos: :mojave # c++17
20+
depends_on "ogre1.9"
21+
depends_on "ogre2.3"
22+
23+
def install
24+
rpaths = [
25+
rpath,
26+
rpath(source: lib/"gz-rendering-10/engine-plugins", target: lib),
27+
]
28+
cmake_args = std_cmake_args
29+
cmake_args << "-DBUILD_TESTING=OFF"
30+
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"
31+
32+
# Use a build folder
33+
mkdir "build" do
34+
system "cmake", "..", *cmake_args
35+
system "make", "install"
36+
end
37+
end
38+
39+
test do
40+
require "system_command"
41+
extend SystemCommand::Mixin
42+
# test plugins in subfolders
43+
["ogre", "ogre2"].each do |engine|
44+
p = lib/"gz-rendering-10/engine-plugins/libgz-rendering-#{engine}.dylib"
45+
# Use gz-plugin --info command to check plugin linking
46+
cmd = Formula["gz-plugin4"].opt_libexec/"gz/plugin4/gz-plugin"
47+
args = ["--info", "--plugin"] << p
48+
# print command and check return code
49+
system cmd, *args
50+
# check that library was loaded properly
51+
_, stderr = system_command(cmd, args:)
52+
error_string = "Error while loading the library"
53+
assert stderr.exclude?(error_string), error_string
54+
end
55+
# build against API
56+
github_actions = ENV["HOMEBREW_GITHUB_ACTIONS"].present?
57+
(testpath/"test.cpp").write <<-EOS
58+
#include <gz/rendering/RenderEngine.hh>
59+
#include <gz/rendering/RenderingIface.hh>
60+
int main(int _argc, char** _argv)
61+
{
62+
gz::rendering::RenderEngine *engine =
63+
gz::rendering::engine("ogre");
64+
return engine == nullptr;
65+
}
66+
EOS
67+
(testpath/"CMakeLists.txt").write <<-EOS
68+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
69+
find_package(gz-rendering REQUIRED COMPONENTS ogre ogre2)
70+
add_executable(test_cmake test.cpp)
71+
target_link_libraries(test_cmake gz-rendering::gz-rendering)
72+
EOS
73+
# test building with pkg-config
74+
system "pkg-config", "gz-rendering"
75+
cflags = `pkg-config --cflags gz-rendering`.split
76+
ldflags = `pkg-config --libs gz-rendering`.split
77+
system ENV.cc, "test.cpp",
78+
*cflags,
79+
*ldflags,
80+
"-lc++",
81+
"-o", "test"
82+
system "./test" unless github_actions
83+
# test building with cmake
84+
mkdir "build" do
85+
system "cmake", ".."
86+
system "make"
87+
system "./test_cmake" unless github_actions
88+
end
89+
# check for Xcode frameworks in bottle
90+
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
91+
system cmd_not_grep_xcode
92+
end
93+
end

0 commit comments

Comments
 (0)