forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
320 lines (279 loc) · 8.9 KB
/
WORKSPACE
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# Copyright 2010-2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
workspace(name = "com_google_ortools")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
# Bazel Extensions
## Bazel Skylib rules.
git_repository(
name = "bazel_skylib",
tag = "1.7.1",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
## Bazel rules.
git_repository(
name = "platforms",
tag = "0.0.10",
remote = "https://github.com/bazelbuild/platforms.git",
)
git_repository(
name = "rules_cc",
tag = "0.0.9",
remote = "https://github.com/bazelbuild/rules_cc.git",
)
git_repository(
name = "rules_proto",
tag = "5.3.0-21.7",
remote = "https://github.com/bazelbuild/rules_proto.git",
)
git_repository(
name = "rules_java",
tag = "7.7.0",
remote = "https://github.com/bazelbuild/rules_java.git",
)
git_repository(
name = "rules_jvm_external",
tag = "6.2",
remote = "https://github.com/bazelbuild/rules_jvm_external.git",
)
git_repository(
name = "contrib_rules_jvm",
tag = "v0.27.0",
remote = "https://github.com/bazel-contrib/rules_jvm.git",
)
git_repository(
name = "rules_python",
tag = "0.34.0",
remote = "https://github.com/bazelbuild/rules_python.git",
)
# Dependencies
## ZLIB
new_git_repository(
name = "zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
tag = "v1.3.1",
remote = "https://github.com/madler/zlib.git",
)
## Abseil-cpp
git_repository(
name = "com_google_absl",
tag = "20240722.0",
patches = ["//patches:abseil-cpp-20240722.0.patch"],
patch_args = ["-p1"],
remote = "https://github.com/abseil/abseil-cpp.git",
)
## Re2
git_repository(
name = "com_google_re2",
tag = "2024-04-01",
remote = "https://github.com/google/re2.git",
repo_mapping = {"@abseil-cpp": "@com_google_absl"},
)
## Protobuf
# proto_library, cc_proto_library, and java_proto_library rules implicitly
# depend on @com_google_protobuf for protoc and proto runtimes.
# This statement defines the @com_google_protobuf repo.
git_repository(
name = "com_google_protobuf",
patches = ["//patches:protobuf-v26.1.patch"],
patch_args = ["-p1"],
tag = "v26.1",
remote = "https://github.com/protocolbuffers/protobuf.git",
)
# Load common dependencies.
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
## Solvers
http_archive(
name = "glpk",
build_file = "//bazel:glpk.BUILD.bazel",
sha256 = "4a1013eebb50f728fc601bdd833b0b2870333c3b3e5a816eeba921d95bec6f15",
url = "http://ftp.gnu.org/gnu/glpk/glpk-5.0.tar.gz",
)
http_archive(
name = "bliss",
build_file = "//bazel:bliss.BUILD.bazel",
patches = ["//bazel:bliss-0.73.patch"],
sha256 = "f57bf32804140cad58b1240b804e0dbd68f7e6bf67eba8e0c0fa3a62fd7f0f84",
url = "https://github.com/google/or-tools/releases/download/v9.0/bliss-0.73.zip",
#url = "http://www.tcs.hut.fi/Software/bliss/bliss-0.73.zip",
)
new_git_repository(
name = "scip",
build_file = "//bazel:scip.BUILD.bazel",
patches = ["//bazel:scip-v900.patch"],
patch_args = ["-p1"],
tag = "v900",
remote = "https://github.com/scipopt/scip.git",
)
# Eigen has no Bazel build.
new_git_repository(
name = "eigen",
tag = "3.4.0",
remote = "https://gitlab.com/libeigen/eigen.git",
build_file_content =
"""
cc_library(
name = 'eigen3',
srcs = [],
includes = ['.'],
hdrs = glob(['Eigen/**']),
defines = ["EIGEN_MPL2_ONLY",],
visibility = ['//visibility:public'],
)
"""
)
git_repository(
name = "highs",
branch = "v1.7.2",
remote = "https://github.com/ERGO-Code/HiGHS.git",
)
## Swig support
# pcre source code repository
new_git_repository(
name = "pcre2",
build_file = "//bazel:pcre2.BUILD.bazel",
tag = "pcre2-10.42",
remote = "https://github.com/PCRE2Project/pcre2.git",
)
# generate Patch:
# Checkout swig
# cd Source/CParse && bison -d -o parser.c parser.y
# ./autogen.sh
# ./configure
# make Lib/swigwarn.swg
# edit .gitignore and remove parser.h, parser.c, and swigwarn.swg
# git add Source/CParse/parser.h Source/CParse/parser.c Lib/swigwarn.swg
# git diff --staged Lib Source/CParse > <path to>swig.patch
# Edit swig.BUILD.bazel:
# edit version
new_git_repository(
name = "swig",
build_file = "//bazel:swig.BUILD.bazel",
patches = ["//bazel:swig.patch"],
patch_args = ["-p1"],
tag = "v4.2.0",
remote = "https://github.com/swig/swig.git",
)
## Python
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
DEFAULT_PYTHON = "3.12"
python_register_toolchains(
name = "python3_12",
python_version = DEFAULT_PYTHON,
ignore_root_user_error=True,
)
# Create a central external repo, @pip_deps, that contains Bazel targets for all the
# third-party packages specified in the bazel/requirements.txt file.
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "pip_deps",
requirements_lock = "//bazel:ortools_requirements.txt",
)
load("@pip_deps//:requirements.bzl",
install_pip_deps="install_deps")
install_pip_deps()
# Add a second repo @ortools_notebook_deps for jupyter notebooks.
pip_parse(
name = "ortools_notebook_deps",
requirements_lock = "//bazel:notebook_requirements.txt",
)
load("@ortools_notebook_deps//:requirements.bzl",
install_notebook_deps="install_deps")
install_notebook_deps()
# Protobuf
load("@com_google_protobuf//bazel:system_python.bzl", "system_python")
system_python(
name = "system_python",
minimum_python_version = "3.8",
)
# Absl python library
http_archive(
name = "com_google_absl_py",
repo_mapping = {"@six_archive": "@six"},
sha256 = "0be59b82d65dfa1f995365dcfea2cc57989297b065fda696ef13f30fcc6c8e5b",
strip_prefix = "abseil-py-pypi-v0.15.0",
urls = [
"https://github.com/abseil/abseil-py/archive/refs/tags/pypi-v0.15.0.tar.gz",
],
)
## `pybind11_bazel`
git_repository(
name = "pybind11_bazel",
tag = "v2.12.0", # 2024/04/08
patches = ["//patches:pybind11_bazel.patch"],
patch_args = ["-p1"],
remote = "https://github.com/pybind/pybind11_bazel.git",
)
new_git_repository(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11-BUILD.bazel",
tag = "v2.13.1",
remote = "https://github.com/pybind/pybind11.git",
)
new_git_repository(
name = "org_pybind11_abseil",
tag = "v202402.0",
patches = ["//patches:pybind11_abseil.patch"],
patch_args = ["-p1"],
remote = "https://github.com/pybind/pybind11_abseil.git",
)
new_git_repository(
name = "pybind11_protobuf",
commit = "84653a591aea5df482dc2bde42c19efafbd53a57", # 2024/06/28
remote = "https://github.com/pybind/pybind11_protobuf.git",
)
## Java support (with junit 5)
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
rules_java_dependencies()
rules_java_toolchains()
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
rules_jvm_external_setup()
JUNIT_PLATFORM_VERSION = "1.9.2"
JUNIT_JUPITER_VERSION = "5.9.2"
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"net.java.dev.jna:jna:5.14.0",
"com.google.truth:truth:0.32",
"org.junit.platform:junit-platform-launcher:%s" % JUNIT_PLATFORM_VERSION,
"org.junit.platform:junit-platform-reporting:%s" % JUNIT_PLATFORM_VERSION,
"org.junit.jupiter:junit-jupiter-api:%s" % JUNIT_JUPITER_VERSION,
"org.junit.jupiter:junit-jupiter-params:%s" % JUNIT_JUPITER_VERSION,
"org.junit.jupiter:junit-jupiter-engine:%s" % JUNIT_JUPITER_VERSION,
],
repositories = [
"https://repo1.maven.org/maven2",
],
)
load("@contrib_rules_jvm//:repositories.bzl", "contrib_rules_jvm_deps")
contrib_rules_jvm_deps()
load("@contrib_rules_jvm//:setup.bzl", "contrib_rules_jvm_setup")
contrib_rules_jvm_setup()
## Testing
git_repository(
name = "com_google_googletest",
tag = "v1.15.2",
remote = "https://github.com/google/googletest.git",
)
git_repository(
name = "com_google_benchmark",
tag = "v1.8.5",
remote = "https://github.com/google/benchmark.git",
)