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
1 change: 1 addition & 0 deletions Aliases/gz-cmake6
1 change: 1 addition & 0 deletions Aliases/gz-utils5
2 changes: 2 additions & 0 deletions Formula/gz-cmake5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class GzCmake5 < Formula
depends_on "cmake"
depends_on "pkgconf"

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

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
Expand Down
50 changes: 50 additions & 0 deletions Formula/gz-rotary-cmake.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class GzRotaryCmake < Formula
desc "CMake helper functions for building robotic applications"
homepage "https://gazebosim.org"
license "Apache-2.0"

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

depends_on "cmake"
depends_on "pkgconf"

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

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

# Use a build folder
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/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-test VERSION 0.1.0)
find_package(gz-cmake 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
75 changes: 75 additions & 0 deletions Formula/gz-rotary-utils.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
class GzRotaryUtils < Formula
desc "General purpose classes and functions designed for robotic applications"
homepage "https://github.com/gazebosim/gz-utils"
license "Apache-2.0"

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

depends_on "cmake" => [:build, :test]
depends_on "pkgconf" => [:build, :test]
depends_on "cli11"
depends_on "fmt"
depends_on "gz-rotary-cmake"
depends_on "spdlog"

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

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

# Use a build folder
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/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.22.1 FATAL_ERROR)
find_package(gz-utils QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-utils::gz-utils)
EOS
system "pkg-config", "gz-utils"
cflags = `pkg-config --cflags gz-utils`.split
ldflags = `pkg-config --libs gz-utils`.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
2 changes: 2 additions & 0 deletions Formula/gz-utils4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class GzUtils4 < Formula
depends_on "gz-cmake5"
depends_on "spdlog"

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

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