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 18if (drivers_peripheral_audio_hdf_proxy_stub == true) { 19 ohos_shared_library("hdi_audio_primary_server") { 20 include_dirs = [ 21 "//drivers/peripheral/audio/interfaces/include", 22 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 23 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 24 "//third_party/bounds_checking_function/include", 25 ] 26 27 sources = [ 28 "src/hdf_audio_events.c", 29 "src/hdf_audio_primary_server.c", 30 "src/hdf_audio_server_capture.c", 31 "src/hdf_audio_server_common.c", 32 "src/hdf_audio_server_render.c", 33 ] 34 35 deps = [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common" ] 36 if (!drivers_peripheral_audio_user_mode) { 37 if (drivers_peripheral_audio_rich_device == false) { 38 deps += [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio" ] 39 } else { 40 AUDIO_VENDOR_LIB_PATH = rebase_path( 41 "//vendor/$device_company/ap/prebuilt_scripts/ohos_vendor/vendorlibs/audio_hdi") 42 cmd = "if [ -f ${AUDIO_VENDOR_LIB_PATH}/BUILD.gn ]; then echo true; else echo false; fi" 43 HAVE_AUDIO_VENDOR_LIB = 44 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 45 if (HAVE_AUDIO_VENDOR_LIB) { 46 deps += [ "${AUDIO_VENDOR_LIB_PATH}:hdi_audio" ] 47 } 48 } 49 } else { 50 deps += [ "//device/soc/${product_company}/common/hal/media:hdi_audio" ] 51 } 52 53 defines = [] 54 if (is_standard_system) { 55 external_deps = [ 56 "c_utils:utils", 57 "hdf_core:libhdf_host", 58 "hdf_core:libhdf_utils", 59 "hiviewdfx_hilog_native:libhilog", 60 ] 61 } else { 62 external_deps = [ "hilog:libhilog" ] 63 } 64 65 if (enable_audio_hal_hdf_log) { 66 defines += [ "AUDIO_HDF_LOG" ] 67 } 68 69 install_images = [ chipset_base_dir ] 70 subsystem_name = "hdf" 71 part_name = "drivers_peripheral_audio" 72 } 73 74 ohos_shared_library("hdi_audio_usb_server") { 75 include_dirs = [ 76 "//drivers/peripheral/audio/interfaces/include", 77 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 78 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 79 "//third_party/bounds_checking_function/include", 80 ] 81 82 sources = [ 83 "src/hdf_audio_events.c", 84 "src/hdf_audio_server_capture.c", 85 "src/hdf_audio_server_common.c", 86 "src/hdf_audio_server_render.c", 87 "src/hdf_audio_usb_server.c", 88 ] 89 90 deps = [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common" ] 91 if (!drivers_peripheral_audio_user_mode) { 92 if (drivers_peripheral_audio_rich_device == false) { 93 deps += [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio" ] 94 } else { 95 AUDIO_VENDOR_LIB_PATH = rebase_path( 96 "//vendor/$device_company/ap/prebuilt_scripts/ohos_vendor/vendorlibs/audio_hdi") 97 cmd = "if [ -f ${AUDIO_VENDOR_LIB_PATH}/BUILD.gn ]; then echo true; else echo false; fi" 98 HAVE_AUDIO_VENDOR_LIB = 99 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 100 if (HAVE_AUDIO_VENDOR_LIB) { 101 deps += [ "${AUDIO_VENDOR_LIB_PATH}:hdi_audio" ] 102 } 103 } 104 } else { 105 deps += [ "//device/soc/${product_company}/common/hal/media:hdi_audio" ] 106 } 107 if (is_standard_system) { 108 external_deps = [ 109 "c_utils:utils", 110 "hdf_core:libhdf_host", 111 "hdf_core:libhdf_utils", 112 "hiviewdfx_hilog_native:libhilog", 113 ] 114 } else { 115 external_deps = [ "hilog:libhilog" ] 116 } 117 defines = [] 118 if (enable_audio_hal_hdf_log) { 119 defines += [ "AUDIO_HDF_LOG" ] 120 } 121 122 install_images = [ chipset_base_dir ] 123 subsystem_name = "hdf" 124 part_name = "drivers_peripheral_audio" 125 } 126 127 ohos_shared_library("hdi_audio_a2dp_server") { 128 include_dirs = [ 129 "//drivers/peripheral/audio/interfaces/include", 130 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 131 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 132 "//third_party/bounds_checking_function/include", 133 ] 134 135 sources = [ 136 "src/hdf_audio_a2dp_server.c", 137 "src/hdf_audio_events.c", 138 "src/hdf_audio_server_capture.c", 139 "src/hdf_audio_server_common.c", 140 "src/hdf_audio_server_render.c", 141 ] 142 143 deps = [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common" ] 144 if (!drivers_peripheral_audio_user_mode) { 145 if (drivers_peripheral_audio_rich_device == false) { 146 deps += [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio" ] 147 } else { 148 AUDIO_VENDOR_LIB_PATH = rebase_path( 149 "//vendor/$device_company/ap/prebuilt_scripts/ohos_vendor/vendorlibs/audio_hdi") 150 cmd = "if [ -f ${AUDIO_VENDOR_LIB_PATH}/BUILD.gn ]; then echo true; else echo false; fi" 151 HAVE_AUDIO_VENDOR_LIB = 152 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 153 if (HAVE_AUDIO_VENDOR_LIB) { 154 deps += [ "${AUDIO_VENDOR_LIB_PATH}:hdi_audio" ] 155 } 156 } 157 } else { 158 deps += [ "//device/soc/${product_company}/common/hal/media:hdi_audio" ] 159 } 160 if (is_standard_system) { 161 external_deps = [ 162 "c_utils:utils", 163 "hdf_core:libhdf_host", 164 "hdf_core:libhdf_utils", 165 "hiviewdfx_hilog_native:libhilog", 166 ] 167 } else { 168 external_deps = [ "hilog:libhilog" ] 169 } 170 defines = [] 171 if (enable_audio_hal_hdf_log) { 172 defines += [ "AUDIO_HDF_LOG" ] 173 } 174 175 install_images = [ chipset_base_dir ] 176 subsystem_name = "hdf" 177 part_name = "drivers_peripheral_audio" 178 } 179 180 ohos_shared_library("hdi_audio_pnp_server") { 181 include_dirs = [ 182 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 183 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 184 "//drivers/peripheral/audio/interfaces/include", 185 "//third_party/bounds_checking_function/include", 186 ] 187 188 sources = [ 189 "src/hdf_audio_input_event.c", 190 "src/hdf_audio_pnp_server.c", 191 "src/hdf_audio_pnp_uevent.c", 192 ] 193 194 deps = [] 195 if (is_standard_system) { 196 external_deps = [ 197 "c_utils:utils", 198 "hdf_core:libhdf_host", 199 "hdf_core:libhdf_ipc_adapter", 200 "hdf_core:libhdf_utils", 201 "hdf_core:libhdi", 202 "hiviewdfx_hilog_native:libhilog", 203 ] 204 } else { 205 external_deps = [ "hilog:libhilog" ] 206 } 207 defines = [] 208 if (enable_audio_hal_hdf_log) { 209 defines += [ "AUDIO_HDF_LOG" ] 210 } 211 212 install_images = [ chipset_base_dir ] 213 subsystem_name = "hdf" 214 part_name = "drivers_peripheral_audio" 215 } 216} 217