Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/ci/create_rotary_formulae.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/sh

for j in $(ls Aliases/gz-jetty-* | grep -v launch)
do
p=$(basename $j | sed -e 's@.*gz-jetty-@@')
# set `r` to rotary formula path, like Formula/gz-rotary-math.rb
r=Formula/$(basename $j | sed -e 's@gz-jetty-@gz-rotary-@' -e 's@[0-9]*@@').rb
# copy jetty formula to rotary and fix class name, dependencies, and head branch
brew cat $(basename $j) > ${r}
sed -e 's@class Gz\([A-Za-z]*\)[0-9]*@class GzRotary\1@' \
-e 's@class Sdformat[0-9]*@class GzRotarySdformat@' \
-e 's@\(depends_on "gz-\)\([a-z_-]*\)[0-9]*"@\1rotary-\2"@' \
-e 's@\(depends_on "sdformat\)[0-9]*"@depends_on "gz-rotary-sdformat"@' \
-e 's@gz-gui-10@gz-gui@' \
-e 's@gz-physics-9@gz-physics@' \
-e 's@gz-rendering-10@gz-rendering@' \
-e 's@gz-sim-10@gz-sim@' \
-e 's@gz/plugin4@gz/plugin@' \
-e 's@gz/sim10@gz/sim@' \
-e 's@gz/transport15@gz/transport@' \
-e 's@\(Formula\["gz-\)\([a-z_-]*\)[0-9]*"@\1rotary-\2"@' \
-e 's@^.*head\( .* branch: "\).*$@ head\1main"@' \
-i -- ${r}
# remove bottle block
brew bump-revision ${r} --remove-bottle-block --write-only
# remove unneeded lines
sed -e '/^ url /d' \
-e '/^ sha256 /d' \
-e '/^ revision /d' \
-e '/^ conflicts_with "gz-rotary-/d' \
-e '/^ depends_on "freeimage"/d' \
-e '/qt@5/d' \
-i -- ${r}
# add conflicts_with
sed -e '/^ def install/i \
conflicts_with "", because: "both install gz-"\

' -i -- ${r}
sed -e "s@conflicts_with \"\",.*@conflicts_with \"$(basename $j)\", because: \"both install gz-${p}\"@" \
-i -- ${r}
# add caveats
sed -e '/^ test do/i \
def caveats\
<<~EOS\
This is an unstable, development version of Gazebo built from source.\
EOS\
end\

' -i -- ${r}

# add matching conflicts_with to jetty if not already present
if ! grep 'conflicts_with "gz-rotary-' ${j} > /dev/null ; then
sed -e '/^ def install/i \
conflicts_with "", because: "both install gz-"\

' -i -- Aliases/$(readlink ${j})
sed -e "s@conflicts_with \"\".*@conflicts_with \"gz-rotary-${p}\", because: \"both install gz-${p}\"@" \
-i -- Aliases/$(readlink ${j})
fi

# create symlink for next numbered version to rotary formula
f=$(basename $(readlink $j) | sed -e 's@\.rb@@')
n=$(echo $f | sed -e 's@[^0-9]*@@')
next=$(python3 -c "print($n + 1)")
f_next=$(echo $f | sed -e "s@$n@$next@")
ln -s ../${r} Aliases/${f_next}
done

brew style --fix Formula/gz-rotary-*
1 change: 1 addition & 0 deletions Aliases/gz-fuel-tools12
1 change: 1 addition & 0 deletions Aliases/gz-gui11
1 change: 1 addition & 0 deletions Aliases/gz-msgs13
1 change: 1 addition & 0 deletions Aliases/gz-physics10
1 change: 1 addition & 0 deletions Aliases/gz-rendering11
1 change: 1 addition & 0 deletions Aliases/gz-sensors11
1 change: 1 addition & 0 deletions Aliases/gz-sim11
1 change: 1 addition & 0 deletions Aliases/gz-transport16
2 changes: 2 additions & 0 deletions Formula/gz-fuel-tools11.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class GzFuelTools11 < Formula
depends_on "spdlog"
depends_on "tinyxml2"

conflicts_with "gz-rotary-fuel-tools", because: "both install gz-fuel-tools"

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=Off"
Expand Down
2 changes: 2 additions & 0 deletions Formula/gz-gui10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class GzGui10 < Formula
depends_on "spdlog"
depends_on "tinyxml2"

