Skip to content

Commit

Permalink
Merge pull request #575 from hofbi/add_extra_flags_per_feature
Browse files Browse the repository at this point in the history
Add extra_flags_per_feature to cc toolchain
  • Loading branch information
mergify[bot] authored Aug 26, 2024
2 parents c061458 + 0d7f271 commit a11818b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion toolchains/cc/cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ using `nixpkgs_cc_configure(..., cc_lang = "cuda")` or similar.
* [nixpkgs_cc_configure](#nixpkgs_cc_configure)
"""

load("@bazel_skylib//lib:sets.bzl", "sets")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load(
"@bazel_tools//tools/cpp:lib_cc_configure.bzl",
"get_cpu_value",
"get_starlark_list",
"write_builtin_include_directory_paths",
)
load("@bazel_skylib//lib:sets.bzl", "sets")
load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_package")
load(
"@rules_nixpkgs_core//:util.bzl",
Expand Down Expand Up @@ -78,6 +78,7 @@ def _parse_cc_toolchain_info(content, filename):
"COVERAGE_COMPILE_FLAGS",
"COVERAGE_LINK_FLAGS",
"SUPPORTS_START_END_LIB",
"EXTRA_FLAGS_PER_FEATURE",
"IS_CLANG",
"CONLY_FLAGS",
])
Expand Down Expand Up @@ -118,6 +119,7 @@ def _parse_cc_toolchain_info(content, filename):
coverage_compile_flags = info["COVERAGE_COMPILE_FLAGS"],
coverage_link_flags = info["COVERAGE_LINK_FLAGS"],
supports_start_end_lib = info["SUPPORTS_START_END_LIB"] == ["True"],
extra_flags_per_feature = info["EXTRA_FLAGS_PER_FEATURE"],
is_clang = info["IS_CLANG"] == ["True"],
conly_flags = info["CONLY_FLAGS"],
)
Expand Down Expand Up @@ -219,6 +221,7 @@ def _nixpkgs_cc_toolchain_config_impl(repository_ctx):
"%{coverage_compile_flags}": get_starlark_list(info.coverage_compile_flags),
"%{coverage_link_flags}": get_starlark_list(info.coverage_link_flags),
"%{supports_start_end_lib}": repr(info.supports_start_end_lib),
"%{extra_flags_per_feature}": repr(info.extra_flags_per_feature),
"%{conly_flags}": get_starlark_list(info.conly_flags),
},
)
Expand Down
2 changes: 2 additions & 0 deletions toolchains/cc/cc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ pkgs.runCommand "bazel-${cc.orignalName or cc.name}-toolchain"
if [[ -x ${cc}/bin/ld.gold ]]; then echo True; else echo False; fi
)
)
EXTRA_FLAGS_PER_FEATURE=()
IS_CLANG=(
${if cc.isClang then "True" else "False"}
)
Expand Down Expand Up @@ -332,6 +333,7 @@ pkgs.runCommand "bazel-${cc.orignalName or cc.name}-toolchain"
write_info COVERAGE_COMPILE_FLAGS
write_info COVERAGE_LINK_FLAGS
write_info SUPPORTS_START_END_LIB
write_info EXTRA_FLAGS_PER_FEATURE
write_info IS_CLANG
write_info CONLY_FLAGS
''

0 comments on commit a11818b

Please sign in to comment.