1# Copyright (c) 2022-2023 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
14hdf_audio_path = "./../.."
15hdf_hdi_service_path = "./.."
16import("//build/ohos.gni")
17import("$hdf_audio_path/audio.gni")
18
19if (defined(ohos_lite)) {
20  ohos_shared_library("audio_capture_adapter") {
21    sources = [
22      "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_capture.c",
23      "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_common.c",
24      "$hdf_hdi_service_path/primary_impl/src/audio_common.c",
25    ]
26
27    include_dirs = [
28      "$hdf_hdi_service_path/primary_impl/include",
29      "$hdf_audio_path/supportlibs/adm_adapter/include",
30      "$hdf_audio_path/supportlibs/interfaces/include",
31      "//base/hiviewdfx/hilog_lite/interfaces/native/kits/",
32      "$hdf_hdi_service_path/vendor_interface/utils",
33    ]
34
35    public_deps = [ "drivers_interface_audio:libaudio_proxy_4.0" ]
36    external_deps = [
37      "bounds_checking_function:libsec_shared",
38      "hdf_core:libhdf_utils",
39      "hilog_lite:hilog_shared",
40    ]
41    subsystem_name = "hdf"
42    part_name = "drivers_peripheral_audio"
43  }
44
45  ohos_shared_library("audio_render_adapter") {
46    sources = [
47      "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_common.c",
48      "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_render.c",
49      "$hdf_hdi_service_path/primary_impl/src/audio_common.c",
50    ]
51
52    public_deps = [ "drivers_interface_audio:libaudio_proxy_4.0" ]
53
54    include_dirs = [
55      "$hdf_hdi_service_path/primary_impl/include",
56      "$hdf_audio_path/supportlibs/adm_adapter/include",
57      "$hdf_audio_path/supportlibs/interfaces/include",
58      "//base/hiviewdfx/hilog_lite/interfaces/native/kits/",
59      "$hdf_hdi_service_path/vendor_interface/utils",
60    ]
61
62    external_deps = [
63      "bounds_checking_function:libsec_shared",
64      "hilog_lite:hilog_shared",
65    ]
66    if (enable_audio_hal_hdf_log) {
67      defines = [ "AUDIO_HDF_LOG" ]
68    }
69    subsystem_name = "hdf"
70    part_name = "drivers_peripheral_audio"
71  }
72} else {
73  ohos_shared_library("audio_capture_adapter") {
74    sources = [ "$hdf_hdi_service_path/primary_impl/src/audio_common.c" ]
75    if (drivers_peripheral_audio_feature_alsa_lib) {
76      sources += [
77        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_lib_capture.c",
78        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_snd_capture.c",
79        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_soundcard.c",
80        "//third_party/cJSON/cJSON.c",
81      ]
82      if (defined(is_emulator) && is_emulator) {
83        sources += [
84          "//device/hmos_emulator/hardware/audio/audio_alsa/vendor_capture.c",
85        ]
86      } else {
87        sources += [ "//device/board/${product_company}/${device_name}/audio_alsa/vendor_capture.c" ]
88      }
89    } else {
90      sources += [
91        "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_capture.c",
92        "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_common.c",
93      ]
94    }
95    include_dirs = [
96      "$hdf_hdi_service_path/primary_impl/include",
97      "$hdf_audio_path/supportlibs/interfaces/include",
98      "$hdf_hdi_service_path/vendor_interface/utils",
99    ]
100
101    public_deps = []
102    if (drivers_peripheral_audio_feature_alsa_lib) {
103      include_dirs += [
104        "//third_party/cJSON",
105        "//third_party/alsa-lib/include",
106        "$hdf_audio_path/supportlibs/alsa_adapter/include",
107      ]
108      if (defined(is_emulator) && is_emulator) {
109        include_dirs += [ "//device/hmos_emulator/hardware/audio/audio_alsa" ]
110      } else {
111        include_dirs +=
112            [ "//device/board/${product_company}/${device_name}/audio_alsa" ]
113      }
114      public_deps += [ "//third_party/alsa-lib:libasound" ]
115    } else {
116      include_dirs += [ "$hdf_audio_path/supportlibs/adm_adapter/include" ]
117    }
118
119    defines = [ "AUDIO_HDI_SERVICE_MODE" ]
120
121    if (enable_audio_hal_hdf_log) {
122      defines += [ "AUDIO_HDF_LOG" ]
123    }
124
125    if (defined(is_emulator) && is_emulator) {
126      defines += [ "EMULATOR_ENABLED" ]
127    }
128
129    if (is_standard_system) {
130      external_deps = [
131        "drivers_interface_audio:libaudio_proxy_4.0",
132        "hdf_core:libhdf_utils",
133        "hilog:libhilog",
134      ]
135      if (enable_c_utils) {
136        external_deps += [ "c_utils:utils" ]
137      }
138    } else if (defined(ohos_lite)) {
139      external_deps = [ "hilog_lite:hilog_shared" ]
140    } else {
141      external_deps = [ "hilog:libhilog" ]
142    }
143    external_deps += [ "bounds_checking_function:libsec_shared" ]
144
145    install_images = [ chipset_base_dir ]
146    subsystem_name = "hdf"
147    part_name = "drivers_peripheral_audio"
148  }
149
150  ohos_shared_library("audio_render_adapter") {
151    sources = [ "$hdf_hdi_service_path/primary_impl/src/audio_common.c" ]
152    if (drivers_peripheral_audio_feature_alsa_lib) {
153      sources += [
154        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_lib_render.c",
155        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_snd_render.c",
156        "$hdf_audio_path/supportlibs/alsa_adapter/src/alsa_soundcard.c",
157        "//third_party/cJSON/cJSON.c",
158      ]
159      if (defined(is_emulator) && is_emulator) {
160        sources += [
161          "//device/hmos_emulator/hardware/audio/audio_alsa/vendor_render.c",
162        ]
163      } else {
164        sources += [ "//device/board/${product_company}/${device_name}/audio_alsa/vendor_render.c" ]
165      }
166    } else {
167      sources += [
168        "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_common.c",
169        "$hdf_audio_path/supportlibs/adm_adapter/src/audio_interface_lib_render.c",
170      ]
171    }
172
173    include_dirs = [
174      "$hdf_hdi_service_path/primary_impl/include",
175      "$hdf_audio_path/supportlibs/interfaces/include",
176      "$hdf_hdi_service_path/vendor_interface/utils",
177    ]
178
179    public_deps = []
180    if (drivers_peripheral_audio_feature_alsa_lib) {
181      include_dirs += [
182        "//third_party/cJSON",
183        "//third_party/alsa-lib/include",
184        "$hdf_audio_path/supportlibs/alsa_adapter/include",
185      ]
186      if (defined(is_emulator) && is_emulator) {
187        include_dirs += [ "//device/hmos_emulator/hardware/audio/audio_alsa" ]
188      } else {
189        include_dirs +=
190            [ "//device/board/${product_company}/${device_name}/audio_alsa" ]
191      }
192      public_deps += [ "//third_party/alsa-lib:libasound" ]
193    } else {
194      include_dirs += [ "$hdf_audio_path/supportlibs/adm_adapter/include" ]
195    }
196
197    defines = [ "AUDIO_HDI_SERVICE_MODE" ]
198
199    if (enable_audio_hal_hdf_log) {
200      defines += [ "AUDIO_HDF_LOG" ]
201    }
202
203    if (defined(is_emulator) && is_emulator) {
204      defines += [ "EMULATOR_ENABLED" ]
205    }
206
207    if (is_standard_system) {
208      external_deps = [
209        "drivers_interface_audio:libaudio_proxy_4.0",
210        "hdf_core:libhdf_utils",
211        "hilog:libhilog",
212      ]
213      if (enable_c_utils) {
214        external_deps += [ "c_utils:utils" ]
215      }
216    } else if (defined(ohos_lite)) {
217      external_deps = [ "hilog_lite:hilog_shared" ]
218    } else {
219      external_deps = [ "hilog:libhilog" ]
220    }
221    external_deps += [ "bounds_checking_function:libsec_shared" ]
222
223    install_images = [ chipset_base_dir ]
224    subsystem_name = "hdf"
225    part_name = "drivers_peripheral_audio"
226  }
227}
228