-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[bazel] Use zstd from the BCR #169146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+95
−40
Merged
[bazel] Use zstd from the BCR #169146
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a49686c
[bazel] Use zstd from the BCR
keith 1bc54ad
Add cc_library_wrapper
keith c982f51
remove empty_lib
keith f38b55d
set visibility
keith 7c72791
label typo
keith 5c60057
Advertise CcInfo for cc_shared_library
keith 350e17b
add zstd.BUILD back
keith c58ddc1
public
keith 250fd90
dedup zstd configuration flags
keith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # This file is licensed under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") | ||
| load(":cc_library_wrapper.bzl", "cc_library_wrapper") | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| bool_flag( | ||
| name = "llvm_enable_zstd", | ||
| build_setting_default = True, | ||
| ) | ||
|
|
||
| config_setting( | ||
| name = "llvm_zstd_enabled", | ||
| flag_values = {":llvm_enable_zstd": "true"}, | ||
| ) | ||
|
|
||
| cc_library_wrapper( | ||
| name = "zstd", | ||
| defines = select({ | ||
| ":llvm_zstd_enabled": [ | ||
| "LLVM_ENABLE_ZSTD=1", | ||
| "ZSTD_MULTITHREAD", | ||
| ], | ||
| "//conditions:default": [], | ||
| }), | ||
| deps = select({ | ||
| ":llvm_zstd_enabled": [ | ||
| "@llvm_zstd//:zstd", | ||
| ], | ||
| "//conditions:default": [], | ||
| }), | ||
| ) |
50 changes: 50 additions & 0 deletions
50
utils/bazel/llvm-project-overlay/third-party/cc_library_wrapper.bzl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # This file is licensed under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| """Re-export a cc_library with added LLVM specific settings. | ||
|
|
||
| This re-exports the dependent libraries in a way that satisfies layering_check | ||
|
|
||
| cc_library_wrapper( | ||
| name = "library_wrapper", | ||
| deps = [ | ||
| "@example//:library", | ||
| ], | ||
| defines = [ | ||
| "LLVM_ENABLE_EXAMPLE=1", | ||
| ], | ||
| ) | ||
| """ | ||
|
|
||
| load("@rules_cc//cc/common:cc_common.bzl", "cc_common") | ||
| load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") | ||
|
|
||
| visibility("private") | ||
|
|
||
| def _cc_library_wrapper_impl(ctx): | ||
| all_cc_infos = [dep[CcInfo] for dep in ctx.attr.deps] | ||
| if ctx.attr.defines: | ||
| all_cc_infos.append(CcInfo( | ||
| compilation_context = cc_common.create_compilation_context( | ||
| defines = depset(ctx.attr.defines), | ||
| ), | ||
| )) | ||
|
|
||
| return cc_common.merge_cc_infos(direct_cc_infos = all_cc_infos) | ||
|
|
||
| cc_library_wrapper = rule( | ||
| implementation = _cc_library_wrapper_impl, | ||
| attrs = { | ||
| "deps": attr.label_list( | ||
| doc = "Dependencies to cc_library targets to re-export.", | ||
| providers = [CcInfo], | ||
| ), | ||
| "defines": attr.string_list( | ||
| doc = "Additional preprocessor definitions to add to all dependent targets.", | ||
| default = [], | ||
| ), | ||
| }, | ||
| doc = "Re-export a cc_library with added LLVM specific settings.", | ||
| provides = [CcInfo], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.