From 9dbd51e6eff35552edaa06d1703610217ed2562f Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Fri, 13 Oct 2023 22:30:47 +0000 Subject: [PATCH] Bumps in ionic : ci_matching_branch/bump_ionic_gz-msgs11 Signed-off-by: Ian Chen --- Aliases/gz-msgs11 | 1 - Formula/gz-msgs11.rb | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) delete mode 120000 Aliases/gz-msgs11 create mode 100644 Formula/gz-msgs11.rb diff --git a/Aliases/gz-msgs11 b/Aliases/gz-msgs11 deleted file mode 120000 index 6f5b01b03..000000000 --- a/Aliases/gz-msgs11 +++ /dev/null @@ -1 +0,0 @@ -../Formula/gz-msgs10.rb \ No newline at end of file diff --git a/Formula/gz-msgs11.rb b/Formula/gz-msgs11.rb new file mode 100644 index 000000000..a78b96695 --- /dev/null +++ b/Formula/gz-msgs11.rb @@ -0,0 +1,70 @@ +class GzMsgs11 < Formula + desc "Middleware protobuf messages for robotics" + homepage "https://gazebosim.org" + url "https://github.com/gazebosim/gz-msgs.git", branch: "main" + version "10.999.999-0-20231013" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-msgs.git", branch: "main" + + depends_on "cmake" + depends_on "gz-cmake4" + depends_on "gz-math8" + depends_on "gz-tools2" + depends_on macos: :high_sierra # c++17 + depends_on "pkg-config" + depends_on "protobuf" + depends_on "python@3.11" + depends_on "tinyxml2" + + def install + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=Off" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}" + + mkdir "build" do + system "cmake", "..", *cmake_args + system "make", "install" + end + + (lib/"python3.11/site-packages").install Dir[lib/"python/*"] + rmdir prefix/"lib/python" + end + + test do + (testpath/"test.cpp").write <<-EOS + #include + int main() { + gz::msgs::UInt32; + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.10 FATAL_ERROR) + find_package(gz-msgs11 QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-msgs11::gz-msgs11) + EOS + # test building with pkg-config + system "pkg-config", "gz-msgs11" + cflags = `pkg-config --cflags gz-msgs11`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lgz-msgs11", + "-lc++", + "-o", "test" + system "./test" + # test building with cmake + mkdir "build" do + system "cmake", ".." + system "make" + system "./test_cmake" + end + # check for Xcode frameworks in bottle + cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}" + system cmd_not_grep_xcode + # check python import + system Formula["python@3.11"].opt_bin/"python3.11", "-c", "import gz.msgs11" + end +end