85 lines
2.7 KiB
Ruby
85 lines
2.7 KiB
Ruby
class Mlpack < Formula
|
|
desc "Scalable C++ machine learning library"
|
|
homepage "https://www.mlpack.org"
|
|
url "https://mlpack.org/files/mlpack-3.4.2.tar.gz"
|
|
sha256 "9e5c4af5c276c86a0dcc553289f6fe7b1b340d61c1e59844b53da0debedbb171"
|
|
license all_of: ["BSD-3-Clause", "MPL-2.0", "BSL-1.0", "MIT"]
|
|
|
|
livecheck do
|
|
url "https://mlpack.org/files/"
|
|
regex(/href=.*?mlpack[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, big_sur: "55819c54944eabc313874577f91e448decc0e28edb029f66417a900b7f9aba78"
|
|
sha256 cellar: :any, catalina: "baa0ddc38114b9c207c3c6839d683fa4580b8227bad3c4b6cae06c0110b7fe68"
|
|
sha256 cellar: :any, mojave: "b00745a4f66ea745c28ad1c64829a278c4def5fc8458f277ca90f04e306838d4"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "doxygen" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "armadillo"
|
|
depends_on "boost"
|
|
depends_on "ensmallen"
|
|
depends_on "graphviz"
|
|
|
|
resource "stb_image" do
|
|
url "https://mlpack.org/files/stb-2.22/stb_image.h"
|
|
sha256 "0e28238d865510073b5740ae8eba8cd8032cc5b25f94e0f7505fac8036864909"
|
|
end
|
|
|
|
resource "stb_image_write" do
|
|
url "https://mlpack.org/files/stb-1.13/stb_image_write.h"
|
|
sha256 "0e8b3d80bc6eb8fdb64abc4db9fec608b489bc73418eaf14beda102a0699a4c9"
|
|
end
|
|
|
|
def install
|
|
resources.each do |r|
|
|
r.stage do
|
|
(include/"stb").install "#{r.name}.h"
|
|
end
|
|
end
|
|
cmake_args = std_cmake_args + %W[
|
|
-DDEBUG=OFF
|
|
-DPROFILE=OFF
|
|
-DBUILD_TESTS=OFF
|
|
-DDISABLE_DOWNLOADS=ON
|
|
-DUSE_OPENMP=OFF
|
|
-DARMADILLO_INCLUDE_DIR=#{Formula["armadillo"].opt_include}
|
|
-DENSMALLEN_INCLUDE_DIR=#{Formula["ensmallen"].opt_include}
|
|
-DARMADILLO_LIBRARY=#{Formula["armadillo"].opt_lib}/libarmadillo.dylib
|
|
-DSTB_IMAGE_INCLUDE_DIR=#{include/"stb"}
|
|
]
|
|
mkdir "build" do
|
|
system "cmake", "..", *cmake_args
|
|
system "make", "install"
|
|
end
|
|
doc.install Dir["doc/*"]
|
|
(pkgshare/"tests").install "src/mlpack/tests/data" # Includes test data.
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/mlpack_knn",
|
|
"-r", "#{pkgshare}/tests/data/GroupLensSmall.csv",
|
|
"-n", "neighbors.csv",
|
|
"-d", "distances.csv",
|
|
"-k", "5", "-v"
|
|
|
|
(testpath/"test.cpp").write <<-EOS
|
|
#include <mlpack/core.hpp>
|
|
|
|
using namespace mlpack;
|
|
|
|
int main(int argc, char** argv) {
|
|
Log::Debug << "Compiled with debugging symbols." << std::endl;
|
|
Log::Info << "Some test informational output." << std::endl;
|
|
Log::Warn << "A false alarm!" << std::endl;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "test.cpp", "-std=c++11", "-I#{include}", "-I#{Formula["armadillo"].opt_lib}/libarmadillo",
|
|
"-L#{lib}", "-lmlpack", "-o", "test"
|
|
system "./test", "--verbose"
|
|
end
|
|
end
|