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 14if (defined(ohos_lite)) { 15 import("//build/lite/config/component/lite_component.gni") 16} else { 17 import("//build/ohos.gni") 18} 19import("//drivers/adapter/uhdf2/uhdf.gni") 20import("//drivers/peripheral/audio/audio.gni") 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-sign-compare", 34 "-Wno-builtin-requires-header", 35 "-Wno-implicit-function-declaration", 36 "-Wno-format", 37 "-Wno-int-conversion", 38 "-Wno-unused-function", 39 "-Wno-unused-parameter", 40 "-Wno-thread-safety-attributes", 41 "-Wno-inconsistent-missing-override", 42 "-fno-rtti", 43 "-fno-exceptions", 44 "-ffunction-sections", 45 "-fdata-sections", 46 ] 47 48 ldflags = [ "-Wl" ] 49} 50 51if (defined(ohos_lite)) { 52 shared_library("hdi_audio") { 53 sources = [ 54 "$hdf_framework_path/support/posix/src/osal_time.c", 55 "//third_party/cJSON/cJSON.c", 56 "src/audio_adapter.c", 57 "src/audio_adapter_info_common.c", 58 "src/audio_capture.c", 59 "src/audio_common.c", 60 "src/audio_manager.c", 61 "src/audio_render.c", 62 ] 63 64 include_dirs = [ 65 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 66 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 67 "//third_party/cJSON", 68 "//drivers/peripheral/audio/interfaces/include", 69 "$hdf_framework_path/include/core", 70 "$hdf_framework_path/include/utils", 71 "$hdf_framework_path/include/osal", 72 "$hdf_framework_path/ability/sbuf/include", 73 "//drivers//adapter/khdf/liteos/osal/include", 74 "//third_party/bounds_checking_function/include", 75 ] 76 deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 77 78 if (enable_audio_hal_notsupport_pathselect) { 79 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 80 } 81 82 ldflags = [ 83 "-L$ohos_root_path/sysroot/usr/lib", 84 "-Wl,-rpath-link=$ohos_root_path/sysroot/usr/lib", 85 "-lstdc++", 86 "-ldl", 87 "-lm", 88 ] 89 90 public_configs = [ ":hdi_audio_config" ] 91 } 92} else { 93 ohos_shared_library("hdi_audio") { 94 sources = [ 95 "//third_party/cJSON/cJSON.c", 96 "src/audio_adapter.c", 97 "src/audio_adapter_info_common.c", 98 "src/audio_capture.c", 99 "src/audio_common.c", 100 "src/audio_manager.c", 101 "src/audio_render.c", 102 ] 103 104 include_dirs = [ 105 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 106 "//drivers/peripheral/audio/supportlibs/adm_adapter/include", 107 "//third_party/cJSON", 108 "//drivers/peripheral/audio/interfaces/include", 109 "$hdf_framework_path/include/core", 110 "$hdf_framework_path/include/utils", 111 "$hdf_framework_path/include/osal", 112 "$hdf_framework_path/include", 113 "//third_party/bounds_checking_function/include", 114 "$hdf_framework_path/ability/sbuf/include", 115 "$hdf_framework_path/utils/include", 116 "$hdf_framework_path/ability/sbuf/include", 117 "$hdf_uhdf_path/osal/include", 118 "$hdf_uhdf_path/common/include/core", 119 ] 120 121 deps = [ 122 "$hdf_uhdf_path/config:libhdf_hcs", 123 "$hdf_uhdf_path/hcs:hdf_default.hcb", 124 "$hdf_uhdf_path/hdi:libhdi", 125 "$hdf_uhdf_path/host:hdf_devhost", 126 "$hdf_uhdf_path/host:libhdf_host", 127 "$hdf_uhdf_path/ipc:libhdf_ipc_adapter", 128 "$hdf_uhdf_path/manager:hdf_devmgr", 129 "$hdf_uhdf_path/manager:hdf_devmgr.rc", 130 "$hdf_uhdf_path/osal:libhdf_utils", 131 "//utils/native/base:utils", 132 ] 133 134 defines = [] 135 if (enable_audio_device_mpi) { 136 defines += [ "AUDIO_HAL_USER" ] 137 } 138 139 if (enable_audio_hal_notsupport_pathselect) { 140 defines += [ "AUDIO_HAL_NOTSUPPORT_PATHSELECT" ] 141 } 142 143 if (is_standard_system) { 144 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 145 } else { 146 external_deps = [ "hilog:libhilog" ] 147 } 148 149 public_configs = [ ":hdi_audio_config" ] 150 151 subsystem_name = "hdf" 152 } 153} 154