homebrew-core/Formula/visp.rb
2018-08-27 07:59:21 +02:00

86 lines
3.8 KiB
Ruby

class Visp < Formula
desc "Visual Servoing Platform library"
homepage "https://visp.inria.fr/"
url "https://gforge.inria.fr/frs/download.php/latestfile/475/visp-3.1.0.tar.gz"
sha256 "2a1df8195b06f9a057bd4c7d987697be2fdcc9d169e8d550fcf68e5d7f129d96"
revision 1
bottle do
sha256 "86af46cedc6f6240d1e4f58f89909433936639989d3d6b35799524ddb654ff7b" => :mojave
sha256 "2d916fcddfe30085b591e9a0e343bc2d14de281eb907c20279c054d64bf30305" => :high_sierra
sha256 "8e3ef1fde35fccc12e4c3bfb2e8615ce0150bd19c2c5bc4251a991d125392e6b" => :sierra
sha256 "c3476bb04f41c009a86afaa24c5f7943627b5696d8613b323afaaf7894b9e257" => :el_capitan
end
depends_on "cmake" => :build
depends_on "eigen"
depends_on "gsl"
depends_on "jpeg"
depends_on "libdc1394"
depends_on "libpng"
depends_on "opencv"
depends_on "zbar"
def install
sdk = MacOS::CLT.installed? ? "" : MacOS.sdk_path
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}/libdc1394.dylib",
"-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}/libgslcblas.dylib",
"-DGSL_gsl_LIBRARY=#{Formula["gsl"].opt_lib}/libgsl.dylib",
"-DUSE_JPEG=ON",
"-DJPEG_INCLUDE_DIR=#{Formula["jpeg"].opt_include}",
"-DJPEG_LIBRARY=#{Formula["jpeg"].opt_lib}/libjpeg.dylib",
"-DUSE_LAPACK=OFF",
"-DUSE_LIBUSB_1=OFF",
"-DUSE_OPENCV=ON",
"-DOpenCV_DIR=#{Formula["opencv"].opt_share}/OpenCV",
"-DUSE_PCL=OFF",
"-DUSE_PNG=ON",
"-DPNG_PNG_INCLUDE_DIR=#{Formula["libpng"].opt_include}",
"-DPNG_LIBRARY_RELEASE=#{Formula["libpng"].opt_lib}/libpng.dylib",
"-DUSE_PTHREAD=ON",
"-DPTHREAD_INCLUDE_DIR=#{sdk}/usr/include",
"-DPTHREAD_LIBRARY=/usr/lib/libpthread.dylib",
"-DUSE_PYLON=OFF",
"-DUSE_REALSENSE=OFF",
"-DUSE_REALSENSE2=OFF",
"-DUSE_X11=OFF",
"-DUSE_XML2=ON",
"-DXML2_INCLUDE_DIR=#{sdk}/usr/include/libxml2",
"-DXML2_LIBRARY=/usr/lib/libxml2.dylib",
"-DUSE_ZBAR=ON",
"-DZBAR_INCLUDE_DIRS=#{Formula["zbar"].opt_include}",
"-DZBAR_LIBRARIES=#{Formula["zbar"].opt_lib}/libzbar.dylib",
"-DUSE_ZLIB=ON",
"-DZLIB_INCLUDE_DIR=#{sdk}/usr/include",
"-DZLIB_LIBRARY_RELEASE=/usr/lib/libz.dylib",
"-DWITH_LAPACK=OFF",
*std_cmake_args
system "make", "install"
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