49 lines
1.4 KiB
Ruby
49 lines
1.4 KiB
Ruby
class Eigen < Formula
|
|
desc "C++ template library for linear algebra"
|
|
homepage "http://eigen.tuxfamily.org/"
|
|
url "https://bitbucket.org/eigen/eigen/get/3.2.7.tar.bz2"
|
|
sha256 "e58e1a11b23cf2754e32b3c5990f318a8461a3613c7acbf6035870daa45c2f3e"
|
|
head "https://bitbucket.org/eigen/eigen", :using => :hg
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "ea741c72d042b9039c635ac305e167c8593b42f7292c64120f9d9d49be10adca" => :el_capitan
|
|
sha256 "a087266ae637069e7270b900dcfd5960b288da8bea79ce8f5ff5fd57aaadaa92" => :yosemite
|
|
sha256 "54102540761296a10483f3f5d1938c9de050c71876746f937564bce2cad7e262" => :mavericks
|
|
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
|