58 lines
1.8 KiB
Ruby
58 lines
1.8 KiB
Ruby
class Dlib < Formula
|
|
desc "C++ library for machine learning"
|
|
homepage "http://dlib.net/"
|
|
url "http://dlib.net/files/dlib-19.8.tar.bz2"
|
|
sha256 "dbd31f7b97166e58f366c83fa5127e9fa44c492921558b61ce63a7d775be696b"
|
|
head "https://github.com/davisking/dlib.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "fa12dbe4241c8fbea94aaa3ae5698ad388910850cb175fe441f243a46c261d8f" => :high_sierra
|
|
sha256 "b3b089b2a7723f51b9d95535dc4eaac2eeba2ddebd42d58ff1e0df9caea269e1" => :sierra
|
|
sha256 "a750ad1c9f82d5b8e39e75e2e9d9360aefd6243d0d44961525edeedd58944a42" => :el_capitan
|
|
end
|
|
|
|
depends_on :macos => :el_capitan # needs thread-local storage
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "jpeg"
|
|
depends_on "libpng"
|
|
depends_on "openblas" => :optional
|
|
depends_on :x11 => :optional
|
|
|
|
needs :cxx11
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
args = std_cmake_args + %w[-DDLIB_USE_BLAS=ON -DDLIB_USE_LAPACK=ON]
|
|
args << "-DDLIB_NO_GUI_SUPPORT=ON" if build.without? "x11"
|
|
|
|
if build.with? "openblas"
|
|
args << "-Dcblas_lib=#{Formula["openblas"].opt_lib}/libopenblas.dylib"
|
|
args << "-Dlapack_lib=#{Formula["openblas"].opt_lib}/libopenblas.dylib"
|
|
else
|
|
args << "-Dcblas_lib=/usr/lib/libcblas.dylib"
|
|
args << "-Dlapack_lib=/usr/lib/liblapack.dylib"
|
|
end
|
|
|
|
mkdir "dlib/build" do
|
|
system "cmake", "..", *args
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include <dlib/logger.h>
|
|
dlib::logger dlog("example");
|
|
int main() {
|
|
dlog.set_level(dlib::LALL);
|
|
dlog << dlib::LINFO << "The answer is " << 42;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", "-I#{include}",
|
|
"-L#{lib}", "-ldlib"
|
|
assert_match /INFO.*example: The answer is 42/, shell_output("./test")
|
|
end
|
|
end
|