forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheigen.rb
47 lines (41 loc) · 1.3 KB
/
eigen.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class Eigen < Formula
desc "C++ template library for linear algebra"
homepage "https://eigen.tuxfamily.org/"
url "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"
sha256 "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72"
license "MPL-2.0"
revision 1
head "https://gitlab.com/libeigen/eigen.git", branch: "master"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
rebuild 3
sha256 cellar: :any_skip_relocation, all: "06503290dc3c07a67b8f582046b0a7f0bd68c2cb2da1e5bc071710de5ba7f5ec"
end
depends_on "cmake" => :build
conflicts_with "freeling", because: "freeling ships its own copy of eigen"
def install
system "cmake", "-S", ".", "-B", "eigen-build", "-Dpkg_config_libdir=#{lib}", *std_cmake_args
system "cmake", "--install", "eigen-build"
end
test do
(testpath/"test.cpp").write <<~CPP
#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;
}
CPP
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