pico-sdk/src/rp2_common/pico_btstack/BUILD.bazel
armandomontanez 338f99ff1c
Initial Pico/2 W Bazel support (#2049)
* Initial Pico 2 W Bazel support

Improves compatibility with Pico W and Pico 2 W by fixing issues that
prevented correct linking of wireless libraries.

* Improve correctness and configurability

* Require newer rules_python

* Require rules_python@0.36.0

* Fix missing compatibility expressions

* Minor tweaks

* Minor cleanup

* Update suggested version in Bazel README

* More README tweaks

* Improve Bazel btstack build correctness
2024-11-21 16:58:02 -06:00

106 lines
3 KiB
Text

load("//bazel:defs.bzl", "compatible_with_pico_w", "incompatible_with_config")
package(default_visibility = ["//visibility:public"])
# Prefer using this target to link in all the enabled bt modules, as it will
# link the appropriate libraries and set the appropraite defines based on the
# following flags:
#
# --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_BLE
# --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_CLASSIC
# --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_MESH
cc_library(
name = "pico_btstack",
deps = ["pico_btstack_base"] + select({
"//bazel/constraint:pico_bt_enable_ble_enabled": [":pico_btstack_ble"],
"//conditions:default": [],
}) + select({
"//bazel/constraint:pico_bt_enable_classic_enabled": [":pico_btstack_classic"],
"//conditions:default": [],
}) + select({
"//bazel/constraint:pico_bt_enable_mesh_enabled": [":pico_btstack_mesh"],
"//conditions:default": [],
}),
target_compatible_with = incompatible_with_config("//bazel/constraint:pico_btstack_config_unset"),
)
# Prefer these aliases to directly referencing @btstack, as it's possible that
# name may change.
alias(
name = "pico_btstack_base",
actual = "@btstack//:pico_btstack_base",
)
alias(
name = "pico_btstack_ble",
actual = "@btstack//:pico_btstack_ble",
)
alias(
name = "pico_btstack_classic",
actual = "@btstack//:pico_btstack_classic",
)
alias(
name = "pico_btstack_mesh",
actual = "@btstack//:pico_btstack_mesh",
)
alias(
name = "pico_btstack_sbc_encoder",
actual = "@btstack//:pico_btstack_sbc_encoder",
)
alias(
name = "pico_btstack_sbc_decoder",
actual = "@btstack//:pico_btstack_sbc_decoder",
)
alias(
name = "pico_btstack_bnep_lwip",
actual = "@btstack//:pico_btstack_bnep_lwip",
)
alias(
name = "pico_btstack_bnep_lwip_sys_freertos",
actual = "@btstack//:pico_btstack_bnep_lwip_sys_freertos",
)
cc_library(
name = "pico_btstack_flash_bank",
srcs = ["btstack_flash_bank.c"],
hdrs = ["include/pico/btstack_flash_bank.h"],
includes = ["include"],
target_compatible_with = compatible_with_pico_w(),
deps = [
":pico_btstack_base",
"//src/rp2_common:pico_platform",
"//src/rp2_common/pico_flash",
],
)
cc_library(
name = "btstack_run_loop_async_context",
srcs = ["btstack_run_loop_async_context.c"],
hdrs = ["include/pico/btstack_run_loop_async_context.h"],
includes = ["include"],
target_compatible_with = compatible_with_pico_w(),
deps = [
"//src/rp2_common/hardware_sync",
"//src/rp2_common/pico_async_context",
"@btstack//:pico_btstack_base",
],
)
cc_library(
name = "pico_btstack_stdin",
srcs = ["btstack_stdin_pico.c"],
target_compatible_with = compatible_with_pico_w() + incompatible_with_config("//bazel/constraint:pico_btstack_config_unset"),
deps = [
":pico_btstack_base",
"//bazel/config:PICO_BTSTACK_CONFIG",
"//src/rp2_common:pico_platform",
"//src/rp2_common/pico_stdio",
],
alwayslink = True,
)