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("../../../adapter/common/net/bluetooth/net_bluetooth.gni")
15import("../../../dsoftbus.gni")
16
17native_source_path = rebase_path("$dsoftbus_root_path")
18conn_ble_dir = "dsoftbus_enhance/core/connection/ble_direct"
19enhanced_conn_ble = exec_script("$dsoftbus_root_path/check_sub_module.py",
20                                [
21                                  "$native_source_path",
22                                  "$conn_ble_dir",
23                                ],
24                                "value")
25conn_coc_dir = "dsoftbus_enhance/core/connection/coc"
26enhanced_conn_coc = exec_script("$dsoftbus_root_path/check_sub_module.py",
27                                [
28                                  "$native_source_path",
29                                  "$conn_coc_dir",
30                                ],
31                                "value")
32ble_connection_external_deps = []
33if (!support_bluetooth) {
34  ble_connection_src = [
35    "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_direct_virtual.c",
36    "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_virtual.c",
37    "$dsoftbus_root_path/adapter/common/net/bluetooth/common/softbus_adapter_bt_common_virtual.c",
38  ]
39  ble_connection_inc = [
40    "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
41    "$dsoftbus_root_path/core/connection/ble/include",
42    "$dsoftbus_root_path/core/common/include",
43  ]
44} else {
45  if (!dsoftbus_feature_conn_ble) {
46    ble_connection_src = [
47      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_direct_virtual.c",
48      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_virtual.c",
49      "$dsoftbus_root_path/adapter/common/net/bluetooth/common/softbus_adapter_bt_common_virtual.c",
50    ]
51    ble_connection_inc = [
52      "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
53      "$dsoftbus_root_path/core/connection/ble/include",
54      "$dsoftbus_root_path/core/common/include",
55    ]
56    if (dsoftbus_feature_conn_br) {
57      ble_connection_src += adapter_net_br_src
58      ble_connection_inc += adapter_ble_inc
59      ble_connection_external_deps += adapter_ble_external_deps
60    }
61  } else {
62    ble_connection_src = [
63      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_client.c",
64      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_connection.c",
65      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_manager.c",
66      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_send_queue.c",
67      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_server.c",
68      "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_trans.c",
69    ]
70    ble_connection_inc = [
71      "$dsoftbus_root_path/core/connection/ble/include",
72      "$dsoftbus_root_path/core/connection/ble/src",
73      "$dsoftbus_root_path/core/common/include",
74    ]
75    if (enhanced_conn_ble == true) {
76      import(
77          "../../../dsoftbus_enhance/core/connection/ble_direct/ble_direct.gni")
78
79      ble_connection_src += ble_direct_connection_src
80      ble_connection_inc += ble_direct_connection_inc
81    } else {
82      ble_connection_src += [ "$dsoftbus_root_path/core/connection/ble/src/softbus_conn_ble_direct_virtual.c" ]
83    }
84    if (enhanced_conn_coc == true) {
85      ble_connection_src += [
86        "$dsoftbus_root_path/dsoftbus_enhance/core/connection/coc/src/ble_protocol_interface_factory.c",
87        "$dsoftbus_root_path/dsoftbus_enhance/core/connection/coc/src/softbus_adapter_coc.c",
88        "$dsoftbus_root_path/dsoftbus_enhance/core/connection/coc/src/softbus_conn_ble_coc.c",
89      ]
90      ble_connection_inc +=
91          [ "$dsoftbus_root_path/dsoftbus_enhance/core/connection/coc/include" ]
92    } else {
93      ble_connection_src += [ "$dsoftbus_root_path/core/connection/ble/src/ble_protocol_interface_factory.c" ]
94    }
95    ble_connection_src += adapter_ble_src
96    ble_connection_inc += adapter_ble_inc
97    ble_connection_external_deps += adapter_ble_external_deps
98  }
99}
100