1# SPDX-License-Identifier: Apache-2.0
2
3zephyr_library()
4zephyr_library_link_libraries(subsys__bluetooth)
5
6add_subdirectory_ifdef(CONFIG_BT_CLASSIC classic)
7add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
8
9zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW          hci_raw.c hci_common.c)
10zephyr_library_sources_ifdef(CONFIG_BT_MONITOR          monitor.c)
11zephyr_library_sources_ifdef(CONFIG_BT_SEND_ECC_EMULATION          hci_ecc.c)
12zephyr_library_sources_ifdef(CONFIG_BT_SETTINGS         settings.c)
13zephyr_library_sources_ifdef(CONFIG_BT_HOST_CCM         aes_ccm.c)
14zephyr_library_sources_ifdef(CONFIG_BT_LONG_WQ          long_wq.c)
15
16if(CONFIG_BT_HCI_HOST)
17  zephyr_library_sources(
18    uuid.c
19    addr.c
20    buf.c
21    data.c
22    hci_core.c
23    hci_common.c
24    id.c
25    )
26  zephyr_library_sources_ifdef(
27    CONFIG_BT_BROADCASTER
28    adv.c
29    )
30  zephyr_library_sources_ifdef(
31    CONFIG_BT_OBSERVER
32    scan.c
33    )
34
35  zephyr_library_sources_ifdef(
36    CONFIG_BT_HOST_CRYPTO
37    crypto_psa.c
38    )
39
40  zephyr_library_sources_ifdef(
41    CONFIG_BT_ECC
42    ecc.c
43    )
44
45  if(CONFIG_BT_CONN)
46    zephyr_library_sources(
47      conn.c
48      l2cap.c
49      att.c
50      gatt.c
51      )
52
53    if(CONFIG_BT_SMP)
54      zephyr_library_sources(
55        smp.c
56        keys.c
57        )
58    else()
59      zephyr_library_sources(
60        smp_null.c
61        )
62    endif()
63  endif()
64
65  zephyr_library_sources_ifdef(
66    CONFIG_BT_ISO
67    iso.c
68    conn.c
69    )
70
71  zephyr_library_sources_ifdef(
72    CONFIG_BT_CHANNEL_SOUNDING
73    cs.c
74    )
75
76  if(CONFIG_BT_DF)
77    zephyr_library_sources(
78      direction.c
79      )
80  endif()
81endif()
82
83if(CONFIG_BT_SMP_LOG_LEVEL_DBG OR CONFIG_BT_KEYS_LOG_LEVEL_DBG OR CONFIG_BT_LOG_SNIFFER_INFO)
84  message(WARNING "One of these options are enabled:
85  CONFIG_BT_SMP_LOG_LEVEL_DBG CONFIG_BT_KEYS_LOG_LEVEL_DBG CONFIG_BT_LOG_SNIFFER_INFO.
86  Private security keys such as the LTK will be printed out, do not use in
87  production."
88    )
89endif()
90if(CONFIG_BT_FIXED_PASSKEY)
91  message(WARNING "CONFIG_BT_FIXED_PASSKEY is enabled
92  A fixed passkey is easy to deduce during the pairing procedure, do not use in
93  production."
94    )
95endif()
96if(CONFIG_BT_OOB_DATA_FIXED)
97  message(WARNING "CONFIG_BT_OOB_DATA_FIXED is enabled.
98  A hardcoded OOB data set will be stored in the image, do not use in
99  production."
100    )
101endif()
102if(CONFIG_BT_USE_DEBUG_KEYS OR CONFIG_BT_STORE_DEBUG_KEYS)
103  message(WARNING "One or both these options are enabled:
104  CONFIG_BT_USE_DEBUG_KEYS CONFIG_BT_STORE_DEBUG_KEYS.
105  A predefined, publicly available keypair intended for testing will be used.
106  Do not use in production."
107    )
108endif()
109if(CONFIG_BT_CONN_DISABLE_SECURITY)
110  message(WARNING "CONFIG_BT_CONN_DISABLE_SECURITY is enabled.
111  Security is disabled for incoming requests for GATT attributes and L2CAP
112  channels that would otherwise require encryption/authentication in order to
113  be accessed.
114  Do not use in production."
115    )
116endif()
117
118zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)
119zephyr_library_include_directories_ifdef(CONFIG_BUILD_WITH_TFM
120  $<TARGET_PROPERTY:tfm,TFM_BINARY_DIR>/api_ns/interface/include
121)
122
123# Bluetooth Mesh has test dependencies in the host.
124# In order to compile Bsim tests with these test features
125# and PSA enabled, the libraries must be linked.
126if(CONFIG_BT_MESH AND CONFIG_BT_TESTING)
127  zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)
128endif()
129