1# Copyright (c) 2021-2023 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")
15
16HAL_ROOT_DIR = "./.."
17
18if (defined(ohos_lite)) {
19  ohos_shared_library("wifi_hal") {
20    sources = [
21      "src/wifi_hal.c",
22      "src/wifi_hal_ap_feature.c",
23      "src/wifi_hal_base_feature.c",
24      "src/wifi_hal_cmd.c",
25      "src/wifi_hal_sta_feature.c",
26      "src/wifi_hal_util.c",
27    ]
28
29    include_dirs = [
30      "include",
31      "$HAL_ROOT_DIR/interfaces/include",
32      "$HAL_ROOT_DIR/client/include",
33      "//third_party/bounds_checking_function/include",
34    ]
35
36    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
37    external_deps = [
38      "hdf_core:hdf_posix_osal",
39      "hdf_core:libhdf_utils",
40    ]
41    defines = [ "__USER__" ]
42
43    cflags = [
44      "-Wall",
45      "-Wextra",
46      "-Werror",
47      "-fsigned-char",
48      "-fno-common",
49      "-fno-strict-aliasing",
50      "-Wno-format",
51      "-Wno-format-extra-args",
52    ]
53    subsystem_name = "hdf"
54    part_name = "drivers_peripheral_wlan"
55  }
56} else {
57  ohos_shared_library("wifi_hal") {
58    branch_protector_ret = "pac_ret"
59    sanitize = {
60      cfi = true  # Enable/disable control flow integrity detection
61      boundary_sanitize = true  # Enable boundary san detection
62      cfi_cross_dso = true  # Cross-SO CFI Checks
63      integer_overflow = true  # Enable integer overflow detection
64      ubsan = true  # Enable some Ubsan options
65      debug = false
66    }
67    sources = [
68      "src/wifi_hal.c",
69      "src/wifi_hal_ap_feature.c",
70      "src/wifi_hal_base_feature.c",
71      "src/wifi_hal_cmd.c",
72      "src/wifi_hal_p2p_feature.c",
73      "src/wifi_hal_sta_feature.c",
74      "src/wifi_hal_util.c",
75    ]
76    include_dirs = [
77      "include",
78      "$HAL_ROOT_DIR/interfaces/include",
79      "$HAL_ROOT_DIR/client/include",
80    ]
81    deps = [ "$HAL_ROOT_DIR/client:wifi_driver_client" ]
82    defines = [ "__OHOS__USER__" ]
83    cflags = [
84      "-Wall",
85      "-Wextra",
86      "-Werror",
87      "-fsigned-char",
88      "-fno-common",
89      "-fno-strict-aliasing",
90    ]
91    install_images = [ chipset_base_dir ]
92    subsystem_name = "hdf"
93    part_name = "drivers_peripheral_wlan"
94    if (is_standard_system) {
95      external_deps = [
96        "c_utils:utils",
97        "hdf_core:libhdf_utils",
98        "hilog:libhilog",
99      ]
100    } else {
101      external_deps = [ "hilog:libhilog" ]
102    }
103  }
104}
105