Skip to content

Commit

Permalink
Improve consistency in tensorstore/third_party bazel configs
Browse files Browse the repository at this point in the history
* Rename remaining bundled.BUILD.bazel to <lib>.BUILD.bazel
* Improve consistency bazel config_setting use

PiperOrigin-RevId: 572719306
Change-Id: I694fd02e43e3da59bdf9fcd0d8b9e1f3d3c36f90
  • Loading branch information
laramiel authored and copybara-github committed Oct 11, 2023
1 parent eb69315 commit 40ed51c
Show file tree
Hide file tree
Showing 23 changed files with 72 additions and 96 deletions.
61 changes: 14 additions & 47 deletions third_party/blake3/blake3.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cc_library(
"c/blake3_sse2_x86-64_windows_msvc.asm",
"c/blake3_sse41_x86-64_windows_msvc.asm",
],
":windows_x86_64_mingw-gcc": [
":windows_x86_64_mingw_gcc": [
"c/blake3_avx2_x86-64_windows_gnu.S",
"c/blake3_avx512_x86-64_windows_gnu.S",
"c/blake3_sse2_x86-64_windows_gnu.S",
Expand All @@ -26,7 +26,7 @@ cc_library(
"@platforms//cpu:arm64": [
"c/blake3_neon.c",
],
("linux_x86_64", "macos_x86_64"): [
(":linux_x86_64", ":macos_x86_64"): [
"c/blake3_avx2_x86-64_unix.S",
"c/blake3_avx512_x86-64_unix.S",
"c/blake3_sse2_x86-64_unix.S",
Expand All @@ -41,48 +41,15 @@ cc_library(
visibility = ["//visibility:public"],
)

config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)

config_setting(
name = "compiler_mingw-gcc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "mingw-gcc",
},
)

selects.config_setting_group(
name = "windows_x86_64_msvc",
match_all = [
"@platforms//cpu:x86_64",
":compiler_msvc",
],
)

selects.config_setting_group(
name = "windows_x86_64_mingw-gcc",
match_all = [
"@platforms//cpu:x86_64",
":compiler_mingw-gcc",
],
)

selects.config_setting_group(
name = "linux_x86_64",
match_all = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
)

selects.config_setting_group(
name = "macos_x86_64",
match_all = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
)
[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"linux_x86_64",
"macos_x86_64",
"windows_x86_64_msvc",
"windows_x86_64_mingw_gcc",
]
]
2 changes: 1 addition & 1 deletion third_party/com_github_nlohmann_json/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def repo():
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/nlohmann/json/releases/download/v3.10.5/include.zip",
],
sha256 = "b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e",
build_file = Label("//third_party:com_github_nlohmann_json/bundled.BUILD.bazel"),
build_file = Label("//third_party:com_github_nlohmann_json/nlohmann_json.BUILD.bazel"),
system_build_file = Label("//third_party:com_github_nlohmann_json/system.BUILD.bazel"),
# documentation-only
doc_name = "nlohmann/json",
Expand Down
2 changes: 1 addition & 1 deletion third_party/com_github_pybind_pybind11/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def repo():
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/pybind/pybind11/archive/v2.10.1.tar.gz",
],
sha256 = "111014b516b625083bef701df7880f78c2243835abdb263065b6b59b960b6bad",
build_file = Label("//third_party:com_github_pybind_pybind11/bundled.BUILD.bazel"),
build_file = Label("//third_party:com_github_pybind_pybind11/pybind11.BUILD.bazel"),
system_build_file = Label("//third_party:com_github_pybind_pybind11/system.BUILD.bazel"),
# documentation-only
doc_name = "pybind11",
Expand Down
2 changes: 1 addition & 1 deletion third_party/com_google_snappy/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def repo():
],
sha256 = "2e458b7017cd58dcf1469ab315389e85e7f445bd035188f2983f81fb19ecfb29",
strip_prefix = "snappy-984b191f0fefdeb17050b42a90b7625999c13b8d",
build_file = Label("//third_party:com_google_snappy/bundled.BUILD.bazel"),
build_file = Label("//third_party:com_google_snappy/snappy.BUILD.bazel"),
system_build_file = Label("//third_party:com_google_snappy/system.BUILD.bazel"),
cmake_name = "Snappy",
bazel_to_cmake = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,12 @@ config_setting(
values = {"cpu": "armeabi-v7a"},
)

config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)
[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"compiler_msvc",
]
]
2 changes: 1 addition & 1 deletion third_party/jpeg/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def repo():
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.4.tar.gz",
],
sha256 = "a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f",
build_file = Label("//third_party:jpeg/bundled.BUILD.bazel"),
build_file = Label("//third_party:jpeg/jpeg.BUILD.bazel"),
system_build_file = Label("//third_party:jpeg/system.BUILD.bazel"),
cmake_name = "JPEG",
# libjpeg-turbo maintainers do not wish to support subproject builds
Expand Down
15 changes: 9 additions & 6 deletions third_party/libtiff/libtiff.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,12 @@ write_file(
newline = "unix",
)

