1# SPDX-License-Identifier: Apache-2.0
2
3cmake_minimum_required(VERSION 3.20.0)
4
5find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6project(bsim_test_mesh)
7
8target_sources(app PRIVATE
9 src/main.c
10 src/mesh_test.c
11 src/friendship_common.c
12 src/gatt_common.c
13 src/dfu_blob_common.c
14)
15
16if(CONFIG_SETTINGS)
17
18 target_sources(app PRIVATE
19  src/test_persistence.c
20  src/test_replay_cache.c
21  src/test_provision.c
22  src/test_dfu.c
23  src/test_blob.c
24  src/test_sar.c
25  src/test_lcd.c
26  src/test_brg.c
27)
28
29if(CONFIG_BT_MESH_USES_MBEDTLS_PSA)
30 target_sources(app PRIVATE
31  src/distribute_keyid.c
32  src/psa_its_emul.c
33 )
34endif()
35
36if(CONFIG_BT_MESH_GATT_PROXY AND CONFIG_BT_MESH_PROXY_SOLICITATION)
37 target_sources(app PRIVATE
38  src/test_proxy_sol.c
39 )
40endif()
41
42elseif(CONFIG_BT_MESH_GATT_PROXY)
43
44 target_sources(app PRIVATE
45  src/test_advertiser.c
46  src/test_suspend.c
47  src/test_beacon.c
48 )
49
50elseif(CONFIG_BT_CTLR_LOW_LAT)
51
52 target_sources(app PRIVATE
53  src/test_friendship.c
54  src/test_transport.c
55  src/test_suspend.c
56  src/test_advertiser.c
57 )
58
59else()
60
61 target_sources(app PRIVATE
62  src/test_transport.c
63  src/test_friendship.c
64  src/test_provision.c
65  src/test_beacon.c
66  src/test_scanner.c
67  src/test_heartbeat.c
68  src/test_access.c
69  src/test_iv_index.c
70  src/test_advertiser.c
71  src/test_suspend.c
72  src/test_blob.c
73  src/test_op_agg.c
74  src/test_sar.c
75  src/test_cdp1.c
76  src/test_brg.c
77 )
78
79endif()
80
81zephyr_include_directories(
82  ${BSIM_COMPONENTS_PATH}/libUtilv1/src/
83  ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
84)
85
86# The mbedTLS PSA ITS is not thread safe.
87# The issue: https://github.com/zephyrproject-rtos/zephyr/issues/59362
88# Also, it isn't possible to use "native" ITS implementation since
89# mbedTLS includes headers that do not exist.
90# This linker option allows linking custom ITS implementation instead of
91# precompiled objects from the mbedTLS library to run it in parallel.
92if(CONFIG_BT_MESH_USES_MBEDTLS_PSA)
93  zephyr_ld_options(
94    ${LINKERFLAGPREFIX},--allow-multiple-definition
95    )
96endif()
97