homebrew-core/Formula/eigen.rb
2016-11-13 13:23:09 +00:00

49 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.0.tar.bz2"
sha256 "e3cf8f9289de20540a79c9c5653bbe623cadd6202bfe9692e95c420b5adbb7e7"
head "https://bitbucket.org/eigen/eigen", :using => :hg
bottle do
cellar :any_skip_relocation
sha256 "a690f0fdc122ad69068ec1d4839cb05447c0b4364231f3fdf02c9ae865afb51a" => :sierra
sha256 "a690f0fdc122ad69068ec1d4839cb05447c0b4364231f3fdf02c9ae865afb51a" => :el_capitan
sha256 "a690f0fdc122ad69068ec1d4839cb05447c0b4364231f3fdf02c9ae865afb51a" => :yosemite
end
option :universal
depends_on "cmake" => :build
def install
ENV.universal_binary if build.universal?
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.undent
#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