config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)
[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"compiler_msvc",
]
]
2 changes: 1 addition & 1 deletion third_party/net_sourceforge_half/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def repo():
"https://sourceforge.net/projects/half/files/half/2.1.0/half-2.1.0.zip",
],
sha256 = "ad1788afe0300fa2b02b0d1df128d857f021f92ccf7c8bddd07812685fa07a25",
build_file = Label("//third_party:net_sourceforge_half/bundled.BUILD.bazel"),
build_file = Label("//third_party:net_sourceforge_half/half.BUILD.bazel"),
patches = [
# https://sourceforge.net/p/half/discussion/general/thread/86298c105c/
Label("//third_party:net_sourceforge_half/patches/detail_raise.patch"),
Expand Down
2 changes: 1 addition & 1 deletion third_party/net_zstd/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def repo():
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/facebook/zstd/archive/v1.5.5.zip",
],
sha256 = "c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51",
build_file = Label("//third_party:net_zstd/bundled.BUILD.bazel"),
build_file = Label("//third_party:net_zstd/zstd.BUILD.bazel"),
system_build_file = Label("//third_party:net_zstd/system.BUILD.bazel"),
cmake_name = "Zstd",
bazel_to_cmake = {},
Expand Down
File renamed without changes.
32 changes: 11 additions & 21 deletions third_party/org_aomedia_aom/libaom.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -538,27 +538,17 @@ GENERATED_CONFIGS = [
]

# Config settings

config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)

config_setting(
name = "compiler_clang",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "clang",
},
)

config_setting(
name = "compiler_mingw_gcc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "mingw-gcc",
},
)
[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"compiler_msvc",
"compiler_mingw_gcc",
"compiler_clang",
]
]

# Constraint that indicates whether avx2 intrinsics can be used (subject to
# runtime CPU detection).
Expand Down
12 changes: 11 additions & 1 deletion third_party/org_aomedia_avif/libavif.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cc_library(
"include/avif/*.h",
]),
copts = select({
"@tensorstore//:compiler_msvc": [],
":compiler_msvc": [],
"//conditions:default": [
"-Wno-incompatible-pointer-types",
],
Expand All @@ -47,3 +47,13 @@ cc_library(
"@org_videolan_dav1d//:dav1d",
],
)

[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"compiler_msvc",
]
]
File renamed without changes.
2 changes: 1 addition & 1 deletion third_party/org_lz4/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def repo():
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/lz4/lz4/archive/v1.9.4.zip",
],
sha256 = "37e63d56fb9cbe2e430c7f737a404cd4b98637b05e1467459d5c8fe1a4364cc3",
build_file = Label("//third_party:org_lz4/bundled.BUILD.bazel"),
build_file = Label("//third_party:org_lz4/lz4.BUILD.bazel"),
system_build_file = Label("//third_party:org_lz4/system.BUILD.bazel"),
cmake_name = "LZ4",
cmake_target_mapping = {
Expand Down
2 changes: 1 addition & 1 deletion third_party/org_sourceware_bzip2/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def repo():
],
strip_prefix = "bzip2-1.0.8",
sha256 = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269",
build_file = Label("//third_party:org_sourceware_bzip2/bundled.BUILD.bazel"),
build_file = Label("//third_party:org_sourceware_bzip2/bzip2.BUILD.bazel"),
system_build_file = Label("//third_party:org_sourceware_bzip2/system.BUILD.bazel"),
cmake_name = "BZip2",
cmake_languages = ["C"],
Expand Down
2 changes: 1 addition & 1 deletion third_party/org_tukaani_xz/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def repo():
"https://tukaani.org/xz/xz-5.3.3alpha.tar.gz",
],
sha256 = "c6d4789a79bab565440784db2e132d6bf03b2e75dd6d66a8102cf002d8dfe926",
build_file = Label("//third_party:org_tukaani_xz/bundled.BUILD.bazel"),
build_file = Label("//third_party:org_tukaani_xz/xz.BUILD.bazel"),
system_build_file = Label("//third_party:org_tukaani_xz/system.BUILD.bazel"),
doc_homepage = "https://tukaani.org/xz/",
cmake_name = "LibLZMA",
Expand Down
File renamed without changes.
15 changes: 9 additions & 6 deletions third_party/org_videolan_dav1d/dav1d.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,12 @@ write_file(
newline = "unix",
)

config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)
[
alias(
name = name,
actual = "@tensorstore//:{target}".format(target = name),
)
for name in [
"compiler_msvc",
]
]

0 comments on commit 40ed51c

Please sign in to comment.