1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("../../../dsoftbus.gni")
15import("../../common/dfx/dsoftbus_dfx.gni")
16
17native_source_path = rebase_path("$dsoftbus_root_path")
18disc_dep_dir = "dsoftbus_enhance/core/discovery/ble"
19disc_enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
20                            [
21                              "$native_source_path",
22                              "$disc_dep_dir",
23                            ],
24                            "value")
25
26ble_discovery_inc = [
27  "$dsoftbus_root_path/core/broadcast/common/include",
28  "$dsoftbus_root_path/core/discovery/ble/dispatcher/include",
29  "$dsoftbus_root_path/core/discovery/ble/approach_ble/include",
30  "$dsoftbus_root_path/core/discovery/ble/share_ble/include",
31  "$dsoftbus_root_path/core/discovery/ble/softbus_ble/include",
32  "$dsoftbus_root_path/core/discovery/ble/touch_ble/include",
33  "$dsoftbus_root_path/core/discovery/ble/virtual_link_ble/include",
34  "$dsoftbus_root_path/core/common/include",
35  "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
36]
37
38ble_discovery_deps = [ "$dsoftbus_dfx_path/log:softbus_dfx_log" ]
39
40if (!support_bluetooth) {
41  ble_discovery_src = [ "$dsoftbus_root_path/core/discovery/ble/dispatcher/src/disc_ble_dispatcher_virtual.c" ]
42} else {
43  if (!dsoftbus_feature_disc_ble) {
44    ble_discovery_src = [ "$dsoftbus_root_path/core/discovery/ble/dispatcher/src/disc_ble_dispatcher_virtual.c" ]
45  } else {
46    ble_discovery_src = [
47      "$dsoftbus_root_path/core/discovery/ble/dispatcher/src/disc_ble_dispatcher.c",
48      "$dsoftbus_root_path/core/discovery/ble/softbus_ble/src/disc_ble_utils.c",
49      "$dsoftbus_root_path/core/discovery/ble/softbus_ble/src/disc_ble.c",
50    ]
51  }
52}
53
54if (dsoftbus_feature_disc_ble && disc_enhanced) {
55  import(
56      "$dsoftbus_root_path/dsoftbus_enhance/core/discovery/ble/virtual_link_ble/virtual_link_ble.gni")
57
58  ble_discovery_src += vlink_sources
59  ble_discovery_inc += vlink_include_dirs
60  ble_discovery_deps += vlink_deps
61} else {
62  ble_discovery_src += [ "$dsoftbus_root_path/core/discovery/ble/virtual_link_ble/src/disc_virtual_link_ble_virtual.c" ]
63}
64
65if (disc_enhanced) {
66  import(
67      "$dsoftbus_root_path/dsoftbus_enhance/core/discovery/ble/approach_ble/approach_ble.gni")
68  import(
69      "$dsoftbus_root_path/dsoftbus_enhance/core/discovery/ble/share_ble/share_ble.gni")
70  import(
71      "$dsoftbus_root_path/dsoftbus_enhance/core/discovery/ble/touch_ble/touch_ble.gni")
72
73  ble_discovery_src += share_sources + approach_sources + touch_sources
74  ble_discovery_inc +=
75      share_include_dirs + approach_include_dirs + touch_include_dirs
76  ble_discovery_deps += share_deps + approach_deps + touch_deps
77} else {
78  ble_discovery_src += [
79    "$dsoftbus_root_path/core/discovery/ble/share_ble/src/disc_share_ble_virtual.c",
80    "$dsoftbus_root_path/core/discovery/ble/approach_ble/src/disc_approach_ble_virtual.c",
81    "$dsoftbus_root_path/core/discovery/ble/touch_ble/src/disc_touch_ble_virtual.c",
82  ]
83}
84