Skip to content

Commit

Permalink
gz-plugin3: new formula for ionic (#2453)
Browse files Browse the repository at this point in the history
* Bumps in ionic : ci_matching_branch/bump_ionic_gz-plugin3

* Use - in version string

* Use gz-tools2, fix `head`

---------

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Co-authored-by: Steve Peters <scpeters@openrobotics.org>
  • Loading branch information
azeey and scpeters authored Oct 13, 2023
1 parent 76e0920 commit 16d4e41
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/gz-plugin3

This file was deleted.

69 changes: 69 additions & 0 deletions Formula/gz-plugin3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
class GzPlugin3 < Formula
desc "Plugin libraries for robotics applications"
homepage "https://github.com/gazebosim/gz-plugin"
url "https://github.com/gazebosim/gz-plugin.git", branch: "main"
version "2.999.999-0-20231006"
license "Apache-2.0"

head "https://github.com/gazebosim/gz-plugin.git", branch: "main"

depends_on "cmake"
depends_on "gz-cmake4"
depends_on "gz-tools2"
depends_on "gz-utils3"
depends_on macos: :high_sierra # c++17
depends_on "pkg-config"

def install
rpaths = [
rpath,
rpath(source: libexec/"gz/plugin3", target: lib),
]
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"

# Use build folder
mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end
end

test do
# test CLI executable
system libexec/"gz/plugin3/gz-plugin"
# build against API
(testpath/"test.cpp").write <<-EOS
#include <gz/plugin/Loader.hh>
int main() {
gz::plugin::Loader loader;
return loader.InterfacesImplemented().size();
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(gz-plugin3 QUIET REQUIRED COMPONENTS loader)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-plugin3::loader)
EOS
system "pkg-config", "gz-plugin3-loader"
cflags = `pkg-config --cflags gz-plugin3-loader`.split
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lgz-plugin3-loader",
"-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
end
end

0 comments on commit 16d4e41

Please sign in to comment.