46 lines
1.4 KiB
Ruby
46 lines
1.4 KiB
Ruby
class Eigen < Formula
|
|
desc "C++ template library for linear algebra"
|
|
homepage "https://eigen.tuxfamily.org/"
|
|
url "https://bitbucket.org/eigen/eigen/get/3.3.7.tar.bz2"
|
|
sha256 "9f13cf90dedbe3e52a19f43000d71fdf72e986beb9a5436dddcd61ff9d77a3ce"
|
|
head "https://bitbucket.org/eigen/eigen", :using => :hg
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "683c2dd898245f61c298d1f2675885e7c67ec7e18f6665df1ec56f088bd670f4" => :mojave
|
|
sha256 "79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827" => :high_sierra
|
|
sha256 "79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827" => :sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
|
|
def install
|
|
mkdir "eigen-build" do
|
|
args = std_cmake_args
|
|
args << "-Dpkg_config_libdir=#{lib}" << ".."
|
|
system "cmake", *args
|
|
system "make", "install"
|
|
end
|
|
(share/"cmake/Modules").install "cmake/FindEigen3.cmake"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include <iostream>
|
|
#include <Eigen/Dense>
|
|
using Eigen::MatrixXd;
|
|
int main()
|
|
{
|
|
MatrixXd m(2,2);
|
|
m(0,0) = 3;
|
|
m(1,0) = 2.5;
|
|
m(0,1) = -1;
|
|
m(1,1) = m(1,0) + m(0,1);
|
|
std::cout << m << std::endl;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "test.cpp", "-I#{include}/eigen3", "-o", "test"
|
|
assert_equal %w[3 -1 2.5 1.5], shell_output("./test").split
|
|
end
|
|
end
|