Skip to content

Commit

Permalink
Merge branch 'master' into ci_matching_branch/bump_ionic_gz-ionic
Browse files Browse the repository at this point in the history
  • Loading branch information
azeey authored Oct 25, 2023
2 parents 3f77d29 + 96a3723 commit e58a730
Show file tree
Hide file tree
Showing 23 changed files with 1,221 additions and 21 deletions.
1 change: 0 additions & 1 deletion Aliases/gz-cmake4

This file was deleted.

1 change: 0 additions & 1 deletion Aliases/gz-common6

This file was deleted.

1 change: 1 addition & 0 deletions Aliases/gz-ionic
1 change: 0 additions & 1 deletion Aliases/gz-math8

This file was deleted.

1 change: 0 additions & 1 deletion Aliases/gz-msgs11

This file was deleted.

1 change: 0 additions & 1 deletion Aliases/gz-plugin3

This file was deleted.

1 change: 0 additions & 1 deletion Aliases/gz-utils3

This file was deleted.

23 changes: 8 additions & 15 deletions Formula/gazebo11.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
class Gazebo11 < Formula
desc "Gazebo robot simulator"
homepage "https://gazebosim.org"
url "https://osrf-distributions.s3.amazonaws.com/gazebo/releases/gazebo-11.13.0.tar.bz2"
sha256 "2f65b98fe652a574e01b7cae6cf12e14a9dd29343fde99e066ac5193a8d03e71"
url "https://osrf-distributions.s3.amazonaws.com/gazebo/releases/gazebo-11.14.0.tar.bz2"
sha256 "7e9842c046c9e0755355b274c240a8abbf4e962be7ce7b7f59194e5f4b584f45"
license "Apache-2.0"
revision 11

head "https://github.com/osrf/gazebo.git", branch: "gazebo11"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "3a267f123ae273a9fbf49041bd50063001b9934ca55dd5862752fc70cb1ff625"
sha256 monterey: "e312b30bdfba329583462c1806623ee3d9a2b76b1ff477fb8651c456713dd0a7"
end

depends_on "cmake" => :build
depends_on "pkg-config" => :build

Expand Down Expand Up @@ -43,18 +48,6 @@ class Gazebo11 < Formula
conflicts_with "gazebo9", because: "differing version of the same formula"
conflicts_with "gz-tools2", because: "both install bin/gz"

patch do
# Fix for compatibility with graphviz 9.0
url "https://github.com/gazebosim/gazebo-classic/commit/ba2cbd532a8ba47972cf9f0c3dbc32a5757cab2a.patch?full_index=1"
sha256 "a9cca7d59663fd45bab74e044c817600d24028e80ad2871107a34e8a3bebab2a"
end

patch do
# Fix for compatibility with protobuf 23.2
url "https://github.com/gazebosim/gazebo-classic/commit/17e09f574a4f39caff279cd70364cd1a3ea46f70.patch?full_index=1"
sha256 "b50f4cbfe92d3ded2dd7117696cf6a049f0bbdcdb9ef8f54bbc6bde7670f51b3"
end

patch do
# Fix build when homebrew python is installed
# keep this patch
Expand Down
44 changes: 44 additions & 0 deletions Formula/gz-cmake4.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class GzCmake4 < Formula
desc "CMake helper functions for building robotic applications"
homepage "https://gazebosim.org"
url "https://github.com/gazebosim/gz-cmake.git", branch: "main"
version "3.999.999-0-20231006"
license "Apache-2.0"

head "https://github.com/gazebosim/gz-cmake.git", branch: "gz-cmake4"

depends_on "cmake"
depends_on "pkg-config"

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"

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

test do
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
project(gz-test VERSION 0.1.0)
find_package(gz-cmake4 REQUIRED)
gz_configure_project()
gz_configure_build(QUIT_IF_BUILD_ERRORS)
EOS
%w[doc include src test].each do |dir|
mkdir dir do
touch "CMakeLists.txt"
end
end
mkdir "build" do
system "cmake", ".."
end
# check for Xcode frameworks in bottle
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
system cmd_not_grep_xcode
end
end
76 changes: 76 additions & 0 deletions Formula/gz-common6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
class GzCommon6 < Formula
desc "Common libraries for robotics applications"
homepage "https://gazebosim.org"
url "https://github.com/gazebosim/gz-common.git", branch: "main"
version "5.999.999-0-20231009"
license "Apache-2.0"

head "https://github.com/gazebosim/gz-common.git", branch: "gz-common6"

