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")
15import("../wlan.gni")
16
17config("wifi_driver_hdi_client_public_config") {
18  include_dirs = [ "include" ]
19}
20
21if (defined(ohos_lite)) {
22  ohos_shared_library("wifi_driver_client") {
23    output_extension = "z.so"
24    sources = [ "src/wifi_driver_client.c" ]
25    sources += [
26      "src/sbuf/sbuf_cmd_adapter.c",
27      "src/sbuf/sbuf_common_adapter.c",
28      "src/sbuf/sbuf_event_adapter.c",
29      "src/sbuf/sbuf_wpa_cmd_adapter.c",
30    ]
31
32    include_dirs = [ "include" ]
33
34    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
35
36    external_deps = [ "hdf_core:libhdf_utils" ]
37    defines = [ "__USER__" ]
38
39    cflags = [
40      "-Wall",
41      "-Wextra",
42      "-Werror",
43      "-fsigned-char",
44      "-fno-common",
45      "-fno-strict-aliasing",
46      "-Wno-format",
47      "-Wno-format-extra-args",
48    ]
49
50    subsystem_name = "hdf"
51    part_name = "drivers_peripheral_wlan"
52    install_images = [ "system" ]
53  }
54} else {
55  CLIENT_ROOT_DIR = "./.."
56  sources = [
57    "src/sbuf/sbuf_common_adapter.c",
58    "src/sbuf/sbuf_wpa_cmd_adapter.c",
59    "src/wifi_driver_client.c",
60  ]
61
62  ohos_shared_library("wifi_driver_client") {
63    branch_protector_ret = "pac_ret"
64    sanitize = {
65      cfi = true  # Enable/disable control flow integrity detection
66      boundary_sanitize = true  # Enable boundary san detection
67      cfi_cross_dso = true  # Cross-SO CFI Checks
68      integer_overflow = true  # Enable integer overflow detection
69      ubsan = true  # Enable some Ubsan options
70      debug = false
71    }
72    if (drivers_peripheral_wlan_feature_enable_HDF_NL80211) {
73      sources += [
74        "src/sbuf/sbuf_cmd_adapter.c",
75        "src/sbuf/sbuf_event_adapter.c",
76      ]
77
78      include_dirs = [
79        "include",
80        "$CLIENT_ROOT_DIR/interfaces/include",
81      ]
82      public_configs = [ ":wifi_driver_hdi_client_public_config" ]
83
84      external_deps = [
85        "c_utils:utils",
86        "hdf_core:libhdf_utils",
87        "hilog:libhilog",
88      ]
89      defines = [ "__OHOS__USER__" ]
90
91      cflags = [
92        "-Wall",
93        "-Wextra",
94        "-Werror",
95        "-fsigned-char",
96        "-fno-common",
97        "-fno-strict-aliasing",
98      ]
99
100      install_images = [ chipset_base_dir ]
101      subsystem_name = "hdf"
102      part_name = "drivers_peripheral_wlan"
103    } else {
104      sources += [
105        "src/netlink/netlink_cmd_adapter.c",
106        "src/netlink/netlink_event_adapter.c",
107        "src/sbuf/sbuf_event_adapter.c",
108      ]
109
110      include_dirs = [
111        "include",
112        "$CLIENT_ROOT_DIR/interfaces/include",
113        "//third_party/libnl/libnl-3.7.0/include",
114        "$root_out_dir/include",
115        "$root_out_dir/lib",
116      ]
117
118      public_configs = [ ":wifi_driver_hdi_client_public_config" ]
119      deps = [ "//third_party/libnl:libnl_share" ]
120      external_deps = [
121        "c_utils:utils",
122        "hdf_core:libhdf_host",
123        "hdf_core:libhdf_utils",
124        "hilog:libhilog",
125        "init:libbegetutil",
126      ]
127
128      defines = [ "__OHOS__USER__" ]
129
130      cflags = [
131        "-Wall",
132        "-Wextra",
133        "-Werror",
134        "-fsigned-char",
135        "-fno-common",
136        "-fno-strict-aliasing",
137      ]
138
139      install_images = [ chipset_base_dir ]
140      subsystem_name = "hdf"
141      part_name = "drivers_peripheral_wlan"
142    }
143  }
144}
145