127 lines
5.3 KiB
Ruby
127 lines
5.3 KiB
Ruby
class Visp < Formula
|
|
desc "Visual Servoing Platform library"
|
|
homepage "https://visp.inria.fr/"
|
|
url "https://visp-doc.inria.fr/download/releases/visp-3.5.0.tar.gz"
|
|
sha256 "494a648b2570da2a200ba326ed61a14e785eb9ee08ef12d3ad178b2f384d3d30"
|
|
license "GPL-2.0-or-later"
|
|
revision 6
|
|
|
|
livecheck do
|
|
url "https://visp.inria.fr/download/"
|
|
regex(/href=.*?visp[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_ventura: "cbd4e717a901913df5c02d5de205748ebb2c5b3bf265b95d8ecacdac7ceeec5a"
|
|
sha256 cellar: :any, arm64_monterey: "58ed1d0ba9f1db30233a23a5ad377627aa765fd8d56f44728641db0bff991d79"
|
|
sha256 cellar: :any, arm64_big_sur: "ef9b294eb02454477f86b40b16c7a5329bf2d60a25c83937654517180445f735"
|
|
sha256 cellar: :any, ventura: "7690f3d4768dc23862aa14184213ff1e938964ef50794a9dd5b0131ecfc0eec5"
|
|
sha256 cellar: :any, monterey: "d13bab24bf8f504d7689b4587f8d1436a2a8c8a2b3cc3aa29b378e53dd909888"
|
|
sha256 cellar: :any, big_sur: "653cdbfc3c0c3f8479f3f0e81c146050ee8aae587f6d1a1962d6f0295684e103"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "1b0a0665f3e241c23a68a993fb66dcadba29c954df50f8f50d2e4b1773866121"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "eigen"
|
|
depends_on "gsl"
|
|
depends_on "jpeg-turbo"
|
|
depends_on "libdc1394"
|
|
depends_on "libpng"
|
|
depends_on "opencv"
|
|
depends_on "pcl"
|
|
depends_on "zbar"
|
|
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "libnsl"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
# Avoid superenv shim references
|
|
inreplace "CMakeLists.txt" do |s|
|
|
s.sub!(/CMake build tool:"\s+\${CMAKE_BUILD_TOOL}/,
|
|
"CMake build tool: gmake\"")
|
|
s.sub!(/C\+\+ Compiler:"\s+\${VISP_COMPILER_STR}/,
|
|
"C++ Compiler: #{ENV.cxx}\"")
|
|
s.sub!(/C Compiler:"\s+\${CMAKE_C_COMPILER}/,
|
|
"C Compiler: #{ENV.cc}\"")
|
|
end
|
|
|
|
system "cmake", ".", "-DBUILD_DEMOS=OFF",
|
|
"-DBUILD_EXAMPLES=OFF",
|
|
"-DBUILD_TESTS=OFF",
|
|
"-DBUILD_TUTORIALS=OFF",
|
|
"-DUSE_DC1394=ON",
|
|
"-DDC1394_INCLUDE_DIR=#{Formula["libdc1394"].opt_include}",
|
|
"-DDC1394_LIBRARY=#{Formula["libdc1394"].opt_lib/shared_library("libdc1394")}",
|
|
"-DUSE_EIGEN3=ON",
|
|
"-DEigen3_DIR=#{Formula["eigen"].opt_share}/eigen3/cmake",
|
|
"-DUSE_GSL=ON",
|
|
"-DGSL_INCLUDE_DIR=#{Formula["gsl"].opt_include}",
|
|
"-DGSL_cblas_LIBRARY=#{Formula["gsl"].opt_lib/shared_library("libgslcblas")}",
|
|
"-DGSL_gsl_LIBRARY=#{Formula["gsl"].opt_lib/shared_library("libgsl")}",
|
|
"-DUSE_JPEG=ON",
|
|
"-DJPEG_INCLUDE_DIR=#{Formula["jpeg-turbo"].opt_include}",
|
|
"-DJPEG_LIBRARY=#{Formula["jpeg-turbo"].opt_lib/shared_library("libjpeg")}",
|
|
"-DUSE_LAPACK=ON",
|
|
"-DUSE_LIBUSB_1=OFF",
|
|
"-DUSE_OPENCV=ON",
|
|
"-DOpenCV_DIR=#{Formula["opencv"].opt_share}/OpenCV",
|
|
"-DUSE_PCL=ON",
|
|
"-DUSE_PNG=ON",
|
|
"-DPNG_PNG_INCLUDE_DIR=#{Formula["libpng"].opt_include}",
|
|
"-DPNG_LIBRARY_RELEASE=#{Formula["libpng"].opt_lib/shared_library("libpng")}",
|
|
"-DUSE_PTHREAD=ON",
|
|
"-DUSE_PYLON=OFF",
|
|
"-DUSE_REALSENSE=OFF",
|
|
"-DUSE_REALSENSE2=OFF",
|
|
"-DUSE_X11=OFF",
|
|
"-DUSE_XML2=ON",
|
|
"-DUSE_ZBAR=ON",
|
|
"-DZBAR_INCLUDE_DIRS=#{Formula["zbar"].opt_include}",
|
|
"-DZBAR_LIBRARIES=#{Formula["zbar"].opt_lib/shared_library("libzbar")}",
|
|
"-DUSE_ZLIB=ON",
|
|
*std_cmake_args
|
|
|
|
# Replace generated references to OpenCV's Cellar path
|
|
opencv = Formula["opencv"]
|
|
opencv_references = Dir[
|
|
"CMakeCache.txt",
|
|
"CMakeFiles/Export/lib/cmake/visp/VISPModules.cmake",
|
|
"VISPConfig.cmake",
|
|
"VISPGenerateConfigScript.info.cmake",
|
|
"VISPModules.cmake",
|
|
"modules/**/flags.make",
|
|
"unix-install/VISPConfig.cmake",
|
|
]
|
|
inreplace opencv_references, opencv.prefix.realpath, opencv.opt_prefix
|
|
system "cmake", "--build", "."
|
|
system "cmake", "--install", "."
|
|
|
|
# Make sure software built against visp don't reference opencv's cellar path either
|
|
inreplace lib/"pkgconfig/visp.pc", opencv.prefix.realpath, opencv.opt_prefix
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include <visp3/core/vpConfig.h>
|
|
#include <iostream>
|
|
int main()
|
|
{
|
|
std::cout << VISP_VERSION_MAJOR << "." << VISP_VERSION_MINOR <<
|
|
"." << VISP_VERSION_PATCH << std::endl;
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "test.cpp", "-I#{include}", "-L#{lib}", "-o", "test"
|
|
assert_equal version.to_s, shell_output("./test").chomp
|
|
end
|
|
end
|