depends_on "assimp"
depends_on "cmake"
depends_on "ffmpeg"
depends_on "freeimage"
depends_on "gdal"
depends_on "gts"
depends_on "gz-cmake4"
depends_on "gz-math8"
depends_on "gz-utils3"
depends_on macos: :high_sierra # c++17
depends_on "ossp-uuid"
depends_on "pkg-config"
depends_on "tinyxml2"

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 <iostream>
#include <gz/common.hh>
int main() {
gzdbg << "debug" << std::endl;
gzwarn << "warn" << std::endl;
gzerr << "error" << std::endl;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(gz-common6 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-common6::gz-common6)
EOS
system "pkg-config", "gz-common6"
cflags = `pkg-config --cflags gz-common6`.split
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lgz-common6",
"-lc++",
"-o", "test"
system "./test"
# test building with cmake
mkdir "build" do
ENV.append "LIBRARY_PATH", Formula["gettext"].opt_lib
system "cmake", ".."
system "make"
system "./test_cmake"
end
# check for Xcode frameworks in bottle
# ! requires system with single argument, which uses standard shell
# put in variable to avoid audit complaint
# enclose / in [] so the following line won't match itself
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
system cmd_not_grep_xcode
end
end
66 changes: 66 additions & 0 deletions Formula/gz-fuel-tools10.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
class GzFuelTools10 < Formula
desc "Tools for using Fuel API to download robot models"
homepage "https://gazebosim.org"
url "https://github.com/gazebosim/gz-fuel-tools.git", branch: "main"
version "9.999.999-0-20231011"
license "Apache-2.0"

head "https://github.com/gazebosim/gz-fuel-tools.git", branch: "gz-fuel-tools10"

depends_on "cmake"
depends_on "gz-cmake4"
depends_on "gz-common6"
depends_on "gz-msgs11"
depends_on "jsoncpp"
depends_on "libyaml"
depends_on "libzip"
depends_on macos: :high_sierra # c++17
depends_on "pkg-config"
depends_on "protobuf"

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
end

test do
(testpath/"test.cpp").write <<-EOS
#include <gz/fuel_tools.hh>
int main() {
gz::fuel_tools::ServerConfig srv;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_package(gz-fuel_tools10 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-fuel_tools10::gz-fuel_tools10)
EOS
# test building with pkg-config
system "pkg-config", "gz-fuel_tools10"
cflags = `pkg-config --cflags gz-fuel_tools10`.split
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lgz-fuel_tools10",
"-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
119 changes: 119 additions & 0 deletions Formula/gz-gui9.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
class GzGui9 < Formula
desc "Common libraries for robotics applications. GUI Library"
homepage "https://github.com/gazebosim/gz-gui"
url "https://github.com/gazebosim/gz-gui.git", branch: "main"
version "8.999.999-0-20231016"
license "Apache-2.0"

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

depends_on "cmake" => [:build, :test]
depends_on "pkg-config" => [:build, :test]
depends_on "gz-cmake4"
depends_on "gz-common6"
depends_on "gz-msgs11"
depends_on "gz-plugin3"
depends_on "gz-rendering9"
depends_on "gz-transport14"
depends_on macos: :mojave # c++17
depends_on "protobuf"
depends_on "qt@5"
depends_on "tinyxml2"

def install
rpaths = [
rpath,
rpath(source: lib/"gz-gui-8/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 some plugins in subfolders
%w[CameraFps Publisher TopicViewer WorldStats].each do |plugin|
p = lib/"gz-gui-8/plugins/lib#{plugin}.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
(testpath/"test.cpp").write <<-EOS
#include <iostream>
#ifndef Q_MOC_RUN
#include <gz/gui/qt.h>
#include <gz/gui/Application.hh>
#include <gz/gui/MainWindow.hh>
#endif
//////////////////////////////////////////////////
int main(int _argc, char **_argv)
{
std::cout << "Hello, GUI!" << std::endl;
// Increase verboosity so we see all messages
gz::common::Console::SetVerbosity(4);
// Create app
gz::gui::Application app(_argc, _argv);
// Load plugins / config
if (!app.LoadPlugin("Publisher"))
{
return 1;
}
// Customize main window
auto win = app.findChild<gz::gui::MainWindow *>()->QuickWindow();
win->setProperty("title", "Hello Window!");
// Run window
// app.exec();
std::cout << "After run" << std::endl;
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(gz-gui9 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-gui9::gz-gui9)
EOS
ENV.append_path "PKG_CONFIG_PATH", Formula["qt@5"].opt_lib/"pkgconfig"
system "pkg-config", "gz-gui9"
cflags = `pkg-config --cflags gz-gui9`.split
ldflags = `pkg-config --libs gz-gui9`.split
system ENV.cc, "test.cpp",
*cflags,
*ldflags,
"-lc++",
"-o", "test"
ENV["GZ_PARTITION"] = rand((1 << 32) - 1).to_s
system "./test"
# test building with cmake
ENV.append_path "CMAKE_PREFIX_PATH", Formula["qt@5"].opt_prefix
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
Loading

0 comments on commit e58a730

Please sign in to comment.