diff --git a/Aliases/ignition-sensors6 b/Aliases/ignition-sensors6 deleted file mode 120000 index 8965897b5..000000000 --- a/Aliases/ignition-sensors6 +++ /dev/null @@ -1 +0,0 @@ -../Formula/ignition-sensors5.rb \ No newline at end of file diff --git a/Formula/ignition-sensors6.rb b/Formula/ignition-sensors6.rb new file mode 100644 index 000000000..6f1e4f6bb --- /dev/null +++ b/Formula/ignition-sensors6.rb @@ -0,0 +1,73 @@ +class IgnitionSensors6 < Formula + desc "Sensors library for robotics applications" + homepage "https://github.com/ignitionrobotics/ign-sensors" + url "https://github.com/ignitionrobotics/ign-sensors/archive/61f612cdccaeb7e71db05a7b969aec3509a6fd89.tar.gz" + version "5.999.999~0~20210413~61f612" + sha256 "d7a26ca97b617b43ff470e2f2c8134219d1557cf4bc7f3d9bdaacfea66a4b8f4" + license "Apache-2.0" + + head "https://github.com/ignitionrobotics/ign-sensors.git", branch: "main" + + bottle do + root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation" + sha256 catalina: "09130ac8d35ed918dffd0358115e06fb7d60c2f83595fe4089dea27906283036" + sha256 mojave: "cce4847a8ec2cb8332ac26a6555bcef263f22b5a07c6eb2e36199990bf705d8b" + end + + depends_on "cmake" => [:build, :test] + depends_on "pkg-config" => [:build, :test] + + depends_on "ignition-cmake2" + depends_on "ignition-common4" + depends_on "ignition-math6" + depends_on "ignition-msgs8" + depends_on "ignition-rendering6" + depends_on "ignition-transport11" + depends_on "sdformat12" + + def install + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=OFF" + + system "cmake", ".", *cmake_args + system "make", "install" + end + + test do + (testpath/"test.cpp").write <<-EOS + #include + + int main() + { + ignition::sensors::Noise noise(ignition::sensors::NoiseType::NONE); + + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) + find_package(ignition-sensors6 QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake ignition-sensors6::ignition-sensors6) + EOS + # test building with pkg-config + system "pkg-config", "ignition-sensors6" + cflags = `pkg-config --cflags ignition-sensors6`.split + ldflags = `pkg-config --libs ignition-sensors6`.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