class Pcl < Formula desc "Library for 2D/3D image and point cloud processing" homepage "https://pointclouds.org/" url "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.11.1.tar.gz" sha256 "a61558e53abafbc909e0996f91cfd2d7a400fcadf6b8cfb0ea3172b78422c74e" license "BSD-3-Clause" head "https://github.com/PointCloudLibrary/pcl.git" bottle do sha256 "b094f39a7ba771e08686baefa441950ef4100cd331c58bb1cf00072dcf23259a" => :catalina sha256 "f26540692412438bf6ee08684dea520af51507ecbe107174ed6dde9b7baa9e9a" => :mojave sha256 "7371af2fb929023b0b80d24404ca53ab1b108f72bf74ef6b472e45e0e438742f" => :high_sierra end depends_on "cmake" => [:build, :test] depends_on "pkg-config" => :build depends_on "boost" depends_on "cminpack" depends_on "eigen" depends_on "flann" depends_on "glew" depends_on "libomp" depends_on "libpcap" depends_on "libusb" depends_on "qhull" depends_on "vtk" def install args = std_cmake_args + %w[ -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_apps=AUTO_OFF -DBUILD_apps_3d_rec_framework=AUTO_OFF -DBUILD_apps_cloud_composer=AUTO_OFF -DBUILD_apps_in_hand_scanner=AUTO_OFF -DBUILD_apps_point_cloud_editor=AUTO_OFF -DBUILD_examples:BOOL=OFF -DBUILD_global_tests:BOOL=OFF -DBUILD_outofcore:BOOL=AUTO_OFF -DBUILD_people:BOOL=AUTO_OFF -DBUILD_simulation:BOOL=ON -DWITH_CUDA:BOOL=OFF -DWITH_DOCS:BOOL=OFF -DWITH_QT:BOOL=FALSE -DWITH_TUTORIALS:BOOL=OFF ] args << if build.head? "-DBUILD_apps_modeler=AUTO_OFF" else "-DBUILD_apps_modeler:BOOL=OFF" end mkdir "build" do system "cmake", "..", *args system "make", "install" prefix.install Dir["#{bin}/*.app"] end end test do assert_match "tiff files", shell_output("#{bin}/pcl_tiff2pcd -h", 255) # inspired by https://pointclouds.org/documentation/tutorials/writing_pcd.html (testpath/"CMakeLists.txt").write <<~EOS cmake_minimum_required(VERSION 2.8 FATAL_ERROR) project(pcd_write) find_package(PCL 1.2 REQUIRED) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) add_executable (pcd_write pcd_write.cpp) target_link_libraries (pcd_write ${PCL_LIBRARIES}) EOS (testpath/"pcd_write.cpp").write <<~EOS #include #include #include int main (int argc, char** argv) { pcl::PointCloud cloud; // Fill in the cloud data cloud.width = 2; cloud.height = 1; cloud.is_dense = false; cloud.points.resize (cloud.width * cloud.height); int i = 1; for (auto& point: cloud) { point.x = i++; point.y = i++; point.z = i++; } pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud); return (0); } EOS mkdir "build" do system "cmake", "..", *std_cmake_args system "make" system "./pcd_write" assert_predicate (testpath/"build/test_pcd.pcd"), :exist? output = File.read("test_pcd.pcd") assert_match "POINTS 2", output assert_match "1 2 3", output assert_match "4 5 6", output end end end