1if(CONFIG_BT_ENABLED)
2    if(CONFIG_IDF_TARGET_ESP32)
3        set(srcs "controller/esp32/bt.c"
4                 "controller/esp32/hli_api.c"
5                 "controller/esp32/hli_vectors.S")
6    elseif(CONFIG_IDF_TARGET_ESP32C3)
7        set(srcs "controller/esp32c3/bt.c")
8    elseif(CONFIG_IDF_TARGET_ESP32S3)
9        set(srcs "controller/esp32s3/bt.c")
10    endif()
11
12    set(include_dirs common/osi/include)
13
14    if(CONFIG_IDF_TARGET_ESP32)
15        list(APPEND include_dirs include/esp32/include)
16    elseif(CONFIG_IDF_TARGET_ESP32C3)
17        list(APPEND include_dirs include/esp32c3/include)
18    elseif(CONFIG_IDF_TARGET_ESP32S3)
19        list(APPEND include_dirs include/esp32s3/include)
20    endif()
21
22    list(APPEND priv_include_dirs
23            common/btc/include
24            common/include)
25    list(APPEND include_dirs
26         common/api/include/api
27         common/btc/profile/esp/blufi/include
28         common/btc/profile/esp/include)
29
30    list(APPEND srcs "common/btc/core/btc_alarm.c"
31         "common/api/esp_blufi_api.c"
32         "common/btc/core/btc_manage.c"
33         "common/btc/core/btc_task.c"
34         "common/btc/profile/esp/blufi/blufi_prf.c"
35         "common/btc/profile/esp/blufi/blufi_protocol.c"
36         "common/osi/alarm.c"
37         "common/osi/allocator.c"
38         "common/osi/buffer.c"
39         "common/osi/config.c"
40         "common/osi/fixed_queue.c"
41         "common/osi/future.c"
42         "common/osi/hash_functions.c"
43         "common/osi/hash_map.c"
44         "common/osi/list.c"
45         "common/osi/mutex.c"
46         "common/osi/thread.c"
47         "common/osi/osi.c"
48         "common/osi/semaphore.c")
49
50    if(CONFIG_BT_BLUEDROID_ENABLED)
51
52        list(APPEND priv_include_dirs
53            host/bluedroid/bta/include
54            host/bluedroid/bta/ar/include
55            host/bluedroid/bta/av/include
56            host/bluedroid/bta/dm/include
57            host/bluedroid/bta/gatt/include
58            host/bluedroid/bta/hf_ag/include
59            host/bluedroid/bta/hf_client/include
60            host/bluedroid/bta/hd/include
61            host/bluedroid/bta/hh/include
62            host/bluedroid/bta/jv/include
63            host/bluedroid/bta/sdp/include
64            host/bluedroid/bta/sys/include
65            host/bluedroid/device/include
66            host/bluedroid/hci/include
67            host/bluedroid/external/sbc/decoder/include
68            host/bluedroid/external/sbc/encoder/include
69            host/bluedroid/external/sbc/plc/include
70            host/bluedroid/btc/profile/esp/include
71            host/bluedroid/btc/profile/std/a2dp/include
72            host/bluedroid/btc/profile/std/include
73            host/bluedroid/btc/include
74            host/bluedroid/stack/btm/include
75            host/bluedroid/stack/gap/include
76            host/bluedroid/stack/gatt/include
77            host/bluedroid/stack/hid/include
78            host/bluedroid/stack/l2cap/include
79            host/bluedroid/stack/sdp/include
80            host/bluedroid/stack/smp/include
81            host/bluedroid/stack/avct/include
82            host/bluedroid/stack/avrc/include
83            host/bluedroid/stack/avdt/include
84            host/bluedroid/stack/a2dp/include
85            host/bluedroid/stack/rfcomm/include
86            host/bluedroid/stack/include
87            host/bluedroid/common/include)
88
89        list(APPEND include_dirs host/bluedroid/api/include/api)
90
91        list(APPEND srcs "host/bluedroid/api/esp_a2dp_api.c"
92                   "host/bluedroid/api/esp_avrc_api.c"
93                   "host/bluedroid/api/esp_bt_device.c"
94                   "host/bluedroid/api/esp_bt_main.c"
95                   "host/bluedroid/api/esp_gap_ble_api.c"
96                   "host/bluedroid/api/esp_gap_bt_api.c"
97                   "host/bluedroid/api/esp_gatt_common_api.c"
98                   "host/bluedroid/api/esp_gattc_api.c"
99                   "host/bluedroid/api/esp_gatts_api.c"
100                   "host/bluedroid/api/esp_hidd_api.c"
101                   "host/bluedroid/api/esp_hidh_api.c"
102                   "host/bluedroid/api/esp_hf_ag_api.c"
103                   "host/bluedroid/api/esp_hf_client_api.c"
104                   "host/bluedroid/api/esp_spp_api.c"
105                   "host/bluedroid/bta/ar/bta_ar.c"
106                   "host/bluedroid/bta/av/bta_av_aact.c"
107                   "host/bluedroid/bta/av/bta_av_act.c"
108                   "host/bluedroid/bta/av/bta_av_api.c"
109                   "host/bluedroid/bta/av/bta_av_cfg.c"
110                   "host/bluedroid/bta/av/bta_av_ci.c"
111                   "host/bluedroid/bta/av/bta_av_main.c"
112                   "host/bluedroid/bta/av/bta_av_sbc.c"
113                   "host/bluedroid/bta/av/bta_av_ssm.c"
114                   "host/bluedroid/bta/dm/bta_dm_act.c"
115                   "host/bluedroid/bta/dm/bta_dm_api.c"
116                   "host/bluedroid/bta/dm/bta_dm_cfg.c"
117                   "host/bluedroid/bta/dm/bta_dm_ci.c"
118                   "host/bluedroid/bta/dm/bta_dm_co.c"
119                   "host/bluedroid/bta/dm/bta_dm_main.c"
120                   "host/bluedroid/bta/dm/bta_dm_pm.c"
121                   "host/bluedroid/bta/dm/bta_dm_sco.c"
122                   "host/bluedroid/bta/dm/bta_dm_qos.c"
123                   "host/bluedroid/bta/gatt/bta_gatt_common.c"
124                   "host/bluedroid/bta/gatt/bta_gattc_act.c"
125                   "host/bluedroid/bta/gatt/bta_gattc_api.c"
126                   "host/bluedroid/bta/gatt/bta_gattc_cache.c"
127                   "host/bluedroid/bta/gatt/bta_gattc_ci.c"
128                   "host/bluedroid/bta/gatt/bta_gattc_co.c"
129                   "host/bluedroid/bta/gatt/bta_gattc_main.c"
130                   "host/bluedroid/bta/gatt/bta_gattc_utils.c"
131                   "host/bluedroid/bta/gatt/bta_gatts_act.c"
132                   "host/bluedroid/bta/gatt/bta_gatts_api.c"
133                   "host/bluedroid/bta/gatt/bta_gatts_co.c"
134                   "host/bluedroid/bta/gatt/bta_gatts_main.c"
135                   "host/bluedroid/bta/gatt/bta_gatts_utils.c"
136                   "host/bluedroid/bta/hd/bta_hd_api.c"
137                   "host/bluedroid/bta/hd/bta_hd_act.c"
138                   "host/bluedroid/bta/hd/bta_hd_main.c"
139                   "host/bluedroid/bta/hh/bta_hh_act.c"
140                   "host/bluedroid/bta/hh/bta_hh_api.c"
141                   "host/bluedroid/bta/hh/bta_hh_cfg.c"
142                   "host/bluedroid/bta/hh/bta_hh_le.c"
143                   "host/bluedroid/bta/hh/bta_hh_main.c"
144                   "host/bluedroid/bta/hh/bta_hh_utils.c"
145                   "host/bluedroid/bta/jv/bta_jv_act.c"
146                   "host/bluedroid/bta/jv/bta_jv_api.c"
147                   "host/bluedroid/bta/jv/bta_jv_cfg.c"
148                   "host/bluedroid/bta/jv/bta_jv_main.c"
149                   "host/bluedroid/bta/hf_ag/bta_ag_act.c"
150                   "host/bluedroid/bta/hf_ag/bta_ag_api.c"
151                   "host/bluedroid/bta/hf_ag/bta_ag_at.c"
152                   "host/bluedroid/bta/hf_ag/bta_ag_cfg.c"
153                   "host/bluedroid/bta/hf_ag/bta_ag_cmd.c"
154                   "host/bluedroid/bta/hf_ag/bta_ag_main.c"
155                   "host/bluedroid/bta/hf_ag/bta_ag_rfc.c"
156                   "host/bluedroid/bta/hf_ag/bta_ag_sco.c"
157                   "host/bluedroid/bta/hf_ag/bta_ag_sdp.c"
158                   "host/bluedroid/bta/hf_client/bta_hf_client_act.c"
159                   "host/bluedroid/bta/hf_client/bta_hf_client_api.c"
160                   "host/bluedroid/bta/hf_client/bta_hf_client_at.c"
161                   "host/bluedroid/bta/hf_client/bta_hf_client_cmd.c"
162                   "host/bluedroid/bta/hf_client/bta_hf_client_main.c"
163                   "host/bluedroid/bta/hf_client/bta_hf_client_rfc.c"
164                   "host/bluedroid/bta/hf_client/bta_hf_client_sco.c"
165                   "host/bluedroid/bta/hf_client/bta_hf_client_sdp.c"
166                   "host/bluedroid/bta/sdp/bta_sdp.c"
167                   "host/bluedroid/bta/sdp/bta_sdp_act.c"
168                   "host/bluedroid/bta/sdp/bta_sdp_api.c"
169                   "host/bluedroid/bta/sdp/bta_sdp_cfg.c"
170                   "host/bluedroid/bta/sys/bta_sys_conn.c"
171                   "host/bluedroid/bta/sys/bta_sys_main.c"
172                   "host/bluedroid/bta/sys/utl.c"
173                   "host/bluedroid/btc/core/btc_ble_storage.c"
174                   "host/bluedroid/btc/core/btc_config.c"
175                   "host/bluedroid/btc/core/btc_dev.c"
176                   "host/bluedroid/btc/core/btc_dm.c"
177                   "host/bluedroid/btc/core/btc_main.c"
178                   "host/bluedroid/btc/core/btc_profile_queue.c"
179                   "host/bluedroid/btc/core/btc_sec.c"
180                   "host/bluedroid/btc/core/btc_sm.c"
181                   "host/bluedroid/btc/core/btc_storage.c"
182                   "host/bluedroid/btc/core/btc_util.c"
183                   "host/bluedroid/btc/profile/std/a2dp/bta_av_co.c"
184                   "host/bluedroid/btc/profile/std/a2dp/btc_a2dp.c"
185                   "host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c"
186                   "host/bluedroid/btc/profile/std/a2dp/btc_a2dp_sink.c"
187                   "host/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c"
188                   "host/bluedroid/btc/profile/std/a2dp/btc_av.c"
189                   "host/bluedroid/btc/profile/std/avrc/btc_avrc.c"
190                   "host/bluedroid/btc/profile/std/avrc/bta_avrc_co.c"
191                   "host/bluedroid/btc/profile/std/hf_ag/bta_ag_co.c"
192                   "host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c"
193                   "host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
194                   "host/bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
195                   "host/bluedroid/btc/profile/std/hid/btc_hd.c"
196                   "host/bluedroid/btc/profile/std/hid/btc_hh.c"
197                   "host/bluedroid/btc/profile/std/hid/bta_hh_co.c"
198                   "host/bluedroid/btc/profile/std/gap/btc_gap_ble.c"
199                   "host/bluedroid/btc/profile/std/gap/btc_gap_bt.c"
200                   "host/bluedroid/btc/profile/std/gap/bta_gap_bt_co.c"
201                   "host/bluedroid/btc/profile/std/gatt/btc_gatt_common.c"
202                   "host/bluedroid/btc/profile/std/gatt/btc_gatt_util.c"
203                   "host/bluedroid/btc/profile/std/gatt/btc_gattc.c"
204                   "host/bluedroid/btc/profile/std/gatt/btc_gatts.c"
205                   "host/bluedroid/btc/profile/std/spp/btc_spp.c"
206                   "host/bluedroid/device/bdaddr.c"
207                   "host/bluedroid/device/controller.c"
208                   "host/bluedroid/device/interop.c"
209                   "host/bluedroid/external/sbc/decoder/srce/alloc.c"
210                   "host/bluedroid/external/sbc/decoder/srce/bitalloc-sbc.c"
211                   "host/bluedroid/external/sbc/decoder/srce/bitalloc.c"
212                   "host/bluedroid/external/sbc/decoder/srce/bitstream-decode.c"
213                   "host/bluedroid/external/sbc/decoder/srce/decoder-oina.c"
214                   "host/bluedroid/external/sbc/decoder/srce/decoder-private.c"
215                   "host/bluedroid/external/sbc/decoder/srce/decoder-sbc.c"
216                   "host/bluedroid/external/sbc/decoder/srce/dequant.c"
217                   "host/bluedroid/external/sbc/decoder/srce/framing-sbc.c"
218                   "host/bluedroid/external/sbc/decoder/srce/framing.c"
219                   "host/bluedroid/external/sbc/decoder/srce/oi_codec_version.c"
220                   "host/bluedroid/external/sbc/decoder/srce/synthesis-8-generated.c"
221                   "host/bluedroid/external/sbc/decoder/srce/synthesis-dct8.c"
222                   "host/bluedroid/external/sbc/decoder/srce/synthesis-sbc.c"
223                   "host/bluedroid/external/sbc/encoder/srce/sbc_analysis.c"
224                   "host/bluedroid/external/sbc/encoder/srce/sbc_dct.c"
225                   "host/bluedroid/external/sbc/encoder/srce/sbc_dct_coeffs.c"
226                   "host/bluedroid/external/sbc/encoder/srce/sbc_enc_bit_alloc_mono.c"
227                   "host/bluedroid/external/sbc/encoder/srce/sbc_enc_bit_alloc_ste.c"
228                   "host/bluedroid/external/sbc/encoder/srce/sbc_enc_coeffs.c"
229                   "host/bluedroid/external/sbc/encoder/srce/sbc_encoder.c"
230                   "host/bluedroid/external/sbc/encoder/srce/sbc_packing.c"
231                   "host/bluedroid/external/sbc/plc/sbc_plc.c"
232                   "host/bluedroid/hci/hci_audio.c"
233                   "host/bluedroid/hci/hci_hal_h4.c"
234                   "host/bluedroid/hci/hci_layer.c"
235                   "host/bluedroid/hci/hci_packet_factory.c"
236                   "host/bluedroid/hci/hci_packet_parser.c"
237                   "host/bluedroid/hci/packet_fragmenter.c"
238                   "host/bluedroid/main/bte_init.c"
239                   "host/bluedroid/main/bte_main.c"
240                   "host/bluedroid/stack/a2dp/a2d_api.c"
241                   "host/bluedroid/stack/a2dp/a2d_sbc.c"
242                   "host/bluedroid/stack/avct/avct_api.c"
243                   "host/bluedroid/stack/avct/avct_ccb.c"
244                   "host/bluedroid/stack/avct/avct_l2c.c"
245                   "host/bluedroid/stack/avct/avct_lcb.c"
246                   "host/bluedroid/stack/avct/avct_lcb_act.c"
247                   "host/bluedroid/stack/avdt/avdt_ad.c"
248                   "host/bluedroid/stack/avdt/avdt_api.c"
249                   "host/bluedroid/stack/avdt/avdt_ccb.c"
250                   "host/bluedroid/stack/avdt/avdt_ccb_act.c"
251                   "host/bluedroid/stack/avdt/avdt_l2c.c"
252                   "host/bluedroid/stack/avdt/avdt_msg.c"
253                   "host/bluedroid/stack/avdt/avdt_scb.c"
254                   "host/bluedroid/stack/avdt/avdt_scb_act.c"
255                   "host/bluedroid/stack/avrc/avrc_api.c"
256                   "host/bluedroid/stack/avrc/avrc_bld_ct.c"
257                   "host/bluedroid/stack/avrc/avrc_bld_tg.c"
258                   "host/bluedroid/stack/avrc/avrc_opt.c"
259                   "host/bluedroid/stack/avrc/avrc_pars_ct.c"
260                   "host/bluedroid/stack/avrc/avrc_pars_tg.c"
261                   "host/bluedroid/stack/avrc/avrc_sdp.c"
262                   "host/bluedroid/stack/avrc/avrc_utils.c"
263                   "host/bluedroid/stack/hid/hidd_api.c"
264                   "host/bluedroid/stack/hid/hidd_conn.c"
265                   "host/bluedroid/stack/hid/hidh_api.c"
266                   "host/bluedroid/stack/hid/hidh_conn.c"
267                   "host/bluedroid/stack/btm/btm_acl.c"
268                   "host/bluedroid/stack/btm/btm_ble.c"
269                   "host/bluedroid/stack/btm/btm_ble_addr.c"
270                   "host/bluedroid/stack/btm/btm_ble_adv_filter.c"
271                   "host/bluedroid/stack/btm/btm_ble_batchscan.c"
272                   "host/bluedroid/stack/btm/btm_ble_bgconn.c"
273                   "host/bluedroid/stack/btm/btm_ble_cont_energy.c"
274                   "host/bluedroid/stack/btm/btm_ble_gap.c"
275                   "host/bluedroid/stack/btm/btm_ble_5_gap.c"
276                   "host/bluedroid/stack/btm/btm_ble_multi_adv.c"
277                   "host/bluedroid/stack/btm/btm_ble_privacy.c"
278                   "host/bluedroid/stack/btm/btm_dev.c"
279                   "host/bluedroid/stack/btm/btm_devctl.c"
280                   "host/bluedroid/stack/btm/btm_inq.c"
281                   "host/bluedroid/stack/btm/btm_main.c"
282                   "host/bluedroid/stack/btm/btm_pm.c"
283                   "host/bluedroid/stack/btm/btm_sco.c"
284                   "host/bluedroid/stack/btm/btm_sec.c"
285                   "host/bluedroid/stack/btu/btu_hcif.c"
286                   "host/bluedroid/stack/btu/btu_init.c"
287                   "host/bluedroid/stack/btu/btu_task.c"
288                   "host/bluedroid/stack/gap/gap_api.c"
289                   "host/bluedroid/stack/gap/gap_ble.c"
290                   "host/bluedroid/stack/gap/gap_conn.c"
291                   "host/bluedroid/stack/gap/gap_utils.c"
292                   "host/bluedroid/stack/gatt/att_protocol.c"
293                   "host/bluedroid/stack/gatt/gatt_api.c"
294                   "host/bluedroid/stack/gatt/gatt_attr.c"
295                   "host/bluedroid/stack/gatt/gatt_auth.c"
296                   "host/bluedroid/stack/gatt/gatt_cl.c"
297                   "host/bluedroid/stack/gatt/gatt_db.c"
298                   "host/bluedroid/stack/gatt/gatt_main.c"
299                   "host/bluedroid/stack/gatt/gatt_sr.c"
300                   "host/bluedroid/stack/gatt/gatt_utils.c"
301                   "host/bluedroid/stack/hcic/hciblecmds.c"
302                   "host/bluedroid/stack/hcic/hcicmds.c"
303                   "host/bluedroid/stack/l2cap/l2c_api.c"
304                   "host/bluedroid/stack/l2cap/l2c_ble.c"
305                   "host/bluedroid/stack/l2cap/l2c_csm.c"
306                   "host/bluedroid/stack/l2cap/l2c_fcr.c"
307                   "host/bluedroid/stack/l2cap/l2c_link.c"
308                   "host/bluedroid/stack/l2cap/l2c_main.c"
309                   "host/bluedroid/stack/l2cap/l2c_ucd.c"
310                   "host/bluedroid/stack/l2cap/l2c_utils.c"
311                   "host/bluedroid/stack/l2cap/l2cap_client.c"
312                   "host/bluedroid/stack/rfcomm/port_api.c"
313                   "host/bluedroid/stack/rfcomm/port_rfc.c"
314                   "host/bluedroid/stack/rfcomm/port_utils.c"
315                   "host/bluedroid/stack/rfcomm/rfc_l2cap_if.c"
316                   "host/bluedroid/stack/rfcomm/rfc_mx_fsm.c"
317                   "host/bluedroid/stack/rfcomm/rfc_port_fsm.c"
318                   "host/bluedroid/stack/rfcomm/rfc_port_if.c"
319                   "host/bluedroid/stack/rfcomm/rfc_ts_frames.c"
320                   "host/bluedroid/stack/rfcomm/rfc_utils.c"
321                   "host/bluedroid/stack/sdp/sdp_api.c"
322                   "host/bluedroid/stack/sdp/sdp_db.c"
323                   "host/bluedroid/stack/sdp/sdp_discovery.c"
324                   "host/bluedroid/stack/sdp/sdp_main.c"
325                   "host/bluedroid/stack/sdp/sdp_server.c"
326                   "host/bluedroid/stack/sdp/sdp_utils.c"
327                   "host/bluedroid/stack/smp/aes.c"
328                   "host/bluedroid/stack/smp/p_256_curvepara.c"
329                   "host/bluedroid/stack/smp/p_256_ecc_pp.c"
330                   "host/bluedroid/stack/smp/p_256_multprecision.c"
331                   "host/bluedroid/stack/smp/smp_act.c"
332                   "host/bluedroid/stack/smp/smp_api.c"
333                   "host/bluedroid/stack/smp/smp_br_main.c"
334                   "host/bluedroid/stack/smp/smp_cmac.c"
335                   "host/bluedroid/stack/smp/smp_keys.c"
336                   "host/bluedroid/stack/smp/smp_l2c.c"
337                   "host/bluedroid/stack/smp/smp_main.c"
338                   "host/bluedroid/stack/smp/smp_utils.c")
339
340            list(APPEND srcs "common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c")
341        if(CONFIG_BLE_MESH)
342            list(APPEND srcs "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
343        endif()
344
345    endif()
346
347    if(CONFIG_BLE_MESH)
348        list(APPEND include_dirs
349                    "esp_ble_mesh/mesh_common/include"
350                    "esp_ble_mesh/mesh_common/tinycrypt/include"
351                    "esp_ble_mesh/mesh_core"
352                    "esp_ble_mesh/mesh_core/include"
353                    "esp_ble_mesh/mesh_core/storage"
354                    "esp_ble_mesh/btc/include"
355                    "esp_ble_mesh/mesh_models/common/include"
356                    "esp_ble_mesh/mesh_models/client/include"
357                    "esp_ble_mesh/mesh_models/server/include"
358                    "esp_ble_mesh/api/core/include"
359                    "esp_ble_mesh/api/models/include"
360                    "esp_ble_mesh/api")
361
362        list(APPEND srcs "esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c"
363                    "esp_ble_mesh/api/core/esp_ble_mesh_common_api.c"
364                    "esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c"
365                    "esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c"
366                    "esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c"
367                    "esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c"
368                    "esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c"
369                    "esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c"
370                    "esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c"
371                    "esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c"
372                    "esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c"
373                    "esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c"
374                    "esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c"
375                    "esp_ble_mesh/btc/btc_ble_mesh_ble.c"
376                    "esp_ble_mesh/btc/btc_ble_mesh_config_model.c"
377                    "esp_ble_mesh/btc/btc_ble_mesh_generic_model.c"
378                    "esp_ble_mesh/btc/btc_ble_mesh_health_model.c"
379                    "esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c"
380                    "esp_ble_mesh/btc/btc_ble_mesh_prov.c"
381                    "esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
382                    "esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
383                    "esp_ble_mesh/mesh_common/tinycrypt/src/aes_decrypt.c"
384                    "esp_ble_mesh/mesh_common/tinycrypt/src/aes_encrypt.c"
385                    "esp_ble_mesh/mesh_common/tinycrypt/src/cbc_mode.c"
386                    "esp_ble_mesh/mesh_common/tinycrypt/src/ccm_mode.c"
387                    "esp_ble_mesh/mesh_common/tinycrypt/src/cmac_mode.c"
388                    "esp_ble_mesh/mesh_common/tinycrypt/src/ctr_mode.c"
389                    "esp_ble_mesh/mesh_common/tinycrypt/src/ctr_prng.c"
390                    "esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dh.c"
391                    "esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dsa.c"
392                    "esp_ble_mesh/mesh_common/tinycrypt/src/ecc_platform_specific.c"
393                    "esp_ble_mesh/mesh_common/tinycrypt/src/ecc.c"
394                    "esp_ble_mesh/mesh_common/tinycrypt/src/hmac_prng.c"
395                    "esp_ble_mesh/mesh_common/tinycrypt/src/hmac.c"
396                    "esp_ble_mesh/mesh_common/tinycrypt/src/sha256.c"
397                    "esp_ble_mesh/mesh_common/tinycrypt/src/utils.c"
398                    "esp_ble_mesh/mesh_common/mesh_atomic.c"
399                    "esp_ble_mesh/mesh_common/mesh_buf.c"
400                    "esp_ble_mesh/mesh_common/mesh_common.c"
401                    "esp_ble_mesh/mesh_common/mesh_kernel.c"
402                    "esp_ble_mesh/mesh_common/mesh_mutex.c"
403                    "esp_ble_mesh/mesh_common/mesh_timer.c"
404                    "esp_ble_mesh/mesh_common/mesh_util.c"
405                    "esp_ble_mesh/mesh_core/storage/settings_nvs.c"
406                    "esp_ble_mesh/mesh_core/access.c"
407                    "esp_ble_mesh/mesh_core/adv.c"
408                    "esp_ble_mesh/mesh_core/beacon.c"
409                    "esp_ble_mesh/mesh_core/cfg_cli.c"
410                    "esp_ble_mesh/mesh_core/cfg_srv.c"
411                    "esp_ble_mesh/mesh_core/crypto.c"
412                    "esp_ble_mesh/mesh_core/fast_prov.c"
413                    "esp_ble_mesh/mesh_core/friend.c"
414                    "esp_ble_mesh/mesh_core/health_cli.c"
415                    "esp_ble_mesh/mesh_core/health_srv.c"
416                    "esp_ble_mesh/mesh_core/local_operation.c"
417                    "esp_ble_mesh/mesh_core/lpn.c"
418                    "esp_ble_mesh/mesh_core/main.c"
419                    "esp_ble_mesh/mesh_core/net.c"
420                    "esp_ble_mesh/mesh_core/prov.c"
421                    "esp_ble_mesh/mesh_core/provisioner_main.c"
422                    "esp_ble_mesh/mesh_core/provisioner_prov.c"
423                    "esp_ble_mesh/mesh_core/proxy_client.c"
424                    "esp_ble_mesh/mesh_core/proxy_server.c"
425                    "esp_ble_mesh/mesh_core/settings_uid.c"
426                    "esp_ble_mesh/mesh_core/settings.c"
427                    "esp_ble_mesh/mesh_core/scan.c"
428                    "esp_ble_mesh/mesh_core/test.c"
429                    "esp_ble_mesh/mesh_core/transport.c"
430                    "esp_ble_mesh/mesh_models/common/device_property.c"
431                    "esp_ble_mesh/mesh_models/client/client_common.c"
432                    "esp_ble_mesh/mesh_models/client/generic_client.c"
433                    "esp_ble_mesh/mesh_models/client/lighting_client.c"
434                    "esp_ble_mesh/mesh_models/client/sensor_client.c"
435                    "esp_ble_mesh/mesh_models/client/time_scene_client.c"
436                    "esp_ble_mesh/mesh_models/server/generic_server.c"
437                    "esp_ble_mesh/mesh_models/server/lighting_server.c"
438                    "esp_ble_mesh/mesh_models/server/sensor_server.c"
439                    "esp_ble_mesh/mesh_models/server/server_common.c"
440                    "esp_ble_mesh/mesh_models/server/state_binding.c"
441                    "esp_ble_mesh/mesh_models/server/state_transition.c"
442                    "esp_ble_mesh/mesh_models/server/time_scene_server.c")
443    endif()
444
445    if(CONFIG_BT_NIMBLE_ENABLED)
446
447        list(APPEND include_dirs
448                    host/nimble/nimble/porting/nimble/include
449                    host/nimble/port/include
450                    host/nimble/nimble/nimble/include
451                    host/nimble/nimble/nimble/host/include
452                    host/nimble/nimble/nimble/host/services/ans/include
453                    host/nimble/nimble/nimble/host/services/bas/include
454                    host/nimble/nimble/nimble/host/services/dis/include
455                    host/nimble/nimble/nimble/host/services/gap/include
456                    host/nimble/nimble/nimble/host/services/gatt/include
457                    host/nimble/nimble/nimble/host/services/ias/include
458                    host/nimble/nimble/nimble/host/services/ipss/include
459                    host/nimble/nimble/nimble/host/services/lls/include
460                    host/nimble/nimble/nimble/host/services/tps/include
461                    host/nimble/nimble/nimble/host/util/include
462                    host/nimble/nimble/nimble/host/store/ram/include
463                    host/nimble/nimble/nimble/host/store/config/include
464                    host/nimble/nimble/porting/npl/freertos/include
465                    host/nimble/esp-hci/include)
466
467    if(NOT CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS)
468
469        list(APPEND include_dirs
470                    host/nimble/nimble/ext/tinycrypt/include)
471
472        list(APPEND srcs "host/nimble/nimble/ext/tinycrypt/src/utils.c"
473                    "host/nimble/nimble/ext/tinycrypt/src/sha256.c"
474                    "host/nimble/nimble/ext/tinycrypt/src/ecc.c"
475                    "host/nimble/nimble/ext/tinycrypt/src/ctr_prng.c"
476                    "host/nimble/nimble/ext/tinycrypt/src/ctr_mode.c"
477                    "host/nimble/nimble/ext/tinycrypt/src/aes_decrypt.c"
478                    "host/nimble/nimble/ext/tinycrypt/src/aes_encrypt.c"
479                    "host/nimble/nimble/ext/tinycrypt/src/ccm_mode.c"
480                    "host/nimble/nimble/ext/tinycrypt/src/ecc_dsa.c"
481                    "host/nimble/nimble/ext/tinycrypt/src/cmac_mode.c"
482                    "host/nimble/nimble/ext/tinycrypt/src/ecc_dh.c"
483                    "host/nimble/nimble/ext/tinycrypt/src/hmac_prng.c"
484                    "host/nimble/nimble/ext/tinycrypt/src/ecc_platform_specific.c"
485                    "host/nimble/nimble/ext/tinycrypt/src/hmac.c"
486                    "host/nimble/nimble/ext/tinycrypt/src/cbc_mode.c")
487    endif()
488
489        list(APPEND srcs "host/nimble/nimble/nimble/host/util/src/addr.c"
490                    "host/nimble/nimble/nimble/host/services/gatt/src/ble_svc_gatt.c"
491                    "host/nimble/nimble/nimble/host/services/tps/src/ble_svc_tps.c"
492                    "host/nimble/nimble/nimble/host/services/ias/src/ble_svc_ias.c"
493                    "host/nimble/nimble/nimble/host/services/ipss/src/ble_svc_ipss.c"
494                    "host/nimble/nimble/nimble/host/services/ans/src/ble_svc_ans.c"
495                    "host/nimble/nimble/nimble/host/services/gap/src/ble_svc_gap.c"
496                    "host/nimble/nimble/nimble/host/services/bas/src/ble_svc_bas.c"
497                    "host/nimble/nimble/nimble/host/services/dis/src/ble_svc_dis.c"
498                    "host/nimble/nimble/nimble/host/services/lls/src/ble_svc_lls.c"
499                    "host/nimble/nimble/nimble/host/src/ble_hs_conn.c"
500                    "host/nimble/nimble/nimble/host/src/ble_store_util.c"
501                    "host/nimble/nimble/nimble/host/src/ble_sm.c"
502                    "host/nimble/nimble/nimble/host/src/ble_hs_shutdown.c"
503                    "host/nimble/nimble/nimble/host/src/ble_l2cap_sig_cmd.c"
504                    "host/nimble/nimble/nimble/host/src/ble_hs_hci_cmd.c"
505                    "host/nimble/nimble/nimble/host/src/ble_hs_id.c"
506                    "host/nimble/nimble/nimble/host/src/ble_att_svr.c"
507                    "host/nimble/nimble/nimble/host/src/ble_gatts_lcl.c"
508                    "host/nimble/nimble/nimble/host/src/ble_ibeacon.c"
509                    "host/nimble/nimble/nimble/host/src/ble_hs_atomic.c"
510                    "host/nimble/nimble/nimble/host/src/ble_sm_alg.c"
511                    "host/nimble/nimble/nimble/host/src/ble_hs_stop.c"
512                    "host/nimble/nimble/nimble/host/src/ble_hs.c"
513                    "host/nimble/nimble/nimble/host/src/ble_hs_hci_evt.c"
514                    "host/nimble/nimble/nimble/host/src/ble_hs_mqueue.c"
515                    "host/nimble/nimble/nimble/host/src/ble_hs_periodic_sync.c"
516                    "host/nimble/nimble/nimble/host/src/ble_att.c"
517                    "host/nimble/nimble/nimble/host/src/ble_gattc.c"
518                    "host/nimble/nimble/nimble/host/src/ble_store.c"
519                    "host/nimble/nimble/nimble/host/src/ble_sm_lgcy.c"
520                    "host/nimble/nimble/nimble/host/src/ble_hs_cfg.c"
521                    "host/nimble/nimble/nimble/host/src/ble_monitor.c"
522                    "host/nimble/nimble/nimble/host/src/ble_att_clt.c"
523                    "host/nimble/nimble/nimble/host/src/ble_l2cap_coc.c"
524                    "host/nimble/nimble/nimble/host/src/ble_hs_mbuf.c"
525                    "host/nimble/nimble/nimble/host/src/ble_att_cmd.c"
526                    "host/nimble/nimble/nimble/host/src/ble_hs_log.c"
527                    "host/nimble/nimble/nimble/host/src/ble_eddystone.c"
528                    "host/nimble/nimble/nimble/host/src/ble_hs_startup.c"
529                    "host/nimble/nimble/nimble/host/src/ble_l2cap_sig.c"
530                    "host/nimble/nimble/nimble/host/src/ble_gap.c"
531                    "host/nimble/nimble/nimble/host/src/ble_sm_cmd.c"
532                    "host/nimble/nimble/nimble/host/src/ble_uuid.c"
533                    "host/nimble/nimble/nimble/host/src/ble_hs_pvcy.c"
534                    "host/nimble/nimble/nimble/host/src/ble_hs_flow.c"
535                    "host/nimble/nimble/nimble/host/src/ble_l2cap.c"
536                    "host/nimble/nimble/nimble/host/src/ble_sm_sc.c"
537                    "host/nimble/nimble/nimble/host/src/ble_hs_misc.c"
538                    "host/nimble/nimble/nimble/host/src/ble_gatts.c"
539                    "host/nimble/nimble/nimble/host/src/ble_hs_adv.c"
540                    "host/nimble/nimble/nimble/host/src/ble_hs_hci.c"
541                    "host/nimble/nimble/nimble/host/src/ble_hs_hci_util.c"
542                    "host/nimble/nimble/nimble/host/src/ble_hs_resolv.c"
543                    "host/nimble/nimble/nimble/host/store/ram/src/ble_store_ram.c"
544                    "host/nimble/nimble/nimble/host/store/config/src/ble_store_config.c"
545                    "host/nimble/nimble/nimble/host/store/config/src/ble_store_nvs.c"
546                    "host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c"
547                    "host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c"
548                    "host/nimble/nimble/porting/nimble/src/endian.c"
549                    "host/nimble/nimble/porting/nimble/src/os_cputime_pwr2.c"
550                    "host/nimble/nimble/porting/nimble/src/hal_timer.c"
551                    "host/nimble/nimble/porting/nimble/src/os_mempool.c"
552                    "host/nimble/nimble/porting/nimble/src/os_msys_init.c"
553                    "host/nimble/nimble/porting/nimble/src/nimble_port.c"
554                    "host/nimble/nimble/porting/nimble/src/mem.c"
555                    "host/nimble/nimble/porting/nimble/src/os_mbuf.c"
556                    "host/nimble/nimble/porting/nimble/src/os_cputime.c"
557                    "host/nimble/esp-hci/src/esp_nimble_hci.c"
558                    "host/nimble/port/src/esp_nimble_mem.c")
559
560            list(APPEND srcs
561                    "common/btc/profile/esp/blufi/nimble_host/esp_blufi.c")
562        if(CONFIG_BLE_MESH)
563            list(APPEND srcs "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c")
564        endif()
565
566        if(CONFIG_BT_NIMBLE_MESH)
567
568            list(APPEND include_dirs
569                host/nimble/nimble/nimble/host/mesh/include)
570
571            list(APPEND srcs "host/nimble/nimble/nimble/host/mesh/src/shell.c"
572                        "host/nimble/nimble/nimble/host/mesh/src/friend.c"
573                        "host/nimble/nimble/nimble/host/mesh/src/crypto.c"
574                        "host/nimble/nimble/nimble/host/mesh/src/settings.c"
575                        "host/nimble/nimble/nimble/host/mesh/src/adv.c"
576                        "host/nimble/nimble/nimble/host/mesh/src/model_srv.c"
577                        "host/nimble/nimble/nimble/host/mesh/src/beacon.c"
578                        "host/nimble/nimble/nimble/host/mesh/src/glue.c"
579                        "host/nimble/nimble/nimble/host/mesh/src/model_cli.c"
580                        "host/nimble/nimble/nimble/host/mesh/src/transport.c"
581                        "host/nimble/nimble/nimble/host/mesh/src/prov.c"
582                        "host/nimble/nimble/nimble/host/mesh/src/mesh.c"
583                        "host/nimble/nimble/nimble/host/mesh/src/nodes.c"
584                        "host/nimble/nimble/nimble/host/mesh/src/access.c"
585                        "host/nimble/nimble/nimble/host/mesh/src/cfg_srv.c"
586                        "host/nimble/nimble/nimble/host/mesh/src/cfg_cli.c"
587                        "host/nimble/nimble/nimble/host/mesh/src/light_model.c"
588                        "host/nimble/nimble/nimble/host/mesh/src/health_cli.c"
589                        "host/nimble/nimble/nimble/host/mesh/src/lpn.c"
590                        "host/nimble/nimble/nimble/host/mesh/src/proxy.c"
591                        "host/nimble/nimble/nimble/host/mesh/src/health_srv.c"
592                        "host/nimble/nimble/nimble/host/mesh/src/testing.c"
593                        "host/nimble/nimble/nimble/host/mesh/src/net.c")
594
595        endif()
596    endif()
597
598endif()
599
600# requirements can't depend on config
601idf_component_register(SRCS "${srcs}"
602                INCLUDE_DIRS "${include_dirs}"
603                PRIV_INCLUDE_DIRS "${priv_include_dirs}"
604                REQUIRES nvs_flash soc esp_timer esp_pm esp_phy
605                PRIV_REQUIRES esp_ipc
606                LDFRAGMENTS "linker.lf")
607
608if(CONFIG_BT_ENABLED)
609    target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-implicit-fallthrough -Wno-unused-const-variable)
610    if(CONFIG_IDF_TARGET_ESP32)
611        target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32/esp32")
612        target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
613
614        target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_hli_vectors_bt")
615    elseif(CONFIG_IDF_TARGET_ESP32C3)
616        target_link_libraries(${COMPONENT_LIB} INTERFACE
617                "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32c3")
618        target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
619    elseif(CONFIG_IDF_TARGET_ESP32S3)
620        target_link_libraries(${COMPONENT_LIB} INTERFACE
621                "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
622        target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
623    endif()
624endif()
625
626if(CONFIG_BT_NIMBLE_MESH)
627    set_source_files_properties("host/nimble/nimble/nimble/host/mesh/src/net.c"
628        PROPERTIES COMPILE_FLAGS -Wno-type-limits)
629endif()
630
631if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE AND CONFIG_BT_NIMBLE_ENABLED)
632    # some variables in NimBLE are only used by asserts
633    target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-but-set-variable -Wno-unused-variable)
634endif()
635
636if(NOT CMAKE_BUILD_EARLY_EXPANSION)
637    set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/host/bluedroid/bta/hf_ag/bta_ag_cmd.c"
638                                "${CMAKE_CURRENT_LIST_DIR}/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c"
639                                 PROPERTIES COMPILE_FLAGS "-fjump-tables -ftree-switch-conversion")
640endif()
641