Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtabmap 0.21.4 (new formula) #162576

Merged
merged 2 commits into from Mar 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 63 additions & 0 deletions Formula/r/rtabmap.rb
@@ -0,0 +1,63 @@
class Rtabmap < Formula
desc "Visual and LiDAR SLAM library and standalone application"
homepage "https://introlab.github.io/rtabmap"
url "https://github.com/introlab/rtabmap/archive/refs/tags/0.21.4.tar.gz"
sha256 "242f8da7c5d20f86a0399d6cfdd1a755e64e9117a9fa250ed591c12f38209157"
license "BSD-3-Clause"
head "https://github.com/introlab/rtabmap.git", branch: "master"

depends_on "cmake" => [:build, :test]
depends_on "g2o"
depends_on "librealsense"
depends_on "octomap"
depends_on "opencv"
depends_on "pcl"
depends_on "pdal"

def install
args = %W[
-DCMAKE_INSTALL_RPATH=#{rpath}
]
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
output = if OS.linux?
# Linux CI cannot start windowed applications due to Qt plugin failures
shell_output("#{bin}/rtabmap-console --version")
else
shell_output("#{bin}/rtabmap --version")
end
assert_match "RTAB-Map: #{version}", output

# Required to avoid missing Xcode headers
# https://github.com/Homebrew/homebrew-core/pull/162576/files#r1489824628
ENV.delete "CPATH" if OS.mac? && MacOS::CLT.installed?

rtabmap_dir = lib/"rtabmap-#{version.major_minor}"
(testpath/"CMakeLists.txt").write <<~EOS
cmake_minimum_required(VERSION 3.10)
project(test)
find_package(RTABMap REQUIRED COMPONENTS core)
add_executable(test test.cpp)
target_link_libraries(test rtabmap::core)
EOS
(testpath/"test.cpp").write <<~EOS
#include <rtabmap/core/Rtabmap.h>
#include <stdio.h>
int main()
{
rtabmap::Rtabmap rtabmap;
printf(RTABMAP_VERSION);
return 0;
}
EOS
args = std_cmake_args
args << "-DCMAKE_BUILD_RPATH=#{lib}" if OS.linux?
system "cmake", ".", *args, "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DRTABMap_DIR=#{rtabmap_dir}"
system "make"
assert_equal version.to_s, shell_output("./test").strip
end
end