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)
13
14if(CONFIG_BT_MESH_V1d1)
15 target_sources(app PRIVATE
16  src/dfu_blob_common.c
17 )
18endif()
19
20if(CONFIG_SETTINGS)
21
22 target_sources(app PRIVATE
23  src/test_persistence.c
24  src/test_replay_cache.c
25  src/test_provision.c
26 )
27
28 if(CONFIG_BT_MESH_V1d1)
29  target_sources(app PRIVATE
30   src/test_dfu.c
31   src/test_blob.c
32   src/test_sar.c
33   src/test_lcd.c
34 )
35 endif()
36
37if(CONFIG_BT_MESH_USES_MBEDTLS_PSA)
38 target_sources(app PRIVATE
39  src/distribute_keyid.c
40  src/psa_its_emul.c
41 )
42endif()
43
44elseif(CONFIG_BT_MESH_GATT_PROXY)
45
46 target_sources(app PRIVATE
47  src/test_advertiser.c
48 )
49
50 if(CONFIG_BT_MESH_V1d1)
51  target_sources(app PRIVATE
52  src/test_beacon.c
53  )
54  endif()
55
56elseif(CONFIG_BT_CTLR_LOW_LAT)
57
58 target_sources(app PRIVATE
59  src/test_friendship.c
60  src/test_transport.c
61 )
62
63else()
64
65 target_sources(app PRIVATE
66  src/test_transport.c
67  src/test_friendship.c
68  src/test_provision.c
69  src/test_beacon.c
70  src/test_scanner.c
71  src/test_heartbeat.c
72  src/test_access.c
73  src/test_iv_index.c
74  src/test_advertiser.c
75 )
76
77 if(CONFIG_BT_MESH_V1d1)
78  target_sources(app PRIVATE
79   src/test_blob.c
80   src/test_op_agg.c
81   src/test_sar.c
82   src/test_cdp1.c
83  )
84 endif()
85
86endif()
87
88zephyr_include_directories(
89  ${BSIM_COMPONENTS_PATH}/libUtilv1/src/
90  ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
91)
92
93# The mbedTLS PSA ITS is not thread safe.
94# The issue: https://github.com/zephyrproject-rtos/zephyr/issues/59362
95# Also, it isn't possible to use "native" ITS implementation since
96# mbedTLS includes headers that do not exist.
97# This linker option allows linking custom ITS implementation instead of
98# precompiled objects from the mbedTLS library to run it in parallel.
99if(CONFIG_BT_MESH_USES_MBEDTLS_PSA)
100  zephyr_ld_options(
101    ${LINKERFLAGPREFIX},--allow-multiple-definition
102    )
103endif()
104