-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gz-plugin3: new formula for ionic (#2453)
* 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
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |