1# Copyright (c) 2021-2022 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/ohos.gni") 16} else { 17 import("//build/ohos.gni") 18 WLAN_HAL_PATH = 19 rebase_path("//vendor/${product_company}/${product_name}/hals/wlan") 20 21 cmd = "if [ -f $WLAN_HAL_PATH/product.gni ]; then echo true; else echo false; fi" 22 HAVE_WLAN_HAL_PATH = 23 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 24 25 if (HAVE_WLAN_HAL_PATH) { 26 import("$WLAN_HAL_PATH/product.gni") 27 } else { 28 enable_HDF_NL80211 = true 29 } 30} 31 32if (defined(ohos_lite)) { 33 ohos_shared_library("wifi_driver_client") { 34 sources = [ "src/wifi_driver_client.c" ] 35 sources += [ 36 "src/sbuf/sbuf_cmd_adapter.c", 37 "src/sbuf/sbuf_common_adapter.c", 38 "src/sbuf/sbuf_event_adapter.c", 39 "src/sbuf/sbuf_wpa_cmd_adapter.c", 40 ] 41 42 include_dirs = [ 43 "include", 44 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 45 ] 46 47 deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 48 49 external_deps = [ "hdf_core:libhdf_utils" ] 50 defines = [ "__USER__" ] 51 52 cflags = [ 53 "-Wall", 54 "-Wextra", 55 "-Werror", 56 "-fsigned-char", 57 "-fno-common", 58 "-fno-strict-aliasing", 59 "-Wno-format", 60 "-Wno-format-extra-args", 61 ] 62 63 subsystem_name = "hdf" 64 part_name = "drivers_peripheral_wlan" 65 install_images = [ "system" ] 66 } 67} else { 68 CLIENT_ROOT_DIR = "//drivers/peripheral/wlan" 69 sources = [ 70 "$CLIENT_ROOT_DIR/client/src/sbuf/sbuf_common_adapter.c", 71 "$CLIENT_ROOT_DIR/client/src/sbuf/sbuf_wpa_cmd_adapter.c", 72 "$CLIENT_ROOT_DIR/client/src/wifi_driver_client.c", 73 ] 74 75 ohos_shared_library("wifi_driver_client") { 76 if (enable_HDF_NL80211) { 77 sources += [ 78 "$CLIENT_ROOT_DIR/client/src/sbuf/sbuf_cmd_adapter.c", 79 "$CLIENT_ROOT_DIR/client/src/sbuf/sbuf_event_adapter.c", 80 ] 81 82 include_dirs = [ 83 "$CLIENT_ROOT_DIR/client/include", 84 "$CLIENT_ROOT_DIR/interfaces/include", 85 ] 86 87 external_deps = [ 88 "c_utils:utils", 89 "hdf_core:libhdf_utils", 90 "hiviewdfx_hilog_native:libhilog", 91 ] 92 defines = [ "__OHOS__USER__" ] 93 94 cflags = [ 95 "-Wall", 96 "-Wextra", 97 "-Werror", 98 "-fsigned-char", 99 "-fno-common", 100 "-fno-strict-aliasing", 101 ] 102 103 install_images = [ chipset_base_dir ] 104 subsystem_name = "hdf" 105 part_name = "drivers_peripheral_wlan" 106 } else { 107 sources += [ 108 "$CLIENT_ROOT_DIR/client/src/netlink/netlink_cmd_adapter.c", 109 "$CLIENT_ROOT_DIR/client/src/netlink/netlink_event_adapter.c", 110 "$CLIENT_ROOT_DIR/client/src/sbuf/sbuf_event_adapter.c", 111 ] 112 113 include_dirs = [ 114 "$CLIENT_ROOT_DIR/client/include", 115 "$CLIENT_ROOT_DIR/interfaces/include", 116 "//drivers/hdf_core/framework/core/shared/include", 117 "//drivers/hdf_core/framework/include/core", 118 "//drivers/hdf_core/framework/include/utils", 119 "//drivers/hdf_core/framework/adapter/khdf/linux/osal/include", 120 "//third_party/libnl/include", 121 "$root_out_dir/include", 122 "$root_out_dir/lib", 123 ] 124 125 deps = [ "//third_party/libnl:libnl_share" ] 126 external_deps = [ 127 "c_utils:utils", 128 "hdf_core:libhdf_utils", 129 "hiviewdfx_hilog_native:libhilog", 130 ] 131 132 defines = [ "__OHOS__USER__" ] 133 134 cflags = [ 135 "-Wall", 136 "-Wextra", 137 "-Werror", 138 "-fsigned-char", 139 "-fno-common", 140 "-fno-strict-aliasing", 141 ] 142 143 install_images = [ chipset_base_dir ] 144 subsystem_name = "hdf" 145 part_name = "drivers_peripheral_wlan" 146 } 147 } 148} 149