1# Copyright (C) 2021-2022 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("//build/ohos.gni")
15import("//build/ohos_var.gni")
16import("//foundation/communication/bluetooth_service/bluetooth.gni")
17
18SUBSYSTEM_DIR = "//foundation/communication"
19BT_ROOT = "//foundation/communication/bluetooth_service/services/bluetooth"
20
21ohos_shared_library("bluetooth_server") {
22  # sanitize = {
23  #   cfi = true
24  #   blocklist = "./bluetooth_server_blocklist.txt"
25  # }
26  stack_protector_ret = true
27  include_dirs = [
28    "include",
29    "//foundation/communication/bluetooth/frameworks/inner/include",
30    "//foundation/communication/bluetooth/interfaces/inner_api/include",
31    "//foundation/communication/bluetooth_service/services/bluetooth/service/include",
32    "//foundation/communication/bluetooth_service/services/bluetooth/service/src/ble",
33    "//foundation/communication/bluetooth_service/services/bluetooth/service/src/permission",
34    "//foundation/communication/bluetooth_service/services/bluetooth/stack/include",
35    "$BT_ROOT/common",
36  ]
37
38  sources = [
39    "src/bluetooth_ble_advertiser_server.cpp",
40    "src/bluetooth_ble_central_manager_server.cpp",
41    "src/bluetooth_ble_filter_matcher.cpp",
42    "src/bluetooth_gatt_client_server.cpp",
43    "src/bluetooth_gatt_server_server.cpp",
44    "src/bluetooth_hitrace.cpp",
45    "src/bluetooth_host_dumper.cpp",
46    "src/bluetooth_host_server.cpp",
47    "src/bluetooth_socket_server.cpp",
48    "src/bluetooth_utils_server.cpp",
49  ]
50
51  defines = []
52
53  if (bluetooth_service_a2dp_sink_feature) {
54    defines += [ "BLUETOOTH_A2DP_SINK_FEATURE" ]
55
56    sources += [ "src/bluetooth_a2dp_sink_server.cpp" ]
57  }
58
59  if (bluetooth_service_a2dp_source_feature) {
60    defines += [ "BLUETOOTH_A2DP_SRC_FEATURE" ]
61
62    sources += [ "src/bluetooth_a2dp_source_server.cpp" ]
63  }
64
65  if (bluetooth_service_avrcp_ct_feature) {
66    defines += [ "BLUETOOTH_AVRCP_CT_FEATURE" ]
67
68    sources += [ "src/bluetooth_avrcp_ct_server.cpp" ]
69  }
70
71  if (bluetooth_service_avrcp_tg_feature) {
72    defines += [ "BLUETOOTH_AVRCP_TG_FEATURE" ]
73
74    sources += [ "src/bluetooth_avrcp_tg_server.cpp" ]
75  }
76
77  if (bluetooth_service_hfp_ag_feature) {
78    defines += [ "BLUETOOTH_HFP_AG_FEATURE" ]
79
80    sources += [ "src/bluetooth_hfp_ag_server.cpp" ]
81  }
82
83  if (bluetooth_service_hfp_hf_feature) {
84    defines += [ "BLUETOOTH_HFP_HF_FEATURE" ]
85
86    sources += [ "src/bluetooth_hfp_hf_server.cpp" ]
87  }
88
89  if (bluetooth_service_hid_host_feature) {
90    defines += [ "BLUETOOTH_HID_HOST_FEATURE" ]
91
92    sources += [ "src/bluetooth_hid_host_server.cpp" ]
93  }
94
95  if (bluetooth_service_pan_feature) {
96    defines += [ "BLUETOOTH_PAN_FEATURE" ]
97
98    sources += [ "src/bluetooth_pan_server.cpp" ]
99  }
100
101  deps = [
102    "$BT_ROOT/etc/init:etc",
103    "$SUBSYSTEM_DIR/bluetooth_service/services/bluetooth/ipc:btipc_service",
104    "$SUBSYSTEM_DIR/bluetooth_service/services/bluetooth/service:btservice",
105  ]
106
107  external_deps = [
108    "ability_base:base",
109    "access_token:libaccesstoken_sdk",
110    "bluetooth:btcommon",
111    "c_utils:utils",
112    "eventhandler:libeventhandler",
113    "hilog:libhilog",
114    "hisysevent:libhisysevent",
115    "hitrace:hitrace_meter",
116    "ipc:ipc_core",
117    "safwk:system_ability_fwk",
118    "samgr:samgr_proxy",
119  ]
120
121  part_name = "bluetooth_service"
122  subsystem_name = "communication"
123}
124
125group("bluetooth_codec") {
126  deps = [ "$BT_ROOT/service:btsbc" ]
127}
128