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("//build/ohos.gni")
15import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
16import("//drivers/peripheral/audio/audio.gni")
17
18declare_args() {
19  bluetooth_a2dp_hdi = false
20}
21
22config("hdi_audio_config") {
23  visibility = [ ":*" ]
24
25  cflags = [
26    "-fPIC",
27    "-Wall",
28    "-Wextra",
29    "-Werror",
30    "-DGST_DISABLE_DEPRECATED",
31    "-DHAVE_CONFIG_H",
32    "-fno-strict-aliasing",
33    "-Wno-builtin-requires-header",
34    "-Wno-int-conversion",
35    "-Wno-unused-parameter",
36    "-Wno-thread-safety-attributes",
37    "-Wno-inconsistent-missing-override",
38    "-fno-rtti",
39    "-fno-exceptions",
40    "-ffunction-sections",
41    "-fdata-sections",
42  ]
43
44  ldflags = [ "-Wl" ]
45}
46
47ohos_shared_library("hdi_audio_bluetooth") {
48  if (bluetooth_a2dp_hdi) {
49    defines = [ "A2DP_HDI_SERVICE" ]
50  }
51
52  sources = [
53    "//third_party/cJSON/cJSON.c",
54    "src/audio_adapter.cpp",
55    "src/audio_adapter_info_common.cpp",
56    "src/audio_bluetooth_manager.cpp",
57    "src/audio_common.cpp",
58    "src/audio_manager.cpp",
59    "src/audio_render.cpp",
60    "src/bluetooth_a2dp_audio_src_observer_stub.cpp",
61    "src/bluetooth_a2dp_src_observer.cpp",
62    "src/fast_audio_render.cpp",
63  ]
64
65  include_dirs = [
66    "//drivers/peripheral/bluetooth/audio/hal/hdi_passthrough/include",
67    "//drivers/peripheral/bluetooth/audio/supportlibs/adm_adapter/include",
68    "//third_party/cJSON",
69    "//drivers/peripheral/bluetooth/audio/interfaces/include",
70    "//third_party/bounds_checking_function/include",
71  ]
72
73  deps = [ "//foundation/communication/bluetooth_service/services/bluetooth/ipc:btipc_static" ]
74
75  if (is_standard_system) {
76    external_deps = [
77      "hdf_core:libhdf_host",
78      "hdf_core:libhdf_ipc_adapter",
79      "hdf_core:libhdf_utils",
80      "hdf_core:libhdi",
81      "hilog:libhilog",
82    ]
83  } else {
84    external_deps = [ "hilog:libhilog" ]
85  }
86  external_deps += [
87    "c_utils:utils",
88    "ipc:ipc_single",
89    "samgr:samgr_proxy",
90  ]
91
92  public_configs = [ ":hdi_audio_config" ]
93
94  install_images = [ chipset_base_dir ]
95  subsystem_name = "hdf"
96  part_name = "drivers_peripheral_bluetooth"
97}
98