1# Copyright (c) 2024 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/wlan/wlan.gni") 17 18ohos_shared_library("libchip_controller_chip_interface_service_1.0") { 19 branch_protector_ret = "pac_ret" 20 sanitize = { 21 cfi = true # Enable/disable control flow integrity detection 22 boundary_sanitize = false # Enable boundary san detection 23 cfi_cross_dso = true # Cross-SO CFI Checks 24 integer_overflow = false # Enable integer overflow detection 25 ubsan = false # Enable some Ubsan options 26 cfi_vcall_icall_only = true 27 debug = false 28 } 29 include_dirs = [] 30 31 sources = [ 32 "hdi_sync_util.cpp", 33 "iface_tool.cpp", 34 "iface_util.cpp", 35 "wifi.cpp", 36 "wifi_ap_iface.cpp", 37 "wifi_chip.cpp", 38 "wifi_chip_modes.cpp", 39 "wifi_ext_iface.cpp", 40 "wifi_p2p_iface.cpp", 41 "wifi_sta_iface.cpp", 42 "wifi_vendor_hal.cpp", 43 "wifi_vendor_hal_list.cpp", 44 "wifi_vendor_hal_stubs.cpp", 45 ] 46 47 defines = [ 48 "P2P_NAME=\"$drivers_peripheral_wlan_p2p_name\"", 49 "HAL_SO_NAME=\"$drivers_peripheral_wlan_feature_vendor\"", 50 ] 51 52 external_deps = [ 53 "c_utils:utils", 54 "drivers_interface_wlan:chip_idl_headers", 55 "hdf_core:libhdf_host", 56 "hdf_core:libhdf_utils", 57 "hilog:libhilog", 58 "init:libbegetutil", 59 "ipc:ipc_single", 60 ] 61 62 deps = [] 63 64 cflags_cc = [ 65 "-fvisibility-inlines-hidden", 66 "-fdata-sections", 67 "-ffunction-sections", 68 "-Os", 69 "-fno-merge-all-constants", 70 "-fno-asynchronous-unwind-tables", 71 "-fno-unwind-tables", 72 ] 73 ldflags = [ 74 "-Wl,--exclude-libs=ALL", 75 "-Wl,--gc-sections", 76 ] 77 install_images = [ chipset_base_dir ] 78 subsystem_name = "hdf" 79 version_script = "libchip_controller_chip_interface_service.map" 80 part_name = "drivers_peripheral_wlan" 81} 82 83ohos_shared_library("libchip_hdi_driver") { 84 branch_protector_ret = "pac_ret" 85 sanitize = { 86 cfi = true # Enable/disable control flow integrity detection 87 boundary_sanitize = false # Enable boundary san detection 88 cfi_cross_dso = true # Cross-SO CFI Checks 89 integer_overflow = false # Enable integer overflow detection 90 ubsan = false # Enable some Ubsan options 91 cfi_vcall_icall_only = true 92 debug = false 93 } 94 include_dirs = [] 95 96 sources = [ "chip_controller_driver.cpp" ] 97 98 if (is_standard_system) { 99 external_deps = [ 100 "c_utils:utils", 101 "hdf_core:libhdf_host", 102 "hdf_core:libhdf_ipc_adapter", 103 "hdf_core:libhdf_utils", 104 "hdf_core:libhdi", 105 "hilog:libhilog", 106 "ipc:ipc_single", 107 ] 108 } else { 109 external_deps = [ 110 "hilog:libhilog", 111 "ipc:ipc_single", 112 ] 113 } 114 115 cflags_cc = [ 116 "-fvisibility-inlines-hidden", 117 "-fdata-sections", 118 "-ffunction-sections", 119 "-Os", 120 "-fno-merge-all-constants", 121 "-fno-asynchronous-unwind-tables", 122 "-fno-unwind-tables", 123 ] 124 ldflags = [ 125 "-Wl,--exclude-libs=ALL", 126 "-Wl,--gc-sections", 127 ] 128 external_deps += [ "drivers_interface_wlan:libchip_stub_1.0" ] 129 130 shlib_type = "hdi" 131 install_images = [ chipset_base_dir ] 132 subsystem_name = "hdf" 133 part_name = "drivers_peripheral_wlan" 134} 135 136if (drivers_peripheral_wlan_feature_vendor == "default") { 137 ohos_shared_library("wifi_hal_default") { 138 include_dirs = [ 139 "../hdi_service", 140 "../wifi_hal", 141 ] 142 sources = [ 143 "../wifi_hal/common.cpp", 144 "../wifi_hal/cpp_bindings.cpp", 145 "../wifi_hal/gscan.cpp", 146 "../wifi_hal/wifi_hal.cpp", 147 "../wifi_hal/wifi_ioctl.cpp", 148 "../wifi_hal/wifi_logger.cpp", 149 "../wifi_hal/wifi_scan.cpp", 150 ] 151 152 if (drivers_peripheral_wlan_feature_emulator) { 153 defines = [ "SUPPORT_EMULATOR" ] 154 } 155 156 if (is_standard_system) { 157 external_deps = [ 158 "c_utils:utils", 159 "drivers_interface_wlan:chip_idl_headers", 160 "hdf_core:libhdf_ipc_adapter", 161 "hdf_core:libhdf_utils", 162 "hilog:libhilog", 163 "ipc:ipc_single", 164 "libnl:libnl_share", 165 ] 166 } else { 167 external_deps = [ 168 "hilog:libhilog", 169 "ipc:ipc_single", 170 ] 171 } 172 173 install_images = [ chipset_base_dir ] 174 subsystem_name = "hdf" 175 part_name = "drivers_peripheral_wlan" 176 } 177} 178 179group("hdi_chip_service") { 180 deps = [ 181 ":libchip_controller_chip_interface_service_1.0", 182 ":libchip_hdi_driver", 183 ] 184 if (drivers_peripheral_wlan_feature_vendor == "default") { 185 deps += [ ":wifi_hal_default" ] 186 } 187} 188