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_service_config") { 23 visibility = [ ":*" ] 24 25 cflags = [ 26 "-Wall", 27 "-Wextra", 28 "-Werror", 29 "-DGST_DISABLE_DEPRECATED", 30 "-DHAVE_CONFIG_H", 31 "-fno-strict-aliasing", 32 "-Wno-sign-compare", 33 "-Wno-builtin-requires-header", 34 "-Wno-implicit-function-declaration", 35 "-Wno-format", 36 "-Wno-int-conversion", 37 "-Wno-unused-function", 38 "-Wno-unused-parameter", 39 "-Wno-thread-safety-attributes", 40 "-Wno-inconsistent-missing-override", 41 "-fno-rtti", 42 "-fno-exceptions", 43 "-ffunction-sections", 44 "-fdata-sections", 45 ] 46 47 ldflags = [ "-Wl" ] 48} 49 50if ("$product_name" != "ohos-arm64") { 51 import("//vendor/$product_company/$product_name/hals/audio/product.gni") 52} 53if (!defined(enable_hdf_proxy_stub) || enable_hdf_proxy_stub == true) { 54 if (defined(ohos_lite)) { 55 shared_library("hdi_audio_server") { 56 include_dirs = [ 57 "//drivers/peripheral/audio/interfaces/include", 58 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 59 "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", 60 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 61 "//third_party/bounds_checking_function/include", 62 ] 63 64 sources = [ 65 "$hdf_framework_path/support/posix/src/osal_mem.c", 66 "$hdf_framework_path/utils/src/hdf_sbuf.c", 67 "src/hdf_audio_server.c", 68 "src/hdf_audio_server_capture.c", 69 "src/hdf_audio_server_common.c", 70 "src/hdf_audio_server_render.c", 71 "src/pnp_message_report.c", 72 ] 73 74 deps = [ 75 "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common", 76 "//third_party/bounds_checking_function:libsec_shared", 77 ] 78 if (!defined(enable_audio_user_mode) || !enable_audio_user_mode) { 79 deps += [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio" ] 80 } else { 81 deps += [ "//device/soc/${product_company}/common/hal/media:hdi_audio" ] 82 } 83 if (enable_audio_hal_hdf_log) { 84 defines = [ "AUDIO_HAL_HDF_LOG" ] 85 } 86 87 public_configs = [ ":hdi_service_config" ] 88 } 89 90 lite_component("hdi") { 91 features = [ ":hdi_audio_server" ] 92 } 93 } else { 94 ohos_shared_library("hdi_audio_server") { 95 include_dirs = [ 96 "//drivers/peripheral/audio/interfaces/include", 97 "//drivers/peripheral/audio/hal/hdi_passthrough/include", 98 "//drivers/peripheral/audio/hal/hdi_binder/server/include", 99 "//third_party/bounds_checking_function/include", 100 ] 101 102 sources = [ 103 "src/hdf_audio_server.c", 104 "src/hdf_audio_server_capture.c", 105 "src/hdf_audio_server_common.c", 106 "src/hdf_audio_server_render.c", 107 "src/pnp_message_report.c", 108 ] 109 110 deps = [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio_common" ] 111 if (!defined(enable_audio_user_mode) || !enable_audio_user_mode) { 112 deps += [ "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio" ] 113 } else { 114 deps += [ "//device/soc/${product_company}/common/hal/media:hdi_audio" ] 115 } 116 defines = [] 117 if (enable_audio_device_mpi) { 118 defines += [ "AUDIO_HAL_USER" ] 119 } 120 if (is_standard_system) { 121 external_deps = [ 122 "device_driver_framework:libhdf_host", 123 "device_driver_framework:libhdf_ipc_adapter", 124 "device_driver_framework:libhdf_utils", 125 "device_driver_framework:libhdi", 126 "hiviewdfx_hilog_native:libhilog", 127 "utils_base:utils", 128 ] 129 } else { 130 external_deps = [ "hilog:libhilog" ] 131 } 132 133 if (enable_audio_hal_hdf_log) { 134 defines += [ "AUDIO_HAL_HDF_LOG" ] 135 } 136 137 public_configs = [ ":hdi_service_config" ] 138 139 install_images = [ chipset_base_dir ] 140 subsystem_name = "hdf" 141 part_name = "audio_device_driver" 142 } 143 } 144} 145