homebrew-core/Formula/or-tools.rb

61 lines
2.3 KiB
Ruby

class OrTools < Formula
desc "Google's Operations Research tools"
homepage "https://developers.google.com/optimization/"
url "https://github.com/google/or-tools/archive/v9.0.tar.gz"
sha256 "fa7700b614ea2a5b2b6e37b76874bd2c3f04a80f03cbbf7871a2d2d5cd3a6091"
license "Apache-2.0"
revision 2
head "https://github.com/google/or-tools.git", branch: "stable"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_big_sur: "2e20a4c6156c99bc5adddff41fdb089de87e3ab2bd1f12d635507cc7473060e0"
sha256 cellar: :any, big_sur: "94132d3b6f84eec31adbcc8ef6a0ae3864a20bd2fc7ac3a397cec9fff859c291"
sha256 cellar: :any, catalina: "b544d25c7a8303129fe514053e586259bda9917d37ce8be3bedac42808a41032"
sha256 cellar: :any, mojave: "891e86fe2441ecd820ed381d4c86697dbf03b6a47fa5cb713d4c21a8fe44fac8"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "abseil"
depends_on "cbc"
depends_on "cgl"
depends_on "clp"
depends_on "coinutils"
depends_on "osi"
depends_on "protobuf"
def install
system "cmake", "-S.", "-Bbuild", *std_cmake_args,
"-DUSE_SCIP=OFF", "-DBUILD_SAMPLES=OFF", "-DBUILD_EXAMPLES=OFF"
system "cmake", "--build", "build", "-v"
system "cmake", "--build", "build", "--target", "install"
pkgshare.install "ortools/linear_solver/samples/simple_lp_program.cc"
pkgshare.install "ortools/constraint_solver/samples/simple_routing_program.cc"
pkgshare.install "ortools/sat/samples/simple_sat_program.cc"
end
test do
# Linear Solver & Glop Solver
system ENV.cxx, "-std=c++17",
"-I#{include}", "-L#{lib}", "-lortools",
"-L#{Formula["abseil"].opt_lib}", "-labsl_time",
pkgshare/"simple_lp_program.cc", "-o", "simple_lp_program"
system "./simple_lp_program"
# Routing Solver
system ENV.cxx, "-std=c++17",
"-I#{include}", "-L#{lib}", "-lortools",
pkgshare/"simple_routing_program.cc", "-o", "simple_routing_program"
system "./simple_routing_program"
# Sat Solver
system ENV.cxx, "-std=c++17",
"-I#{include}", "-L#{lib}", "-lortools",
pkgshare/"simple_sat_program.cc", "-o", "simple_sat_program"
system "./simple_sat_program"
end
end