Skip to content

Commit

Permalink
gz-utils3: new formula for ionic (#2454)
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
  • Loading branch information
azeey and scpeters authored Oct 12, 2023
1 parent 2099bd8 commit ff24f85
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/gz-utils3

This file was deleted.

64 changes: 64 additions & 0 deletions Formula/gz-utils3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
class GzUtils3 < Formula
desc "General purpose classes and functions designed for robotic applications"
homepage "https://github.com/gazebosim/gz-utils"
url "https://github.com/gazebosim/gz-utils.git", branch: "main"
version "2.999.999-0-20231011"
license "Apache-2.0"

depends_on "cmake" => [:build, :test]
depends_on "pkg-config" => [:build, :test]
depends_on "gz-cmake4"

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"

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

test do
(testpath/"test.cpp").write <<-EOS
#include <gz/utils/ImplPtr.hh>
class SomeClassPrivate
{
};
class SomeClass
{
private: gz::utils::ImplPtr<SomeClassPrivate> dataPtr =
gz::utils::MakeImpl<SomeClassPrivate>();
};
int main() {
SomeClass object;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(gz-utils3 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-utils3::gz-utils3)
EOS
system "pkg-config", "gz-utils3"
cflags = `pkg-config --cflags gz-utils3`.split
ldflags = `pkg-config --libs gz-utils3`.split
system ENV.cxx, "test.cpp",
*cflags,
*ldflags,
"-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 ff24f85

Please sign in to comment.