Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bazel/config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ label_flag(
build_setting_default = "//bazel:empty_cc_lib",
)

# PICO_BAZEL_CONFIG: PICO_MBEDTL_CONFIG, [Bazel only] The cc_library that provides mbedtls_config.h, default=//bazel:empty_cc_lib, group=pico_mbedtls
# PICO_BAZEL_CONFIG: PICO_MBEDTLS_CONFIG, [Bazel only] The cc_library that provides mbedtls_config.h, default=//bazel:empty_cc_lib, group=pico_mbedtls
label_flag(
name = "PICO_MBEDTLS_CONFIG",
build_setting_default = "//bazel:empty_cc_lib",
Expand Down
38 changes: 36 additions & 2 deletions tools/compare_build_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,18 @@
"PICO_TOOLCHAIN_PATH",
# Bazel uses native --platforms mechanics.
"PICO_PLATFORM",
"PICO_DEFAULT_PLATFORM",
"PICO_DEFAULT_RP2350_PLATFORM",
# Named PICO_TOOLCHAIN in Bazel.
"PICO_COMPILER",
# Bazel uses PICO_COMPILATION_NO_OPT_ARGS and PICO_COMPILATION_NO_DEBUG_ARGS
# to allow overriding these flags instead.
"PICO_DEOPTIMIZED_DEBUG",
"PICO_DEBUG_INFO_IN_RELEASE",
# Entirely irrelevant to Bazel, use Bazel toolchains:
# https://bazel.build/extending/toolchains
"PICO_TOOLCHAIN_DIR",
"PICO_GCC_TRIPLE",
# Entirely irrelevant to Bazel, use Bazel platforms:
# https://bazel.build/extending/platforms
"PICO_CMAKE_PRELOAD_PLATFORM_FILE",
Expand All @@ -81,22 +91,44 @@
"PICO_CONFIG_HEADER_FILES",
"PICO_RP2040_CONFIG_HEADER_FILES",
"PICO_HOST_CONFIG_HEADER_FILES",
"PICO_RP2350_ARM_S_CONFIG_HEADER_FILES",
"PICO_RP2350_RISCV_CONFIG_HEADER_FILES",
# Bazel uses PICO_CONFIG_HEADER.
"PICO_BOARD_CMAKE_DIRS",
"PICO_BOARD_HEADER_FILE",
"PICO_BOARD_HEADER_DIRS",
# Bazel handles default boards differently.
"PICO_DEFAULT_BOARD_rp2040",
"PICO_DEFAULT_BOARD_rp2350",
"PICO_DEFAULT_BOARD_host",
# Bazel doesn't provide a way of overriding the defaults for this.
# TODO: Provide a way to customise these toolchain flags.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be pretty easy. I'll take a look.

"PICO_HARD_FLOAT_ABI",
"PICO_NO_CMSE",
# Bazel supports this differently.
# TODO: Provide a helper rule for explicitly generating a UF2 so users don't
# have to write out a bespoke run_binary.
"PICO_NO_UF2",
"PICO_NO_COPRO_DIS",
"PICO_ALLOW_EXAMPLE_KEYS",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an explicit TODO: to add a similar option to Bazel?

# Bazel will not provide a default for this.
# TODO: Provide handy rules for PIOASM so users don't have to write out a
# bespoke run_binary.
"PICO_DEFAULT_PIOASM_OUTPUT_FORMAT",
# Bazel always has picotool.
"PICO_NO_PICOTOOL",
# These aren't supported as build flags in Bazel. Prefer to
# set these in board header files like other SDK defines.
# Bazel includes these differently.
"PICO_TINYUSB_PATH",
"PICO_BTSTACK_PATH",
"PICO_CYW43_DRIVER_PATH",
"PICO_MBEDTLS_PATH",
"PICO_LWIP_PATH",
# These are legacy CMake options that should not be used.
"PICO_NO_FLASH",
"PICO_COPY_TO_RAM",
# These aren't supported as build flags in CMake either, but they appear
# as comments which this script can't tell.
Comment on lines +129 to +130
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, it looks like this simple tweak allows this script to ignore "commented out" PICO_CMAKE_CONFIG options?

--- a/tools/compare_build_systems.py
+++ b/tools/compare_build_systems.py
@@ -187,6 +187,9 @@ def FindKnownOptions(option_pattern_matcher, file_paths):
     for p in file_paths:
         with open(p, "r") as f:
             for line in f:
+                if re.match("\s*#\s*#", line):
+                    continue
+
                 match = re.search(pattern, line)
                 if not match:
                     continue

"CYW43_PIN_WL_DYNAMIC",
"CYW43_DEFAULT_PIN_WL_REG_ON",
"CYW43_DEFAULT_PIN_WL_DATA_OUT",
"CYW43_DEFAULT_PIN_WL_DATA_IN",
Expand All @@ -105,6 +137,7 @@
"CYW43_DEFAULT_PIN_WL_CS",
"CYW43_PIO_CLOCK_DIV_INT",
"CYW43_PIO_CLOCK_DIV_FRAC",
"CYW43_PIO_CLOCK_DIV_FRAC8",
"CYW43_PIO_CLOCK_DIV_DYNAMIC",
)

Expand Down Expand Up @@ -133,6 +166,7 @@
# - PICO_BOARD_HEADER_DIRS
"PICO_CONFIG_HEADER",
# Bazel configuration for 3p deps.
"PICO_TINYUSB_CONFIG",
"PICO_BTSTACK_CONFIG",
"PICO_LWIP_CONFIG",
"PICO_MBEDTLS_CONFIG",
Expand Down
Loading