1load("//bazel:defs.bzl", "compatible_with_pico_w", "incompatible_with_config")
2
3package(default_visibility = ["//visibility:public"])
4
5# Prefer using this target to link in all the enabled bt modules, as it will
6# link the appropriate libraries and set the appropraite defines based on the
7# following flags:
8#
9#   --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_BLE
10#   --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_CLASSIC
11#   --@pico-sdk//bazel/constraint:PICO_BT_ENABLE_MESH
12cc_library(
13    name = "pico_btstack",
14    deps = ["pico_btstack_base"] + select({
15        "//bazel/constraint:pico_bt_enable_ble_enabled": [":pico_btstack_ble"],
16        "//conditions:default": [],
17    }) + select({
18        "//bazel/constraint:pico_bt_enable_classic_enabled": [":pico_btstack_classic"],
19        "//conditions:default": [],
20    }) + select({
21        "//bazel/constraint:pico_bt_enable_mesh_enabled": [":pico_btstack_mesh"],
22        "//conditions:default": [],
23    }),
24    target_compatible_with = incompatible_with_config("//bazel/constraint:pico_btstack_config_unset"),
25)
26
27# Prefer these aliases to directly referencing @btstack, as it's possible that
28# name may change.
29alias(
30    name = "pico_btstack_base",
31    actual = "@btstack//:pico_btstack_base",
32)
33
34alias(
35    name = "pico_btstack_ble",
36    actual = "@btstack//:pico_btstack_ble",
37)
38
39alias(
40    name = "pico_btstack_classic",
41    actual = "@btstack//:pico_btstack_classic",
42)
43
44alias(
45    name = "pico_btstack_mesh",
46    actual = "@btstack//:pico_btstack_mesh",
47)
48
49alias(
50    name = "pico_btstack_sbc_encoder",
51    actual = "@btstack//:pico_btstack_sbc_encoder",
52)
53
54alias(
55    name = "pico_btstack_sbc_decoder",
56    actual = "@btstack//:pico_btstack_sbc_decoder",
57)
58
59alias(
60    name = "pico_btstack_bnep_lwip",
61    actual = "@btstack//:pico_btstack_bnep_lwip",
62)
63
64alias(
65    name = "pico_btstack_bnep_lwip_sys_freertos",
66    actual = "@btstack//:pico_btstack_bnep_lwip_sys_freertos",
67)
68
69cc_library(
70    name = "pico_btstack_flash_bank",
71    srcs = ["btstack_flash_bank.c"],
72    hdrs = ["include/pico/btstack_flash_bank.h"],
73    includes = ["include"],
74    target_compatible_with = compatible_with_pico_w(),
75    deps = [
76        ":pico_btstack_base",
77        "//src/rp2_common:pico_platform",
78        "//src/rp2_common/pico_flash",
79    ],
80)
81
82cc_library(
83    name = "btstack_run_loop_async_context",
84    srcs = ["btstack_run_loop_async_context.c"],
85    hdrs = ["include/pico/btstack_run_loop_async_context.h"],
86    includes = ["include"],
87    target_compatible_with = compatible_with_pico_w(),
88    deps = [
89        "//src/rp2_common/hardware_sync",
90        "//src/rp2_common/pico_async_context",
91        "@btstack//:pico_btstack_base",
92    ],
93)
94
95cc_library(
96    name = "pico_btstack_stdin",
97    srcs = ["btstack_stdin_pico.c"],
98    target_compatible_with = compatible_with_pico_w() + incompatible_with_config("//bazel/constraint:pico_btstack_config_unset"),
99    deps = [
100        ":pico_btstack_base",
101        "//bazel/config:PICO_BTSTACK_CONFIG",
102        "//src/rp2_common:pico_platform",
103        "//src/rp2_common/pico_stdio",
104    ],
105    alwayslink = True,
106)
107