Skip to content

Commit

Permalink
Bumps in ionic : ci_matching_branch/bump_ionic_gz-rendering9 (#2467)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
iche033 and azeey authored Oct 17, 2023
1 parent 54e7f8e commit 4261c54
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/gz-rendering9

This file was deleted.

90 changes: 90 additions & 0 deletions Formula/gz-rendering9.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
class GzRendering9 < Formula
desc "Rendering library for robotics applications"
homepage "https://gazebosim.org"
url "https://github.com/gazebosim/gz-rendering.git", branch: "main"
version "8.999.999-0-20231016"
license "Apache-2.0"

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

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

depends_on "freeimage"
depends_on "gz-cmake4"
depends_on "gz-common6"
depends_on "gz-math8"
depends_on "gz-plugin3"
depends_on "gz-utils3"
depends_on macos: :mojave # c++17
depends_on "ogre1.9"
depends_on "ogre2.3"

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

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

test do
# test plugins in subfolders
["ogre", "ogre2"].each do |engine|
p = lib/"gz-rendering-9/engine-plugins/libgz-rendering-#{engine}.dylib"
# Use gz-plugin --info command to check plugin linking
cmd = Formula["gz-plugin3"].opt_libexec/"gz/plugin3/gz-plugin"
args = ["--info", "--plugin"] << p
# print command and check return code
system cmd, *args
# check that library was loaded properly
_, stderr = system_command(cmd, args: args)
error_string = "Error while loading the library"
assert stderr.exclude?(error_string), error_string
end
# build against API
github_actions = ENV["HOMEBREW_GITHUB_ACTIONS"].present?
(testpath/"test.cpp").write <<-EOS
#include <gz/rendering/RenderEngine.hh>
#include <gz/rendering/RenderingIface.hh>
int main(int _argc, char** _argv)
{
gz::rendering::RenderEngine *engine =
gz::rendering::engine("ogre");
return engine == nullptr;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
find_package(gz-rendering9 REQUIRED COMPONENTS ogre ogre2)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-rendering9::gz-rendering9)
EOS
# test building with pkg-config
system "pkg-config", "gz-rendering9"
cflags = `pkg-config --cflags gz-rendering9`.split
ldflags = `pkg-config --libs gz-rendering9`.split
system ENV.cc, "test.cpp",
*cflags,
*ldflags,
"-lc++",
"-o", "test"
system "./test" unless github_actions
# test building with cmake
mkdir "build" do
system "cmake", ".."
system "make"
system "./test_cmake" unless github_actions
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 4261c54

Please sign in to comment.