For completness add the fastbuild default options, and override flag

This commit is contained in:
Brad Nolan 2025-04-05 09:31:57 +13:00
parent 525aa94142
commit e346e6da5b
4 changed files with 36 additions and 0 deletions

View File

@ -306,3 +306,9 @@ bool_flag(
name = "PICO_COMPILATION_DEBUG_OVERRIDE",
build_setting_default = False,
)
# PICO_BAZEL_CONFIG: PICO_COMPILATION_FASTBUILD_OVERRIDE, Override the default fastbuild compilation mode arguments to none, type=bool, default=0, group=build
bool_flag(
name = "PICO_COMPILATION_FASTBUILD_OVERRIDE",
build_setting_default = False,
)

View File

@ -261,4 +261,9 @@ config_setting(
config_setting(
name = "pico_compiliation_debug_override",
flag_values = {"//bazel/config:PICO_COMPILATION_DEBUG_OVERRIDE": "True"},
)
config_setting(
name = "pico_compiliation_fastbuild_override",
flag_values = {"//bazel/config:PICO_COMPILATION_FASTBUILD_OVERRIDE": "True"},
)

View File

@ -118,6 +118,22 @@ cc_args(
})
)
cc_args(
name = "fastbuild_args",
actions = [
"@rules_cc//cc/toolchains/actions:compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = select({
"//bazel/constraint:pico_compiliation_fastbuild_override": [],
"//conditions:default": [
"-gmlt",
"-Wl",
"-S",
],
})
)
configurable_toolchain_feature(
name = "gc_sections",
copts = [
@ -163,6 +179,12 @@ cc_feature(
overrides = "@rules_cc//cc/toolchains/features:opt",
)
cc_feature(
name = "fastbuild",
args = [":fastbuild_args"],
overrides = "@rules_cc//cc/toolchains/features:fastbuild",
)
HOSTS = (
("linux", "x86_64"),
("linux", "aarch64"),
@ -201,6 +223,7 @@ _HOST_CPU_CONSTRAINTS = {
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:dbg",
"@pico-sdk//bazel/toolchain:opt",
"@pico-sdk//bazel/toolchain:fastbuild",
"@pico-sdk//bazel/toolchain:gc_sections",
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
@ -253,6 +276,7 @@ _HOST_CPU_CONSTRAINTS = {
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
"@pico-sdk//bazel/toolchain:dbg",
"@pico-sdk//bazel/toolchain:opt",
"@pico-sdk//bazel/toolchain:fastbuild",
"@pico-sdk//bazel/toolchain:gc_sections",
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
"@pico-sdk//bazel/toolchain:cxx_no_rtti",

View File

@ -158,6 +158,7 @@ BAZEL_ONLY_ALLOWLIST = (
"PICO_BT_ENABLE_CLASSIC",
"PICO_BT_ENABLE_MESH",
# Compilation modes overrides, These allow the user to override the defaults, with no args. See --compilation_mode cmd line option
"PICO_COMPILATION_FASTBUILD_OVERRIDE",
"PICO_COMPILATION_DEBUG_OVERRIDE",
"PICO_COMPILATION_OPT_OVERRIDE",
)