51 lines
1.8 KiB
Ruby
51 lines
1.8 KiB
Ruby
class CeresSolver < Formula
|
|
desc "C++ library for large-scale optimization"
|
|
homepage "http://ceres-solver.org/"
|
|
url "http://ceres-solver.org/ceres-solver-1.14.0.tar.gz"
|
|
sha256 "4744005fc3b902fed886ea418df70690caa8e2ff6b5a90f3dd88a3d291ef8e8e"
|
|
revision 2
|
|
head "https://ceres-solver.googlesource.com/ceres-solver.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "d900574709a56c719266d9210b8e0a63c320e5553d22669ff6f4bb41c0ac4e11" => :high_sierra
|
|
sha256 "5f7d0c938950c6f068b011155eba4807f2953a0d383d83ff782517242b9c0851" => :sierra
|
|
sha256 "3ea208cf8c39bea71f4cc86460f80d1993896205d17e0d333fa5db8c3a71e468" => :el_capitan
|
|
end
|
|
|
|
depends_on "cmake"
|
|
depends_on "eigen"
|
|
depends_on "gflags"
|
|
depends_on "glog"
|
|
depends_on "metis"
|
|
depends_on "suite-sparse"
|
|
|
|
def install
|
|
system "cmake", ".", *std_cmake_args,
|
|
"-DBUILD_SHARED_LIBS=ON",
|
|
"-DEIGEN_INCLUDE_DIR=#{Formula["eigen"].opt_include}/eigen3",
|
|
"-DMETIS_LIBRARY=#{Formula["metis"].opt_lib}/libmetis.dylib",
|
|
"-DGLOG_INCLUDE_DIR_HINTS=#{Formula["glog"].opt_include}",
|
|
"-DGLOG_LIBRARY_DIR_HINTS=#{Formula["glog"].opt_lib}"
|
|
system "make"
|
|
system "make", "install"
|
|
pkgshare.install "examples", "data"
|
|
doc.install "docs/html" unless build.head?
|
|
end
|
|
|
|
test do
|
|
cp pkgshare/"examples/helloworld.cc", testpath
|
|
(testpath/"CMakeLists.txt").write <<~EOS
|
|
cmake_minimum_required(VERSION 2.8)
|
|
project(helloworld)
|
|
find_package(Ceres REQUIRED)
|
|
include_directories(${CERES_INCLUDE_DIRS})
|
|
add_executable(helloworld helloworld.cc)
|
|
target_link_libraries(helloworld ${CERES_LIBRARIES})
|
|
EOS
|
|
|
|
system "cmake", "-DCeres_DIR=#{share}/Ceres", "."
|
|
system "make"
|
|
assert_match "CONVERGENCE", shell_output("./helloworld", 0)
|
|
end
|
|
end
|