pico-sdk/test/kitchen_sink/BUILD.bazel
armandomontanez 6ff3e4fab2
Expand bazel build to include configuration options and broader support. (#1731)
* Add host Bazel build

Updates target_compatible_with across the repo to ensure that wildcard
builds for both host and rp2040 succeed.

* Get unit tests building

* Add Python script to identify build system differences

Uses the build system tags to make it easier to identify differences
between the CMake and Bazel builds.

* Temporarily disable pico divider test

* Support PICO_BARE_METAL in Bazel

* Support PICO_NO_GC_SECTIONS in Bazel

* Support boot2 configuration in Bazel

Adds support for PICO_DEFAULT_BOOT_STAGE2 and
PICO_DEFAULT_BOOT_STAGE2_FILE in the Bazel build.

* Allowlist some CMake-only options

* Support CXX configuration options in Bazel

* Move multiple_choice_flag.bzl

* Support all pico boards

* Support linking multiple stdio implementations

Changes the Bazel build so stdio implementations are no longer mutually
exclusive.

* Add PICO_BOOT_STAGE2_LINK_IMAGE

* Support PICO_CMSIS_PATH in Bazel

* Support PICO_USE_DEFAULT_MAX_PAGE_SIZE in Bazel

* Silence PICO_CMSIS_VENDOR and PICO_CMSIS_DEVICE differences

* Support PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS in Bazel

* Properly support version defines

* Support embedding binary info in Bazel

* Embed build type in binary

* Support different linker scripts in Bazel build

* Finish out missing PICO_BUILD_DEFINE in Bazel build

* Support PICO_NO_TARGET_NAME

* Reorganize initial configuration options in Bazel

Cleans up and reorganizes some of the initial configuration options
added to the Bazel build so everything is consistent.

* Add builds for pioasm and elf2uf2

* Use Python rules from rules_python

* Actually link in output formats in pioasm tool

* Make tools have public visibility

* Add UF2 Bazel aspect

* Add TODOs for pioasm/uf2 helpers

* Fix compile flag typo

* Update Bazel SDK configuration strings to match recent CMake changes

* Fix pico_divider test

* Clean up straggling TODOs

* Clarify pico_stdio_test compatibility

* Initial Bazel Pico W support

* Add new files from develop

* Clean up compatibility expressions in Bazel build

* Clean up rp2 constraint handling in Bazel

* More Bazel docs cleanup

* Format Bazel build files

* Consolidate transitions in the Pico SDK

* Make every _allowlist_function_transition explicit

* More docs cleanup

* Add a few missing defines

* Improve PICO_CONFIG_HEADER correctness in Bazel

* Minor docs clarifications
2024-06-13 09:50:04 -05:00

138 lines
4.0 KiB
Python

load("//bazel:defs.bzl", "compatible_with_rp2")
load("//bazel/util:transition.bzl", "kitchen_sink_test_binary")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "btstack_config",
hdrs = ["btstack_config.h"],
defines = [
"ENABLE_CLASSIC=1",
"ENABLE_BLE=1",
],
includes = ["."],
)
cc_library(
name = "lwip_config",
hdrs = ["lwipopts.h"],
includes = ["."],
)
cc_library(
name = "mbedtls_config",
hdrs = ["mbedtls_config.h"],
includes = ["."],
)
cc_library(
name = "kitchen_sink_common",
testonly = True,
# So that the cpp one can see the c file.
hdrs = ["kitchen_sink.c"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//src/common/pico_binary_info",
"//src/common/pico_bit_ops",
"//src/common/pico_divider",
"//src/common/pico_stdlib",
"//src/common/pico_sync",
"//src/common/pico_time",
"//src/common/pico_util",
"//src/rp2_common/hardware_adc",
"//src/rp2_common/hardware_claim",
"//src/rp2_common/hardware_clocks",
"//src/rp2_common/hardware_divider",
"//src/rp2_common/hardware_dma",
"//src/rp2_common/hardware_exception",
"//src/rp2_common/hardware_flash",
"//src/rp2_common/hardware_gpio",
"//src/rp2_common/hardware_i2c",
"//src/rp2_common/hardware_interp",
"//src/rp2_common/hardware_irq",
"//src/rp2_common/hardware_pio",
"//src/rp2_common/hardware_pll",
"//src/rp2_common/hardware_pwm",
"//src/rp2_common/hardware_resets",
"//src/rp2_common/hardware_rtc",
"//src/rp2_common/hardware_spi",
"//src/rp2_common/hardware_sync",
"//src/rp2_common/hardware_timer",
"//src/rp2_common/hardware_uart",
"//src/rp2_common/hardware_vreg",
"//src/rp2_common/hardware_watchdog",
"//src/rp2_common/hardware_xosc",
"//src/rp2_common/pico_bootrom",
"//src/rp2_common/pico_double",
"//src/rp2_common/pico_fix/rp2040_usb_device_enumeration",
"//src/rp2_common/pico_flash",
"//src/rp2_common/pico_float",
"//src/rp2_common/pico_i2c_slave",
"//src/rp2_common/pico_int64_ops",
"//src/rp2_common/pico_malloc",
"//src/rp2_common/pico_mem_ops",
"//src/rp2_common/pico_multicore",
"//src/rp2_common/pico_platform",
"//src/rp2_common/pico_printf",
"//src/rp2_common/pico_rand",
"//src/rp2_common/pico_runtime",
"//src/rp2_common/pico_stdio",
"//src/rp2_common/pico_unique_id",
"//test/pico_test",
],
)
cc_binary(
name = "kitchen_sink",
testonly = True,
srcs = ["kitchen_sink.c"],
deps = [":kitchen_sink_common"],
)
cc_binary(
name = "kitchen_sink_cpp",
testonly = True,
srcs = ["kitchen_sink_cpp.cpp"],
deps = [":kitchen_sink_common"],
)
cc_binary(
name = "kitchen_sink_lwip_poll_actual",
testonly = True,
srcs = ["kitchen_sink.c"],
tags = ["manual"], # Built via kitchen_sink_lwip_poll
deps = [
":kitchen_sink_common",
"//src/rp2_common/pico_cyw43_arch:pico_cyw43_arch_lwip_poll",
],
)
cc_binary(
name = "kitchen_sink_lwip_background_actual",
testonly = True,
srcs = ["kitchen_sink.c"],
tags = ["manual"], # Built via kitchen_sink_lwip_background
deps = [
":kitchen_sink_common",
"//src/rp2_common/pico_cyw43_arch:pico_cyw43_arch_lwip_threadsafe_background",
],
)
kitchen_sink_test_binary(
name = "kitchen_sink_lwip_poll",
testonly = True,
src = ":kitchen_sink_lwip_poll_actual",
bt_stack_config = ":btstack_config",
lwip_config = ":lwip_config",
target_compatible_with = compatible_with_rp2(),
)
kitchen_sink_test_binary(
name = "kitchen_sink_lwip_background",
testonly = True,
src = ":kitchen_sink_lwip_background_actual",
bt_stack_config = ":btstack_config",
lwip_config = ":lwip_config",
target_compatible_with = compatible_with_rp2(),
)