conflicts_with "gz-rotary-gui", because: "both install gz-gui"

def install
rpaths = [
rpath,
Expand Down
2 changes: 2 additions & 0 deletions Formula/gz-msgs12.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def python_cmake_arg(python = Formula["python@3.13"])
"-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python"
end

conflicts_with "gz-rotary-msgs", because: "both install gz-msgs"

def install
rpaths = [
rpath,
Expand Down
2 changes: 2 additions & 0 deletions Formula/gz-physics9.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class GzPhysics9 < Formula
depends_on "tinyxml2"
depends_on "urdfdom"

conflicts_with "gz-rotary-physics", because: "both install gz-physics"

def install
rpaths = [
rpath,
Expand Down
2 changes: 2 additions & 0 deletions Formula/gz-rendering10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class GzRendering10 < Formula
depends_on "ogre2.3"
depends_on "spdlog"

conflicts_with "gz-rotary-rendering", because: "both install gz-rendering"

def install
rpaths = [
rpath,
Expand Down
77 changes: 77 additions & 0 deletions Formula/gz-rotary-fuel-tools.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
class GzRotaryFuelTools < Formula
desc "Tools for using Fuel API to download robot models"
homepage "https://gazebosim.org"
license "Apache-2.0"

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

depends_on "abseil"
depends_on "cmake"
depends_on "fmt"
depends_on "gz-rotary-cmake"
depends_on "gz-rotary-common"
depends_on "gz-rotary-math"
depends_on "gz-rotary-msgs"
depends_on "gz-rotary-utils"
depends_on "jsoncpp"
depends_on "libyaml"
depends_on "libzip"
depends_on "pkgconf"
depends_on "protobuf"
depends_on "spdlog"
depends_on "tinyxml2"

conflicts_with "gz-jetty-fuel-tools", because: "both install gz-fuel-tools"

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

def caveats
<<~EOS
This is an unstable, development version of Gazebo built from source.
EOS
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 3.22.1 FATAL_ERROR)
find_package(gz-fuel_tools QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-fuel_tools::gz-fuel_tools)
EOS
# test building with pkg-config
system "pkg-config", "gz-fuel_tools"
cflags = `pkg-config --cflags gz-fuel_tools`.split
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lgz-fuel_tools",
"-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
137 changes: 137 additions & 0 deletions Formula/gz-rotary-gui.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
class GzRotaryGui < Formula
desc "Common libraries for robotics applications. GUI Library"
homepage "https://github.com/gazebosim/gz-gui"
license "Apache-2.0"

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

depends_on "cmake" => [:build, :test]
depends_on "pkgconf" => [:build, :test]
depends_on "abseil"
depends_on "fmt"
depends_on "gz-rotary-cmake"
depends_on "gz-rotary-common"
depends_on "gz-rotary-math"
depends_on "gz-rotary-msgs"
depends_on "gz-rotary-plugin"
depends_on "gz-rotary-rendering"
depends_on "gz-rotary-transport"
depends_on "gz-rotary-utils"
depends_on "protobuf"
depends_on "qt5compat"
depends_on "qtbase"
depends_on "qtcharts"
depends_on "qtdeclarative"
depends_on "qtlocation"
depends_on "qtpositioning"
depends_on "qtsvg"
depends_on "spdlog"
depends_on "tinyxml2"

conflicts_with "gz-jetty-gui", because: "both install gz-gui"

def install
rpaths = [
rpath,
rpath(source: lib/"gz-gui/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

def caveats
<<~EOS
This is an unstable, development version of Gazebo built from source.
EOS
end

test do
require "system_command"
extend SystemCommand::Mixin

# test some plugins in subfolders
%w[CameraFps Publisher TopicViewer WorldStats].each do |plugin|
p = lib/"gz-gui/plugins/lib#{plugin}.dylib"
# Use gz-plugin --info command to check plugin linking
cmd = Formula["gz-rotary-plugin"].opt_libexec/"gz/plugin/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:)
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.22.1 FATAL_ERROR)
find_package(gz-gui QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-gui::gz-gui)
EOS
# system "pkg-config", "gz-gui", "--cflags"
# system "pkg-config", "gz-gui", "--libs"
# cflags = `pkg-config --cflags gz-gui`.split
# ldflags = `pkg-config --libs gz-gui`.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
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
Loading