From c565e266d8384fdf29311f5155716e41b9e2290b Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Thu, 3 Apr 2025 18:54:56 +1300 Subject: [PATCH 01/10] Bazel add default compliation args for opt and debug. Can be overriden --- bazel/config/BUILD.bazel | 10 +++++++ bazel/constraint/BUILD.bazel | 10 +++++++ bazel/toolchain/BUILD.bazel | 53 ++++++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 3d75654eb..2f0f0e6d5 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -294,3 +294,13 @@ label_flag( name = "PICO_FREERTOS_LIB", build_setting_default = "//bazel:empty_cc_lib", ) + +bool_flag( + name = "PICO_COMPILATION_OPT_OVERRIDE", + build_setting_default = False, +) + +bool_flag( + name = "PICO_COMPILATION_DEBUG_OVERRIDE", + build_setting_default = False, +) diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index a4fe918b8..3afb197f2 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -252,3 +252,13 @@ label_flag_matches( flag = "//bazel/config:PICO_FREERTOS_LIB", value = "//bazel:empty_cc_lib", ) + +config_setting( + name = "pico_compiliation_opt_override", + flag_values = {"//bazel/config:PICO_COMPILATION_OPT_OVERRIDE": "True"}, +) + +config_setting( + name = "pico_compiliation_debug_override", + flag_values = {"//bazel/config:PICO_COMPILATION_DEBUG_OVERRIDE": "True"}, +) \ No newline at end of file diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index ba8d947ca..80bb9104a 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -89,15 +89,33 @@ cc_args( ) cc_args( - name = "opt_debug_args", + name = "debug_args", actions = [ "@rules_cc//cc/toolchains/actions:compile_actions", "@rules_cc//cc/toolchains/actions:link_actions", ], - args = [ - "-Og", # TODO: Make this configurable. - "-g3", + args = select({ + "//bazel/constraint:pico_compiliation_debug_override": [], + "//conditions:default": [ + "-Og", + "-g3", + ], + }) +) + +cc_args( + name = "opt_args", + actions = [ + "@rules_cc//cc/toolchains/actions:compile_actions", + "@rules_cc//cc/toolchains/actions:link_actions", ], + args = select({ + "//bazel/constraint:pico_compiliation_opt_override": [], + "//conditions:default": [ + "-O2", + "-DNDEBUG", + ], + }) ) configurable_toolchain_feature( @@ -134,16 +152,27 @@ configurable_toolchain_feature( # TODO: Make this shim unnecessary. cc_args_list( - name = "all_opt_debug_args", - args = [":opt_debug_args"], + name = "all_debug_args", + args = [":debug_args"], +) + +cc_args_list( + name = "all_opt_args", + args = [":opt_args"], ) cc_feature( - name = "override_debug", - args = [":all_opt_debug_args"], + name = "dbg", + args = [":all_debug_args"], overrides = "@rules_cc//cc/toolchains/features:dbg", ) +cc_feature( + name = "opt", + args = [":all_opt_args"], + overrides = "@rules_cc//cc/toolchains/features:opt", +) + HOSTS = ( ("linux", "x86_64"), ("linux", "aarch64"), @@ -180,7 +209,8 @@ _HOST_CPU_CONSTRAINTS = { tags = ["manual"], # Don't try to build this in wildcard builds. known_features = [ "@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features", - "@pico-sdk//bazel/toolchain:override_debug", + "@pico-sdk//bazel/toolchain:dbg", + "@pico-sdk//bazel/toolchain:opt", "@pico-sdk//bazel/toolchain:gc_sections", "@pico-sdk//bazel/toolchain:cxx_no_exceptions", "@pico-sdk//bazel/toolchain:cxx_no_rtti", @@ -189,7 +219,6 @@ _HOST_CPU_CONSTRAINTS = { ], enabled_features = [ "@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features", - "@pico-sdk//bazel/toolchain:override_debug", ] + select({ "//bazel/constraint:pico_no_gc_sections_enabled": [], "//conditions:default": [":gc_sections"], @@ -232,7 +261,8 @@ _HOST_CPU_CONSTRAINTS = { tags = ["manual"], # Don't try to build this in wildcard builds. known_features = [ "@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features", - "@pico-sdk//bazel/toolchain:override_debug", + "@pico-sdk//bazel/toolchain:dbg", + "@pico-sdk//bazel/toolchain:opt", "@pico-sdk//bazel/toolchain:gc_sections", "@pico-sdk//bazel/toolchain:cxx_no_exceptions", "@pico-sdk//bazel/toolchain:cxx_no_rtti", @@ -241,7 +271,6 @@ _HOST_CPU_CONSTRAINTS = { ], enabled_features = [ "@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features", - "@pico-sdk//bazel/toolchain:override_debug", ] + select({ "//bazel/constraint:pico_no_gc_sections_enabled": [], "//conditions:default": [":gc_sections"], From 39dc067a427741b6585bdd9cc00f191a83ffe6cd Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 09:27:33 +1300 Subject: [PATCH 02/10] Add docstrings for new compilation mode override flags --- bazel/config/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 2f0f0e6d5..1abd08ed5 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -295,11 +295,13 @@ label_flag( build_setting_default = "//bazel:empty_cc_lib", ) +# PICO_BAZEL_CONFIG: PICO_COMPILATION_OPT_OVERRIDE, Override the default opt compilation mode arguments to none, type=bool, default=0, group=build bool_flag( name = "PICO_COMPILATION_OPT_OVERRIDE", build_setting_default = False, ) +# PICO_BAZEL_CONFIG: PICO_COMPILATION_DEBUG_OVERRIDE, Override the default dbg compilation mode arguments to none, type=bool, default=0, group=build bool_flag( name = "PICO_COMPILATION_DEBUG_OVERRIDE", build_setting_default = False, From f9567724ad87f06d9e20e19f75dc4aa56660dafb Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 09:28:51 +1300 Subject: [PATCH 03/10] Remove cc_args_list shims, which arent needed anymore for cc_feature --- bazel/toolchain/BUILD.bazel | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index 80bb9104a..1539c3edf 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -150,26 +150,16 @@ configurable_toolchain_feature( linkopts = ["-Wl,-z,max-page-size=4096"], ) -# TODO: Make this shim unnecessary. -cc_args_list( - name = "all_debug_args", - args = [":debug_args"], -) - -cc_args_list( - name = "all_opt_args", - args = [":opt_args"], -) cc_feature( name = "dbg", - args = [":all_debug_args"], + args = [":debug_args"], overrides = "@rules_cc//cc/toolchains/features:dbg", ) cc_feature( name = "opt", - args = [":all_opt_args"], + args = [":opt_args"], overrides = "@rules_cc//cc/toolchains/features:opt", ) From 525aa9414295d6e7d5c7696d828c13460e90d5e9 Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 09:29:24 +1300 Subject: [PATCH 04/10] Add Compilation mode overrides to the BAZEL_ONLY_ALLOWLIST, these dont exist in Cmake --- tools/compare_build_systems.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/compare_build_systems.py b/tools/compare_build_systems.py index badeadee1..7c570f938 100755 --- a/tools/compare_build_systems.py +++ b/tools/compare_build_systems.py @@ -157,6 +157,9 @@ "PICO_BT_ENABLE_BLE", "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_DEBUG_OVERRIDE", + "PICO_COMPILATION_OPT_OVERRIDE", ) From e346e6da5b574cca06a3feef2192d38516586359 Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 09:31:57 +1300 Subject: [PATCH 05/10] For completness add the fastbuild default options, and override flag --- bazel/config/BUILD.bazel | 6 ++++++ bazel/constraint/BUILD.bazel | 5 +++++ bazel/toolchain/BUILD.bazel | 24 ++++++++++++++++++++++++ tools/compare_build_systems.py | 1 + 4 files changed, 36 insertions(+) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 1abd08ed5..d04c18d35 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -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, +) \ No newline at end of file diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index 3afb197f2..27062fa49 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -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"}, ) \ No newline at end of file diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index 1539c3edf..f0614efbd 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -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", diff --git a/tools/compare_build_systems.py b/tools/compare_build_systems.py index 7c570f938..f148ab0ba 100755 --- a/tools/compare_build_systems.py +++ b/tools/compare_build_systems.py @@ -158,6 +158,7 @@ "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", ) From f5b3b9f9ca3843f3eb4c69a08e9f8571d9cfa8c4 Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 10:18:12 +1300 Subject: [PATCH 06/10] Remove the default options for fastbuiild, as the bazel doc defaults didnt make much sense, nor work. Leaving these for completness and future addition --- bazel/toolchain/BUILD.bazel | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index f0614efbd..05135fc06 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -126,11 +126,8 @@ cc_args( ], args = select({ "//bazel/constraint:pico_compiliation_fastbuild_override": [], - "//conditions:default": [ - "-gmlt", - "-Wl", - "-S", - ], + # The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S. + "//conditions:default": [], }) ) From 9ac79e08ad50be5b13aa9788fa31a94d31341b0b Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Sat, 5 Apr 2025 13:16:52 +1300 Subject: [PATCH 07/10] Rename the config and constraint labels from OVERRIDE to REMOVE_DEFS --- bazel/config/BUILD.bazel | 12 ++++++------ bazel/constraint/BUILD.bazel | 12 ++++++------ bazel/toolchain/BUILD.bazel | 6 +++--- tools/compare_build_systems.py | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index d04c18d35..a80de995e 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -295,20 +295,20 @@ label_flag( build_setting_default = "//bazel:empty_cc_lib", ) -# PICO_BAZEL_CONFIG: PICO_COMPILATION_OPT_OVERRIDE, Override the default opt compilation mode arguments to none, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_OPT_REMOVE_DEFS, Remove the default opt compilation mode arguments, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_OPT_OVERRIDE", + name = "PICO_COMPILATION_OPT_REMOVE_DEFS", build_setting_default = False, ) -# PICO_BAZEL_CONFIG: PICO_COMPILATION_DEBUG_OVERRIDE, Override the default dbg compilation mode arguments to none, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_DEBUG_REMOVE_DEFS, Remove the default dbg compilation mode arguments, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_DEBUG_OVERRIDE", + name = "PICO_COMPILATION_DEBUG_REMOVE_DEFS", 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 +# PICO_BAZEL_CONFIG: PICO_COMPILATION_FASTBUILD_REMOVE_DEFS, Remove the default fastbuild compilation mode arguments, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_FASTBUILD_OVERRIDE", + name = "PICO_COMPILATION_FASTBUILD_REMOVE_DEFS", build_setting_default = False, ) \ No newline at end of file diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index 27062fa49..4717b1a7c 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -254,16 +254,16 @@ label_flag_matches( ) config_setting( - name = "pico_compiliation_opt_override", - flag_values = {"//bazel/config:PICO_COMPILATION_OPT_OVERRIDE": "True"}, + name = "pico_compiliation_opt_remove_defs", + flag_values = {"//bazel/config:PICO_COMPILATION_OPT_REMOVE_DEFS": "True"}, ) config_setting( - name = "pico_compiliation_debug_override", - flag_values = {"//bazel/config:PICO_COMPILATION_DEBUG_OVERRIDE": "True"}, + name = "pico_compiliation_debug_remove_defs", + flag_values = {"//bazel/config:PICO_COMPILATION_DEBUG_REMOVE_DEFS": "True"}, ) config_setting( - name = "pico_compiliation_fastbuild_override", - flag_values = {"//bazel/config:PICO_COMPILATION_FASTBUILD_OVERRIDE": "True"}, + name = "pico_compiliation_fastbuild_remove_defs", + flag_values = {"//bazel/config:PICO_COMPILATION_FASTBUILD_REMOVE_DEFS": "True"}, ) \ No newline at end of file diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index 05135fc06..0d080cf96 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -95,7 +95,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_debug_override": [], + "//bazel/constraint:pico_compiliation_debug_remove_defs": [], "//conditions:default": [ "-Og", "-g3", @@ -110,7 +110,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_opt_override": [], + "//bazel/constraint:pico_compiliation_opt_remove_defs": [], "//conditions:default": [ "-O2", "-DNDEBUG", @@ -125,7 +125,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_fastbuild_override": [], + "//bazel/constraint:pico_compiliation_fastbuild_remove_defs": [], # The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S. "//conditions:default": [], }) diff --git a/tools/compare_build_systems.py b/tools/compare_build_systems.py index f148ab0ba..3a45879c0 100755 --- a/tools/compare_build_systems.py +++ b/tools/compare_build_systems.py @@ -157,10 +157,10 @@ "PICO_BT_ENABLE_BLE", "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", + # Compilation modes remove, These allow the user to remove the defaults, with no args. See --compilation_mode cmd line option + "PICO_COMPILATION_FASTBUILD_REMOVE_DEFS", + "PICO_COMPILATION_DEBUG_REMOVE_DEFS", + "PICO_COMPILATION_OPT_REMOVE_DEFS", ) From 0bbbe6d19a7c27fd723b9e31bf1611db759441bc Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Mon, 14 Apr 2025 18:14:47 +1200 Subject: [PATCH 08/10] Change naming of flags from PICO_COMPILATION_XXX_REMOVE_DEFS to PICO_COMPILATION_NO_XXX_ARGS for OPT, FASTBUILD & DEBUG variants --- bazel/config/BUILD.bazel | 14 ++++++-------- bazel/constraint/BUILD.bazel | 12 ++++++------ bazel/toolchain/BUILD.bazel | 6 +++--- tools/compare_build_systems.py | 6 +++--- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 17a9e303f..9ba113cd3 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -300,21 +300,19 @@ label_flag( name = "PICO_MBEDTLS_CONFIG", build_setting_default = "//bazel:empty_cc_lib", ) - -# PICO_BAZEL_CONFIG: PICO_COMPILATION_OPT_REMOVE_DEFS, Remove the default opt compilation mode arguments, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_OPT_ARGS, Makes the opt compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_OPT_REMOVE_DEFS", + name = "PICO_COMPILATION_NO_OPT_ARGS", build_setting_default = False, ) - -# PICO_BAZEL_CONFIG: PICO_COMPILATION_DEBUG_REMOVE_DEFS, Remove the default dbg compilation mode arguments, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_DEBUG_ARGS, Makes the debug compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_DEBUG_REMOVE_DEFS", + name = "PICO_COMPILATION_NO_DEBUG_ARGS", build_setting_default = False, ) -# PICO_BAZEL_CONFIG: PICO_COMPILATION_FASTBUILD_REMOVE_DEFS, Remove the default fastbuild compilation mode arguments, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_FASTBUILD_ARGS, Makes the fastbuild compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( - name = "PICO_COMPILATION_FASTBUILD_REMOVE_DEFS", + name = "PICO_COMPILATION_NO_FASTBUILD_ARGS", build_setting_default = False, ) diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index 9358581ae..9cca5d399 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -260,16 +260,16 @@ label_flag_matches( ) config_setting( - name = "pico_compiliation_opt_remove_defs", - flag_values = {"//bazel/config:PICO_COMPILATION_OPT_REMOVE_DEFS": "True"}, + name = "pico_compiliation_no_opt_args_set", + flag_values = {"//bazel/config:PICO_COMPILATION_NO_OPT_ARGS": "True"}, ) config_setting( - name = "pico_compiliation_debug_remove_defs", - flag_values = {"//bazel/config:PICO_COMPILATION_DEBUG_REMOVE_DEFS": "True"}, + name = "pico_compiliation_no_debug_args_set", + flag_values = {"//bazel/config:PICO_COMPILATION_NO_DEBUG_ARGS": "True"}, ) config_setting( - name = "pico_compiliation_fastbuild_remove_defs", - flag_values = {"//bazel/config:PICO_COMPILATION_FASTBUILD_REMOVE_DEFS": "True"}, + name = "pico_compiliation_no_fastbuild_args_set", + flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASBUILD_ARGS": "True"}, ) diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index 0d080cf96..c960f02e8 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -95,7 +95,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_debug_remove_defs": [], + "//bazel/constraint:pico_compiliation_no_debug_args_set": [], "//conditions:default": [ "-Og", "-g3", @@ -110,7 +110,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_opt_remove_defs": [], + "//bazel/constraint:pico_compiliation_no_opt_args_set": [], "//conditions:default": [ "-O2", "-DNDEBUG", @@ -125,7 +125,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_fastbuild_remove_defs": [], + "//bazel/constraint:pico_compiliation_no_fastbuild_args_set": [], # The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S. "//conditions:default": [], }) diff --git a/tools/compare_build_systems.py b/tools/compare_build_systems.py index 53d7e92d5..583e51838 100755 --- a/tools/compare_build_systems.py +++ b/tools/compare_build_systems.py @@ -159,9 +159,9 @@ "PICO_BT_ENABLE_CLASSIC", "PICO_BT_ENABLE_MESH", # Compilation modes remove, These allow the user to remove the defaults, with no args. See --compilation_mode cmd line option - "PICO_COMPILATION_FASTBUILD_REMOVE_DEFS", - "PICO_COMPILATION_DEBUG_REMOVE_DEFS", - "PICO_COMPILATION_OPT_REMOVE_DEFS", + "PICO_COMPILATION_NO_OPT_ARGS", + "PICO_COMPILATION_NO_DEBUG_ARGS", + "PICO_COMPILATION_NO_FASTBUILD_ARGS", ) From c7b4c9b88a1daba7f59f24e0b578581c58e75473 Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Tue, 15 Apr 2025 19:08:22 +1200 Subject: [PATCH 09/10] Fixup spellling mistakes, and comments --- bazel/config/BUILD.bazel | 6 ++++-- bazel/constraint/BUILD.bazel | 6 +++--- bazel/toolchain/BUILD.bazel | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 9ba113cd3..b27cbdd54 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -300,18 +300,20 @@ label_flag( name = "PICO_MBEDTLS_CONFIG", build_setting_default = "//bazel:empty_cc_lib", ) + # PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_OPT_ARGS, Makes the opt compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( name = "PICO_COMPILATION_NO_OPT_ARGS", build_setting_default = False, ) -# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_DEBUG_ARGS, Makes the debug compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build + +# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_DEBUG_ARGS, Makes the debug compilation mode a no-op so custom debug arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( name = "PICO_COMPILATION_NO_DEBUG_ARGS", build_setting_default = False, ) -# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_FASTBUILD_ARGS, Makes the fastbuild compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build +# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_FASTBUILD_ARGS, Makes the fastbuild compilation mode a no-op so custom fastbuild arguments can be injected via the --copt flag instead, type=bool, default=0, group=build bool_flag( name = "PICO_COMPILATION_NO_FASTBUILD_ARGS", build_setting_default = False, diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index 9cca5d399..3fdda613a 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -260,16 +260,16 @@ label_flag_matches( ) config_setting( - name = "pico_compiliation_no_opt_args_set", + name = "pico_compilation_no_opt_args_set", flag_values = {"//bazel/config:PICO_COMPILATION_NO_OPT_ARGS": "True"}, ) config_setting( - name = "pico_compiliation_no_debug_args_set", + name = "pico_compilation_no_debug_args_set", flag_values = {"//bazel/config:PICO_COMPILATION_NO_DEBUG_ARGS": "True"}, ) config_setting( - name = "pico_compiliation_no_fastbuild_args_set", + name = "pico_compilation_no_fastbuild_args_set", flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASBUILD_ARGS": "True"}, ) diff --git a/bazel/toolchain/BUILD.bazel b/bazel/toolchain/BUILD.bazel index c960f02e8..dacd35389 100644 --- a/bazel/toolchain/BUILD.bazel +++ b/bazel/toolchain/BUILD.bazel @@ -95,7 +95,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_no_debug_args_set": [], + "//bazel/constraint:pico_compilation_no_debug_args_set": [], "//conditions:default": [ "-Og", "-g3", @@ -110,7 +110,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_no_opt_args_set": [], + "//bazel/constraint:pico_compilation_no_opt_args_set": [], "//conditions:default": [ "-O2", "-DNDEBUG", @@ -125,7 +125,7 @@ cc_args( "@rules_cc//cc/toolchains/actions:link_actions", ], args = select({ - "//bazel/constraint:pico_compiliation_no_fastbuild_args_set": [], + "//bazel/constraint:pico_compilation_no_fastbuild_args_set": [], # The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S. "//conditions:default": [], }) From 55344e62e36447287b896c0b8f1a1325b7bdd636 Mon Sep 17 00:00:00 2001 From: Brad Nolan Date: Tue, 22 Apr 2025 11:49:19 +1200 Subject: [PATCH 10/10] Fix typo PICO_COMPILATION_NO_FASBUILD_ARGS to FASTBUILD --- bazel/constraint/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/constraint/BUILD.bazel b/bazel/constraint/BUILD.bazel index 3fdda613a..acd112469 100644 --- a/bazel/constraint/BUILD.bazel +++ b/bazel/constraint/BUILD.bazel @@ -271,5 +271,5 @@ config_setting( config_setting( name = "pico_compilation_no_fastbuild_args_set", - flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASBUILD_ARGS": "True"}, + flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASTBUILD_ARGS": "True"}, )