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/adapter/uhdf2/uhdf.gni") 16import("//drivers/peripheral/audio/audio.gni") 17 18config("hdi_audio_config") { 19 visibility = [ ":*" ] 20 21 cflags = [ 22 "-fPIC", 23 "-Wall", 24 "-Wextra", 25 "-Werror", 26 "-DGST_DISABLE_DEPRECATED", 27 "-DHAVE_CONFIG_H", 28 "-fno-strict-aliasing", 29 "-Wno-sign-compare", 30 "-Wno-builtin-requires-header", 31 "-Wno-implicit-function-declaration", 32 "-Wno-format", 33 "-Wno-int-conversion", 34 "-Wno-unused-function", 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 47if (defined(ohos_lite)) { 48 ohos_shared_library("hdi_audio") { 49 sources = [ 50 "src/audio_adapter.c", 51 "src/audio_capture.c", 52 "src/audio_manager.c", 53 "src/audio_render.c", 54 ] 55 56 include_dirs = [ 57 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 58 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 59 "//third_party/cJSON", 60 "//drivers/peripheral/audio/interfaces/include", 61 "//third_party/bounds_checking_function/include", 62 ] 63 deps = [ 64 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 65 "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common", 66 "//third_party/bounds_checking_function:libsec_shared", 67 ] 68 external_deps = [ "device_driver_framework:libhdf_utils" ] 69 defines = [] 70 if (enable_audio_hal_notsupport_pathselect) { 71 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 72 } 73 74 if (enable_audio_hal_hdf_log) { 75 defines += [ "AUDIO_HAL_HDF_LOG" ] 76 } 77 ldflags = [ 78 "-L$ohos_root_path/sysroot/usr/lib", 79 "-Wl,-rpath-link=$ohos_root_path/sysroot/usr/lib", 80 "-lstdc++", 81 "-ldl", 82 "-lm", 83 ] 84 85 public_configs = [ ":hdi_audio_config" ] 86 87 subsystem_name = "hdf" 88 part_name = "audio_device_driver" 89 } 90} else { 91 if (!defined(enable_audio_user_mode) || !enable_audio_user_mode) { 92 ohos_shared_library("hdi_audio") { 93 sources = [ 94 "src/audio_adapter.c", 95 "src/audio_capture.c", 96 "src/audio_manager.c", 97 "src/audio_render.c", 98 ] 99 100 include_dirs = [ 101 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 102 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 103 "//third_party/cJSON", 104 "//drivers/peripheral/audio/interfaces/include", 105 "//third_party/bounds_checking_function/include", 106 ] 107 108 defines = [] 109 if (enable_audio_device_mpi) { 110 defines += [ "AUDIO_HAL_USER" ] 111 } 112 113 if (enable_audio_hal_notsupport_pathselect) { 114 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 115 } 116 117 if (enable_audio_hal_hdf_log) { 118 defines += [ "AUDIO_HAL_HDF_LOG" ] 119 } 120 121 if (is_standard_system) { 122 external_deps = [ 123 "device_driver_framework:libhdf_host", 124 "device_driver_framework:libhdf_ipc_adapter", 125 "device_driver_framework:libhdf_utils", 126 "device_driver_framework:libhdi", 127 "hiviewdfx_hilog_native:libhilog", 128 "utils_base:utils", 129 ] 130 } else { 131 external_deps = [ "hilog:libhilog" ] 132 } 133 deps = [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common" ] 134 135 public_configs = [ ":hdi_audio_config" ] 136 137 cflags = [] 138 ldflags = [] 139 140 if (enable_coverage) { 141 cflags = [ 142 "-ftest-coverage", 143 "-fprofile-arcs", 144 ] 145 146 ldflags = [ "--coverage" ] 147 } 148 149 install_images = [ chipset_base_dir ] 150 subsystem_name = "hdf" 151 part_name = "audio_device_driver" 152 } 153 } 154} 155 156if (defined(ohos_lite)) { 157 ohos_shared_library("hdi_audio_common") { 158 sources = [ 159 "//third_party/cJSON/cJSON.c", 160 "src/audio_adapter_info_common.c", 161 "src/audio_common.c", 162 ] 163 164 include_dirs = [ 165 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 166 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 167 "//third_party/cJSON", 168 "//drivers/peripheral/audio/interfaces/include", 169 "//third_party/bounds_checking_function/include", 170 ] 171 deps = [ 172 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 173 "//third_party/bounds_checking_function:libsec_shared", 174 ] 175 external_deps = [ "device_driver_framework:libhdf_utils" ] 176 defines = [] 177 if (enable_audio_hal_notsupport_pathselect) { 178 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 179 } 180 181 public_configs = [ ":hdi_audio_config" ] 182 183 subsystem_name = "hdf" 184 part_name = "audio_device_driver" 185 } 186} else { 187 ohos_shared_library("hdi_audio_common") { 188 sources = [ 189 "//third_party/cJSON/cJSON.c", 190 "src/audio_adapter_info_common.c", 191 "src/audio_common.c", 192 ] 193 194 include_dirs = [ 195 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 196 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 197 "//third_party/cJSON", 198 "//drivers/peripheral/audio/interfaces/include", 199 "//third_party/bounds_checking_function/include", 200 ] 201 202 defines = [] 203 if (enable_audio_device_mpi) { 204 defines += [ "AUDIO_HAL_USER" ] 205 } 206 207 if (enable_audio_hal_notsupport_pathselect) { 208 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 209 } 210 211 if (is_standard_system) { 212 external_deps = [ 213 "device_driver_framework:libhdf_host", 214 "device_driver_framework:libhdf_ipc_adapter", 215 "device_driver_framework:libhdf_utils", 216 "device_driver_framework:libhdi", 217 "hiviewdfx_hilog_native:libhilog", 218 "utils_base:utils", 219 ] 220 } else { 221 external_deps = [ "hilog:libhilog" ] 222 } 223 224 public_configs = [ ":hdi_audio_config" ] 225 226 cflags = [] 227 ldflags = [] 228 229 install_images = [ chipset_base_dir ] 230 subsystem_name = "hdf" 231 part_name = "audio_device_driver" 232 } 233} 234