class Eigen < Formula desc "C++ template library for linear algebra" homepage "https://eigen.tuxfamily.org/" url "https://bitbucket.org/eigen/eigen/get/3.3.5.tar.bz2" sha256 "7352bff3ea299e4c7d7fbe31c504f8eb9149d7e685dec5a12fbaa26379f603e2" head "https://bitbucket.org/eigen/eigen", :using => :hg bottle do cellar :any_skip_relocation sha256 "2d341f7f61d359f16052ad4943d92f44be362ac978c435797785739e1ce0bdf8" => :mojave sha256 "058b1692b9ccb2e54d062cd1ef947ee89984cc5f818202100284218d6e3a3b32" => :high_sierra sha256 "058b1692b9ccb2e54d062cd1ef947ee89984cc5f818202100284218d6e3a3b32" => :sierra sha256 "058b1692b9ccb2e54d062cd1ef947ee89984cc5f818202100284218d6e3a3b32" => :el_capitan 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 #include 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