Skip to content

Commit

Permalink
add gz-sensors8 (#2125)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Co-authored-by: Steve Peters <scpeters@openrobotics.org>
  • Loading branch information
iche033 and scpeters authored Nov 15, 2022
1 parent ac1b984 commit 79059c6
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/gz-sensors8

This file was deleted.

69 changes: 69 additions & 0 deletions Formula/gz-sensors8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
class GzSensors8 < Formula
desc "Sensors library for robotics applications"
homepage "https://github.com/gazebosim/gz-sensors"
url "https://github.com/gazebosim/gz-sensors.git"
version "7.999.999~0~20221114"
license "Apache-2.0"

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

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

depends_on "gz-cmake3"
depends_on "gz-common5"
depends_on "gz-math7"
depends_on "gz-msgs9"
depends_on "gz-rendering8"
depends_on "gz-transport12"
depends_on "sdformat13"

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/sensors/Noise.hh>
int main()
{
gz::sensors::Noise noise(gz::sensors::NoiseType::NONE);
return 0;
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
find_package(gz-sensors8 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-sensors8::gz-sensors8)
EOS
# test building with pkg-config
system "pkg-config", "gz-sensors8"
cflags = `pkg-config --cflags gz-sensors8`.split
ldflags = `pkg-config --libs gz-sensors8`.split
system ENV.cc, "test.cpp",
*cflags,
*ldflags,
"-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

0 comments on commit 79059c6

Please sign in to comment.