-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathor-tools.rb
53 lines (48 loc) · 1.76 KB
/
or-tools.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
48
49
50
51
52
53
class OrTools < Formula
desc "Google's Operations Research tools"
homepage "https://developers.google.com/optimization/"
url "https://github.com/google/or-tools/archive/v8.2.tar.gz"
sha256 "beb9fe379977033151045d0815d26c628ad99d74d68b9f3b707578492723731e"
license "Apache-2.0"
head "https://github.com/google/or-tools.git"
bottle do
cellar :any
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"
# This is a CMake based build
def install
# CMake based build
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",
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