homebrew-core/Formula/caffe.rb

76 lines
2.2 KiB
Ruby

class Caffe < Formula
desc "Fast open framework for deep learning"
homepage "https://caffe.berkeleyvision.org/"
url "https://github.com/BVLC/caffe/archive/1.0.tar.gz"
sha256 "71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f"
license "BSD-2-Clause"
revision 33
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_big_sur: "22169addf9ac9ae8a7b3477716499799fd85a4aeccb732a0c580a87d1b171e59"
sha256 cellar: :any, big_sur: "b7f91af462268b50722ce6f993232034c297e01765ea9016cc46543c9d50a2dd"
sha256 cellar: :any, catalina: "691fb884f9a4a8db955e318ea71a2a6c6908feb3f3fa1271fd3a6ec56e641571"
sha256 cellar: :any, mojave: "5f1c675912742ac91bf9bddb0360509b6f307a122bc8329d5c02be23df6c420c"
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "gflags"
depends_on "glog"
depends_on "hdf5"
depends_on "leveldb"
depends_on "lmdb"
depends_on "opencv"
depends_on "protobuf"
depends_on "snappy"
depends_on "szip"
resource "test_model" do
url "https://github.com/nandahkrishna/CaffeMNIST/archive/2483b0ba9b04728041f7d75a3b3cf428cb8edb12.tar.gz"
sha256 "2d4683899e9de0949eaf89daeb09167591c060db2187383639c34d7cb5f46b31"
end
# Fix compilation with OpenCV 4
# https://github.com/BVLC/caffe/issues/6652
patch do
url "https://github.com/BVLC/caffe/commit/0a04cc2ccd37ba36843c18fea2d5cbae6e7dd2b5.patch?full_index=1"
sha256 "f79349200c46fc1228ab1e1c135a389a6d0c709024ab98700017f5f66b373b39"
end
def install
ENV.cxx11
args = std_cmake_args + %w[
-DALLOW_LMDB_NOLOCK=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_docs=OFF
-DBUILD_matlab=OFF
-DBUILD_python=OFF
-DBUILD_python_layer=OFF
-DCPU_ONLY=ON
-DUSE_LEVELDB=ON
-DUSE_LMDB=ON
-DUSE_NCCL=OFF
-DUSE_OPENCV=ON
-DUSE_OPENMP=OFF
]
system "cmake", ".", *args
system "make", "install"
pkgshare.install "models"
end
test do
resource("test_model").stage do
system "#{bin}/caffe", "test",
"-model", "lenet_train_test.prototxt",
"-weights", "lenet_iter_10000.caffemodel"
end
end
end