Skip to content

Commit 95771ca

Browse files
authored
gz-msgs12: Bump gz-cmake and others in jetty (#3030)
Bumping gz-cmake and others except gz-tools. Signed-off-by: Steve Peters <[email protected]>
1 parent 12ed413 commit 95771ca

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

Aliases/gz-msgs12

-1
This file was deleted.

Formula/gz-msgs12.rb

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
class GzMsgs12 < Formula
2+
desc "Middleware protobuf messages for robotics"
3+
homepage "https://gazebosim.org"
4+
url "https://github.com/gazebosim/gz-msgs.git", branch: "main"
5+
version "11.999.999-0-20250430"
6+
license "Apache-2.0"
7+
8+
head "https://github.com/gazebosim/gz-msgs.git", branch: "gz-msgs12"
9+
10+
depends_on "[email protected]" => [:build, :test]
11+
depends_on "[email protected]" => [:build, :test]
12+
depends_on "abseil"
13+
depends_on "cmake"
14+
depends_on "gz-cmake5"
15+
depends_on "gz-math9"
16+
depends_on "gz-tools2"
17+
depends_on "gz-utils4"
18+
depends_on macos: :high_sierra # c++17
19+
depends_on "pkgconf"
20+
depends_on "protobuf"
21+
depends_on "tinyxml2"
22+
23+
def pythons
24+
deps.map(&:to_formula)
25+
.select { |f| f.name.match?(/^python@3\.\d+$/) }
26+
end
27+
28+
def python_cmake_arg(python = Formula["[email protected]"])
29+
"-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python"
30+
end
31+
32+
def install
33+
cmake_args = std_cmake_args
34+
cmake_args << "-DBUILD_TESTING=Off"
35+
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
36+
cmake_args << python_cmake_arg
37+
38+
mkdir "build" do
39+
system "cmake", "..", *cmake_args
40+
system "make", "install"
41+
end
42+
43+
# this installs python files for each message that can be used by multiple
44+
# versions of python, so symlink the files to versioned python folders
45+
pythons.each do |python|
46+
# remove @ from formula name
47+
python_name = python.name.tr("@", "")
48+
# symlink the python files directly instead of the parent folder to avoid
49+
# brew link errors if there is a pre-existing __pycache__ folder
50+
(lib/"#{python_name}/site-packages/gz/msgs").install_symlink Dir[lib/"python/gz/msgs/*"]
51+
end
52+
end
53+
54+
test do
55+
(testpath/"test.cpp").write <<-EOS
56+
#include <gz/msgs.hh>
57+
int main() {
58+
gz::msgs::UInt32;
59+
return 0;
60+
}
61+
EOS
62+
(testpath/"CMakeLists.txt").write <<-EOS
63+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
64+
find_package(gz-msgs QUIET REQUIRED)
65+
add_executable(test_cmake test.cpp)
66+
target_link_libraries(test_cmake gz-msgs::gz-msgs)
67+
EOS
68+
# test building with pkg-config
69+
system "pkg-config", "gz-msgs"
70+
cflags = `pkg-config --cflags gz-msgs`.split
71+
system ENV.cc, "test.cpp",
72+
*cflags,
73+
"-L#{lib}",
74+
"-lgz-msgs",
75+
"-lc++",
76+
"-o", "test"
77+
system "./test"
78+
# test building with cmake
79+
mkdir "build" do
80+
system "cmake", ".."
81+
system "make"
82+
system "./test_cmake"
83+
end
84+
# check for Xcode frameworks in bottle
85+
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
86+
system cmd_not_grep_xcode
87+
# check python import
88+
pythons.each do |python|
89+
system python.opt_libexec/"bin/python", "-c", "import gz.msgs"
90+
end
91+
end
92+
end

0 commit comments

Comments
 (0)