Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
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.3-noetic.tar.gz" | ||
sha256 "d7fc662d19a6ff772c81cc96365862afdb9bac7f41aeb4d6c543ed3a2477fb01" | ||
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 | ||
Check failure on line 26 in Formula/r/rtabmap.rb GitHub Actions / Linux`brew test --verbose rtabmap` failed on Linux!
|
||
# Test if main app is built and can be launched | ||
output = if OS.linux? | ||
# CI linux cannot start windows apps, causing qt plugins failing | ||
shell_output("#{bin}/rtabmap-console --version") | ||
else | ||
shell_output("#{bin}/rtabmap --version") | ||
end | ||
assert_match "RTAB-Map: #{version}", output | ||
|
||
# Test c++ library | ||
ENV.delete "CPATH" # error xcode headers missing | ||
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 | ||
system "cmake", ".", "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DRTABMap_DIR=#{rtabmap_dir}" | ||
system "make" | ||
assert_equal version.to_s, shell_output("./test").strip | ||
end | ||
end |