google-research
478 строк · 16.7 Кб
1load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2
3# Probably wanna used versioned version
4http_archive(
5name = "riegeli",
6strip_prefix = "riegeli-master",
7urls = [
8"https://github.com/google/riegeli/archive/master.zip",
9],
10)
11
12http_archive(
13name = "org_brotli",
14patch_args = ["-p1"],
15patches = ["@riegeli//third_party:brotli.patch"],
16sha256 = "fec5a1d26f3dd102c542548aaa704f655fecec3622a24ec6e97768dcb3c235ff",
17strip_prefix = "brotli-68f1b90ad0d204907beb58304d0bd06391001a4d",
18urls = ["https://github.com/google/brotli/archive/68f1b90ad0d204907beb58304d0bd06391001a4d.zip"], # 2021-08-18
19)
20
21http_archive(
22name = "net_zstd",
23build_file = "@riegeli//third_party:net_zstd.BUILD",
24sha256 = "b6c537b53356a3af3ca3e621457751fa9a6ba96daf3aebb3526ae0f610863532",
25strip_prefix = "zstd-1.4.5/lib",
26urls = ["https://github.com/facebook/zstd/archive/v1.4.5.zip"], # 2020-05-22
27)
28
29http_archive(
30name = "crc32c",
31build_file = "@riegeli//third_party:crc32.BUILD",
32sha256 = "338f1d9d95753dc3cdd882dfb6e176bbb4b18353c29c411ebcb7b890f361722e",
33strip_prefix = "crc32c-1.1.0",
34urls = ["https://github.com/google/crc32c/archive/1.1.0.zip"], # 2019-05-24
35)
36
37http_archive(
38name = "zlib",
39build_file = "@riegeli//third_party:zlib.BUILD",
40sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
41strip_prefix = "zlib-1.2.11",
42urls = ["http://zlib.net/fossils/zlib-1.2.11.tar.gz"], # 2017-01-15
43)
44
45http_archive(
46name = "highwayhash",
47build_file = "@riegeli//third_party:highwayhash.BUILD",
48sha256 = "cf891e024699c82aabce528a024adbe16e529f2b4e57f954455e0bf53efae585",
49strip_prefix = "highwayhash-276dd7b4b6d330e4734b756e97ccfb1b69cc2e12",
50urls = ["https://github.com/google/highwayhash/archive/276dd7b4b6d330e4734b756e97ccfb1b69cc2e12.zip"], # 2019-02-22
51)
52
53# Pin to mediapipe GitHub version (latest as of 2021-12-13 is 0.8.9)
54http_archive(
55name = "mediapipe",
56strip_prefix = "mediapipe-0.8.9",
57urls = [
58"https://github.com/google/mediapipe/archive/refs/tags/v0.8.9.tar.gz",
59],
60)
61
62# ------------- Begin mediapipe dependencies ----------------
63
64# Bazel does not support transitive external dependencies. All contents of mediapipe must be copied here.
65http_archive(
66name = "bazel_skylib",
67type = "tar.gz",
68urls = [
69"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
70"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
71],
72sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
73)
74load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
75bazel_skylib_workspace()
76load("@bazel_skylib//lib:versions.bzl", "versions")
77versions.check(minimum_bazel_version = "3.7.2")
78
79# ABSL cpp library lts_2021_03_24, patch 2.
80http_archive(
81name = "com_google_absl",
82urls = [
83"https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.2.tar.gz",
84],
85# Remove after https://github.com/abseil/abseil-cpp/issues/326 is solved.
86patches = [
87"@mediapipe//third_party:com_google_absl_f863b622fe13612433fdf43f76547d5edda0c93001.diff"
88],
89patch_args = [
90"-p1",
91],
92strip_prefix = "abseil-cpp-20210324.2",
93sha256 = "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f"
94)
95
96http_archive(
97name = "rules_cc",
98strip_prefix = "rules_cc-0.0.1",
99urls = ["https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.0.1.zip"],
100)
101
102http_archive(
103name = "rules_foreign_cc",
104strip_prefix = "rules_foreign_cc-0.1.0",
105url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip",
106)
107
108load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
109
110rules_foreign_cc_dependencies()
111
112# This is used to select all contents of the archives for CMake-based packages to give CMake access to them.
113all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
114
115# GoogleTest/GoogleMock framework. Used by most unit-tests.
116# Last updated 2021-07-02.
117http_archive(
118name = "com_google_googletest",
119urls = ["https://github.com/google/googletest/archive/4ec4cd23f486bf70efcc5d2caa40f24368f752e3.zip"],
120strip_prefix = "googletest-4ec4cd23f486bf70efcc5d2caa40f24368f752e3",
121sha256 = "de682ea824bfffba05b4e33b67431c247397d6175962534305136aa06f92e049",
122)
123
124# Google Benchmark library.
125http_archive(
126name = "com_google_benchmark",
127urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.6.1.zip"],
128strip_prefix = "benchmark-v1.6.1.zip",
129build_file = "@mediapipe//third_party:benchmark.BUILD",
130)
131
132
133# gflags needed by glog
134http_archive(
135name = "com_github_gflags_gflags",
136strip_prefix = "gflags-2.2.2",
137sha256 = "19713a36c9f32b33df59d1c79b4958434cb005b5b47dc5400a7a4b078111d9b5",
138url = "https://github.com/gflags/gflags/archive/v2.2.2.zip",
139)
140
141# 2020-08-21. Change?
142http_archive(
143name = "com_github_glog_glog",
144strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6",
145sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab",
146urls = [
147"https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip",
148],
149)
150http_archive(
151name = "com_github_glog_glog_no_gflags",
152strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6",
153sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab",
154build_file = "@mediapipe//third_party:glog_no_gflags.BUILD",
155urls = [
156"https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip",
157],
158patches = [
159"@mediapipe//third_party:com_github_glog_glog_9779e5ea6ef59562b030248947f787d1256132ae.diff",
160],
161patch_args = [
162"-p1",
163],
164)
165
166# easyexif
167http_archive(
168name = "easyexif",
169url = "https://github.com/mayanklahiri/easyexif/archive/master.zip",
170strip_prefix = "easyexif-master",
171build_file = "@mediapipe//third_party:easyexif.BUILD",
172)
173
174# libyuv
175http_archive(
176name = "libyuv",
177# Error: operand type mismatch for `vbroadcastss' caused by commit 8a13626e42f7fdcf3a6acbb0316760ee54cda7d8.
178urls = ["https://chromium.googlesource.com/libyuv/libyuv/+archive/2525698acba9bf9b701ba6b4d9584291a1f62257.tar.gz"],
179build_file = "@mediapipe//third_party:libyuv.BUILD",
180)
181
182# Note: protobuf-javalite is no longer released as a separate download, it's included in the main Java download.
183# ...but the Java download is currently broken, so we use the "source" download.
184http_archive(
185name = "com_google_protobuf_javalite",
186sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422",
187strip_prefix = "protobuf-3.19.1",
188urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
189)
190
191http_archive(
192name = "com_google_protobuf",
193sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422",
194strip_prefix = "protobuf-3.19.1",
195urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"],
196patches = [
197"@mediapipe//third_party:com_google_protobuf_fixes.diff"
198],
199patch_args = [
200"-p1",
201],
202)
203
204http_archive(
205name = "com_google_audio_tools",
206strip_prefix = "multichannel-audio-tools-master",
207urls = ["https://github.com/google/multichannel-audio-tools/archive/master.zip"],
208)
209
210# 2020-07-09
211http_archive(
212name = "pybind11_bazel",
213strip_prefix = "pybind11_bazel-203508e14aab7309892a1c5f7dd05debda22d9a5",
214urls = ["https://github.com/pybind/pybind11_bazel/archive/203508e14aab7309892a1c5f7dd05debda22d9a5.zip"],
215sha256 = "75922da3a1bdb417d820398eb03d4e9bd067c4905a4246d35a44c01d62154d91",
216)
217
218# Point to the commit that deprecates the usage of Eigen::MappedSparseMatrix.
219http_archive(
220name = "pybind11",
221urls = [
222"https://github.com/pybind/pybind11/archive/70a58c577eaf067748c2ec31bfd0b0a614cffba6.zip",
223],
224sha256 = "b971842fab1b5b8f3815a2302331782b7d137fef0e06502422bc4bc360f4956c",
225strip_prefix = "pybind11-70a58c577eaf067748c2ec31bfd0b0a614cffba6",
226build_file = "@pybind11_bazel//:pybind11.BUILD",
227)
228
229# Point to the commit that deprecates the usage of Eigen::MappedSparseMatrix.
230http_archive(
231name = "ceres_solver",
232url = "https://github.com/ceres-solver/ceres-solver/archive/123fba61cf2611a3c8bddc9d91416db26b10b558.zip",
233patches = [
234"@mediapipe//third_party:ceres_solver_compatibility_fixes.diff"
235],
236patch_args = [
237"-p1",
238],
239strip_prefix = "ceres-solver-123fba61cf2611a3c8bddc9d91416db26b10b558",
240sha256 = "8b7b16ceb363420e0fd499576daf73fa338adb0b1449f58bea7862766baa1ac7"
241)
242
243http_archive(
244name = "opencv",
245build_file_content = all_content,
246strip_prefix = "opencv-3.4.10",
247urls = ["https://github.com/opencv/opencv/archive/3.4.10.tar.gz"],
248)
249
250new_local_repository(
251name = "linux_opencv",
252build_file = "@mediapipe//third_party:opencv_linux.BUILD",
253path = "/usr",
254)
255
256new_local_repository(
257name = "linux_ffmpeg",
258build_file = "@mediapipe//third_party:ffmpeg_linux.BUILD",
259path = "/usr"
260)
261
262new_local_repository(
263name = "macos_opencv",
264build_file = "@mediapipe//third_party:opencv_macos.BUILD",
265path = "/usr/local/opt/opencv@3",
266)
267
268new_local_repository(
269name = "macos_ffmpeg",
270build_file = "@mediapipe//third_party:ffmpeg_macos.BUILD",
271path = "/usr/local/opt/ffmpeg",
272)
273
274new_local_repository(
275name = "windows_opencv",
276build_file = "@mediapipe//third_party:opencv_windows.BUILD",
277path = "C:\\opencv\\build",
278)
279
280http_archive(
281name = "android_opencv",
282build_file = "@mediapipe//third_party:opencv_android.BUILD",
283strip_prefix = "OpenCV-android-sdk",
284type = "zip",
285url = "https://github.com/opencv/opencv/releases/download/3.4.3/opencv-3.4.3-android-sdk.zip",
286)
287
288# After OpenCV 3.2.0, the pre-compiled opencv2.framework has google protobuf symbols, which will
289# trigger duplicate symbol errors in the linking stage of building a mediapipe ios app.
290# To get a higher version of OpenCV for iOS, opencv2.framework needs to be built from source with
291# '-DBUILD_PROTOBUF=OFF -DBUILD_opencv_dnn=OFF'.
292http_archive(
293name = "ios_opencv",
294sha256 = "7dd536d06f59e6e1156b546bd581523d8df92ce83440002885ec5abc06558de2",
295build_file = "@mediapipe//third_party:opencv_ios.BUILD",
296type = "zip",
297url = "https://github.com/opencv/opencv/releases/download/3.2.0/opencv-3.2.0-ios-framework.zip",
298)
299
300http_archive(
301name = "stblib",
302strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58",
303sha256 = "13a99ad430e930907f5611325ec384168a958bf7610e63e60e2fd8e7b7379610",
304urls = ["https://github.com/nothings/stb/archive/b42009b3b9d4ca35bc703f5310eedc74f584be58.tar.gz"],
305build_file = "@mediapipe//third_party:stblib.BUILD",
306patches = [
307"@mediapipe//third_party:stb_image_impl.diff"
308],
309patch_args = [
310"-p1",
311],
312)
313
314# iOS basic build deps.
315
316http_archive(
317name = "build_bazel_rules_apple",
318sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
319url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
320patches = [
321# Bypass checking ios unit test runner when building MP ios applications.
322"@mediapipe//third_party:build_bazel_rules_apple_bypass_test_runner_check.diff"
323],
324patch_args = [
325"-p1",
326],
327)
328
329load(
330"@build_bazel_rules_apple//apple:repositories.bzl",
331"apple_rules_dependencies",
332)
333
334apple_rules_dependencies()
335
336load(
337"@build_bazel_rules_swift//swift:repositories.bzl",
338"swift_rules_dependencies",
339)
340
341swift_rules_dependencies()
342
343http_archive(
344name = "build_bazel_apple_support",
345sha256 = "741366f79d900c11e11d8efd6cc6c66a31bfb2451178b58e0b5edc6f1db17b35",
346urls = [
347"https://github.com/bazelbuild/apple_support/releases/download/0.10.0/apple_support.0.10.0.tar.gz"
348],
349)
350
351load(
352"@build_bazel_apple_support//lib:repositories.bzl",
353"apple_support_dependencies",
354)
355
356apple_support_dependencies()
357
358# More iOS deps.
359
360http_archive(
361name = "google_toolbox_for_mac",
362url = "https://github.com/google/google-toolbox-for-mac/archive/v2.2.1.zip",
363sha256 = "e3ac053813c989a88703556df4dc4466e424e30d32108433ed6beaec76ba4fdc",
364strip_prefix = "google-toolbox-for-mac-2.2.1",
365build_file = "@mediapipe//third_party:google_toolbox_for_mac.BUILD",
366)
367
368# Maven dependencies.
369
370RULES_JVM_EXTERNAL_TAG = "4.0"
371RULES_JVM_EXTERNAL_SHA = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169"
372
373http_archive(
374name = "rules_jvm_external",
375strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
376sha256 = RULES_JVM_EXTERNAL_SHA,
377url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
378)
379
380load("@rules_jvm_external//:defs.bzl", "maven_install")
381
382# Important: there can only be one maven_install rule. Add new maven deps here.
383maven_install(
384artifacts = [
385"androidx.concurrent:concurrent-futures:1.0.0-alpha03",
386"androidx.lifecycle:lifecycle-common:2.3.1",
387"androidx.activity:activity:1.2.2",
388"androidx.exifinterface:exifinterface:1.3.3",
389"androidx.fragment:fragment:1.3.4",
390"androidx.annotation:annotation:aar:1.1.0",
391"androidx.appcompat:appcompat:aar:1.1.0-rc01",
392"androidx.camera:camera-core:1.0.0-beta10",
393"androidx.camera:camera-camera2:1.0.0-beta10",
394"androidx.camera:camera-lifecycle:1.0.0-beta10",
395"androidx.constraintlayout:constraintlayout:aar:1.1.3",
396"androidx.core:core:aar:1.1.0-rc03",
397"androidx.legacy:legacy-support-v4:aar:1.0.0",
398"androidx.recyclerview:recyclerview:aar:1.1.0-beta02",
399"androidx.test.espresso:espresso-core:3.1.1",
400"com.github.bumptech.glide:glide:4.11.0",
401"com.google.android.material:material:aar:1.0.0-rc01",
402"com.google.auto.value:auto-value:1.8.1",
403"com.google.auto.value:auto-value-annotations:1.8.1",
404"com.google.code.findbugs:jsr305:latest.release",
405"com.google.android.datatransport:transport-api:3.0.0",
406"com.google.android.datatransport:transport-backend-cct:3.1.0",
407"com.google.android.datatransport:transport-runtime:3.1.0",
408"com.google.flogger:flogger-system-backend:0.6",
409"com.google.flogger:flogger:0.6",
410"com.google.guava:guava:27.0.1-android",
411"com.google.guava:listenablefuture:1.0",
412"junit:junit:4.12",
413"org.hamcrest:hamcrest-library:1.3",
414],
415repositories = [
416"https://maven.google.com",
417"https://dl.google.com/dl/android/maven2",
418"https://repo1.maven.org/maven2",
419"https://jcenter.bintray.com",
420],
421fetch_sources = True,
422version_conflict_policy = "pinned",
423)
424
425# Needed by TensorFlow
426http_archive(
427name = "io_bazel_rules_closure",
428sha256 = "e0a111000aeed2051f29fcc7a3f83be3ad8c6c93c186e64beb1ad313f0c7f9f9",
429strip_prefix = "rules_closure-cf1e44edb908e9616030cc83d085989b8e6cd6df",
430urls = [
431"http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz",
432"https://github.com/bazelbuild/rules_closure/archive/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz", # 2019-04-04
433],
434)
435
436# Tensorflow repo should always go after the other external dependencies.
437# 2021-12-02
438_TENSORFLOW_GIT_COMMIT = "18a1dc0ba806dc023808531f0373d9ec068e64bf"
439_TENSORFLOW_SHA256 = "85b90416f7a11339327777bccd634de00ca0de2cf334f5f0727edcb11ff9289a"
440http_archive(
441name = "org_tensorflow",
442urls = [
443"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
444],
445patches = [
446"@mediapipe//third_party:org_tensorflow_compatibility_fixes.diff",
447"@mediapipe//third_party:org_tensorflow_objc_cxx17.diff",
448# Diff is generated with a script, don't update it manually.
449"@mediapipe//third_party:org_tensorflow_custom_ops.diff",
450],
451patch_args = [
452"-p1",
453],
454strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
455sha256 = _TENSORFLOW_SHA256,
456)
457
458load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
459tf_workspace3()
460load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
461tf_workspace2()
462
463# Edge TPU
464http_archive(
465name = "libedgetpu",
466sha256 = "14d5527a943a25bc648c28a9961f954f70ba4d79c0a9ca5ae226e1831d72fe80",
467strip_prefix = "libedgetpu-3164995622300286ef2bb14d7fdc2792dae045b7",
468urls = [
469"https://github.com/google-coral/libedgetpu/archive/3164995622300286ef2bb14d7fdc2792dae045b7.tar.gz"
470],
471)
472load("@libedgetpu//:workspace.bzl", "libedgetpu_dependencies")
473libedgetpu_dependencies()
474
475load("@coral_crosstool//:configure.bzl", "cc_crosstool")
476cc_crosstool(name = "crosstool")
477
478# ------------- End mediapipe dependencies ----------------
479