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 = "./../.."
15
16import("//build/ohos.gni")
17import("$hdf_audio_path/audio.gni")
18
19if (defined(ohos_lite)) {
20} else {
21  ohos_executable("audio_sample_event") {
22    include_dirs = [
23      "$hdf_audio_path/interfaces/include",
24      "$hdf_audio_path/hal/hdi_passthrough/include",
25      "$hdf_audio_path/hal/hdi_binder/server/include",
26    ]
27
28    sources = [
29      "$hdf_audio_path/hal/hdi_binder/server/src/hdf_audio_events.c",
30      "framework_event.c",
31    ]
32
33    defines = []
34
35    if (is_standard_system) {
36      external_deps = [
37        "hdf_core:libhdf_ipc_adapter",
38        "hdf_core:libhdf_utils",
39        "hdf_core:libhdi",
40        "hilog:libhilog",
41      ]
42      if (enable_c_utils) {
43        external_deps += [ "c_utils:utils" ]
44      }
45    } else if (defined(ohos_lite)) {
46      external_deps = [ "hilog_lite:hilog_shared" ]
47    } else {
48      external_deps = [ "hilog:libhilog" ]
49    }
50
51    install_enable = true
52    install_images = [ chipset_base_dir ]
53    subsystem_name = "hdf"
54    part_name = "drivers_peripheral_audio"
55  }
56
57  ohos_executable("idl_render") {
58    include_dirs = [ "./" ]
59
60    sources = [
61      "framework_common.c",
62      "idl_render.c",
63    ]
64
65    defines = [ "IDL_SAMPLE" ]
66    if (drivers_peripheral_audio_feature_alsa_lib) {
67      defines += [ "ALSA_LIB_MODE" ]
68    }
69
70    if (is_standard_system) {
71      external_deps = [
72        "drivers_interface_audio:libaudio_proxy_4.0",
73        "hdf_core:libhdf_ipc_adapter",
74        "hdf_core:libhdf_utils",
75        "hdf_core:libhdi",
76        "hilog:libhilog",
77      ]
78      if (enable_c_utils) {
79        external_deps += [ "c_utils:utils" ]
80      }
81    } else if (defined(ohos_lite)) {
82      external_deps = [ "hilog_lite:hilog_shared" ]
83    } else {
84      external_deps = [ "hilog:libhilog" ]
85    }
86
87    install_enable = true
88    install_images = [ chipset_base_dir ]
89    subsystem_name = "hdf"
90    part_name = "drivers_peripheral_audio"
91  }
92
93  ohos_executable("idl_capture") {
94    include_dirs = [ "./" ]
95
96    sources = [
97      "framework_common.c",
98      "idl_capture.c",
99    ]
100
101    defines = [ "IDL_SAMPLE" ]
102    if (drivers_peripheral_audio_feature_alsa_lib) {
103      defines += [ "ALSA_LIB_MODE" ]
104    }
105    if (drivers_peripheral_audio_feature_community) {
106      defines += [ "AUDIO_FEATURE_COMMUNITY" ]
107    }
108
109    if (is_standard_system) {
110      external_deps = [
111        "drivers_interface_audio:libaudio_proxy_4.0",
112        "hdf_core:libhdf_utils",
113        "hilog:libhilog",
114      ]
115      if (enable_c_utils) {
116        external_deps += [ "c_utils:utils" ]
117      }
118    } else if (defined(ohos_lite)) {
119      external_deps = [ "hilog_lite:hilog_shared" ]
120    } else {
121      external_deps = [ "hilog:libhilog" ]
122    }
123
124    install_enable = true
125    install_images = [ chipset_base_dir ]
126    subsystem_name = "hdf"
127    part_name = "drivers_peripheral_audio"
128  }
129}
130
131group("idl_audio_sample") {
132  if (!defined(ohos_lite)) {
133    if (drivers_peripheral_audio_feature_hdf_proxy_stub == true) {
134      deps = [
135        ":idl_capture",
136        ":idl_render",
137      ]
138    }
139  }
140}
141