• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/lite/config/component/lite_component.gni")
16  import("//foundation/communication/wifi/wifi/wifi_lite.gni")
17
18  shared_library("wifi_sdk") {
19    sources = [
20      "c_adapter/src/wifi_c_device.cpp",
21      "c_adapter/src/wifi_c_utils.cpp",
22      "src/network_selection.cpp",
23      "src/wifi_device.cpp",
24      "src/wifi_device_callback_stub_lite.cpp",
25      "src/wifi_device_impl.cpp",
26      "src/wifi_device_proxy_lite.cpp",
27      "src/wifi_msg.cpp",
28      "src/wifi_scan.cpp",
29      "src/wifi_scan_callback_stub_lite.cpp",
30      "src/wifi_scan_impl.cpp",
31      "src/wifi_scan_proxy_lite.cpp",
32    ]
33
34    include_dirs = [
35      "$WIFI_ROOT_DIR/interfaces",
36      "$WIFI_ROOT_DIR/interfaces/inner_api",
37      "$WIFI_ROOT_DIR/frameworks/native/include",
38      "$WIFI_ROOT_DIR/frameworks/native/interfaces",
39      "$WIFI_ROOT_DIR/frameworks/native/c_adapter/inc",
40      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log/",
41      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include",
42      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
43      "$WIFI_ROOT_DIR/utils/inc",
44      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
45      "//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
46      "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/registry",
47      "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/samgr",
48      "//third_party/bounds_checking_function/include",
49      "//commonlibrary/c_utils/base/include",
50    ]
51
52    deps = [
53      "$WIFI_ROOT_DIR/utils:wifi_utils",
54      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
55      "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
56      "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
57    ]
58
59    external_deps = [ "bounds_checking_function:libsec_shared" ]
60
61    configs -= [ "//build/lite/config:language_cpp" ]
62    cflags = memory_optimization_cflags
63    cflags_cc = memory_optimization_cflags_cc
64    ldflags = memory_optimization_ldflags
65    cflags_cc += [
66      "-std=c++17",
67      "-fno-rtti",
68    ]
69    defines = [ "OHOS_ARCH_LITE" ]
70    ldflags += [
71      "-fPIC",
72      "-Wl,-E",
73    ]
74  }
75} else {
76  import("//build/ohos.gni")
77  import("//foundation/communication/wifi/wifi/wifi.gni")
78
79  ################################################################################
80
81  config("wifi_sdk_header") {
82    include_dirs = [
83      "$WIFI_ROOT_DIR/interfaces",
84      "$WIFI_ROOT_DIR/interfaces/inner_api",
85      "$WIFI_ROOT_DIR/frameworks/native/include",
86      "$WIFI_ROOT_DIR/frameworks/native/interfaces",
87      "$WIFI_ROOT_DIR/frameworks/native/c_adapter/inc",
88      "$WIFI_ROOT_DIR/frameworks/native/src",
89      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
90      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log/",
91      "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include",
92      "$WIFI_ROOT_DIR/interfaces/innerkits",
93      "$WIFI_ROOT_DIR/utils/inc",
94    ]
95  }
96
97  config("wifi_sdk_config") {
98    visibility = [ ":*" ]
99    include_dirs = [ ":wifi_fw_common_header" ]
100    cflags = [
101      "-std=c++17",
102      "-fno-rtti",
103    ]
104    cflags_cc = [
105      "-std=c++17",
106      "-fno-rtti",
107      "-Os",
108    ]
109
110    if (target_cpu == "arm") {
111      cflags += [ "-DBINDER_IPC_32BIT" ]
112    }
113  }
114
115  ohos_source_set("wifi_device_proxy_impl") {
116    branch_protector_ret = "pac_ret"
117    sanitize = {
118      cfi = true  # Enable/disable control flow integrity detection
119      boundary_sanitize = true  # Enable boundary san detection
120      cfi_cross_dso = true  # Cross-SO CFI Checks
121      integer_overflow = true  # Enable integer overflow detection
122      ubsan = true  # Enable some Ubsan options
123      debug = false
124    }
125    part_name = "wifi"
126    sources = [
127      "src/wifi_device_impl.cpp",
128      "src/wifi_device_mgr_proxy.cpp",
129      "src/wifi_device_proxy.cpp",
130    ]
131
132    configs = [
133      ":wifi_sdk_config",
134      ":wifi_sdk_header",
135    ]
136
137    defines = []
138    if (wifi_feature_with_random_mac_addr) {
139      defines += [ "SUPPORT_RANDOM_MAC_ADDR" ]
140    }
141
142    external_deps = [
143      "bounds_checking_function:libsec_shared",
144      "hilog:libhilog",
145      "ipc:ipc_single",
146      "samgr:samgr_proxy",
147    ]
148  }
149
150  ohos_source_set("wifi_hotspot_proxy_impl") {
151    branch_protector_ret = "pac_ret"
152    sanitize = {
153      cfi = true  # Enable/disable control flow integrity detection
154      boundary_sanitize = true  # Enable boundary san detection
155      cfi_cross_dso = true  # Cross-SO CFI Checks
156      integer_overflow = true  # Enable integer overflow detection
157      ubsan = true  # Enable some Ubsan options
158      debug = false
159    }
160    part_name = "wifi"
161    sources = [
162      "src/wifi_hotspot_impl.cpp",
163      "src/wifi_hotspot_mgr_proxy.cpp",
164      "src/wifi_hotspot_proxy.cpp",
165    ]
166
167    configs = [
168      ":wifi_sdk_config",
169      ":wifi_sdk_header",
170    ]
171
172    defines = []
173    if (wifi_feature_with_random_mac_addr) {
174      defines += [ "SUPPORT_RANDOM_MAC_ADDR" ]
175    }
176
177    external_deps = [
178      "bounds_checking_function:libsec_shared",
179      "hilog:libhilog",
180      "ipc:ipc_single",
181      "samgr:samgr_proxy",
182    ]
183  }
184
185  ohos_source_set("wifi_scan_proxy_impl") {
186    branch_protector_ret = "pac_ret"
187    sanitize = {
188      cfi = true  # Enable/disable control flow integrity detection
189      boundary_sanitize = true  # Enable boundary san detection
190      cfi_cross_dso = true  # Cross-SO CFI Checks
191      integer_overflow = true  # Enable integer overflow detection
192      ubsan = true  # Enable some Ubsan options
193      debug = false
194    }
195    part_name = "wifi"
196    sources = [
197      "src/wifi_scan_impl.cpp",
198      "src/wifi_scan_mgr_proxy.cpp",
199      "src/wifi_scan_proxy.cpp",
200    ]
201
202    configs = [
203      ":wifi_sdk_config",
204      ":wifi_sdk_header",
205    ]
206
207    defines = []
208    if (wifi_feature_with_random_mac_addr) {
209      defines += [ "SUPPORT_RANDOM_MAC_ADDR" ]
210    }
211
212    external_deps = [
213      "bounds_checking_function:libsec_shared",
214      "hilog:libhilog",
215      "ipc:ipc_single",
216      "samgr:samgr_proxy",
217    ]
218  }
219
220  ohos_source_set("wifi_p2p_proxy_impl") {
221    branch_protector_ret = "pac_ret"
222
223    sanitize = {
224      cfi = true  # Enable/disable control flow integrity detection
225      boundary_sanitize = true  # Enable boundary san detection
226      cfi_cross_dso = true  # Cross-SO CFI Checks
227      integer_overflow = true  # Enable integer overflow detection
228      ubsan = true  # Enable some Ubsan options
229      debug = false
230    }
231    part_name = "wifi"
232    sources = [
233      "src/wifi_p2p_impl.cpp",
234      "src/wifi_p2p_proxy.cpp",
235    ]
236
237    configs = [
238      ":wifi_sdk_config",
239      ":wifi_sdk_header",
240    ]
241
242    defines = []
243    if (wifi_feature_with_random_mac_addr) {
244      defines += [ "SUPPORT_RANDOM_MAC_ADDR" ]
245    }
246
247    external_deps = [
248      "bounds_checking_function:libsec_shared",
249      "hilog:libhilog",
250      "ipc:ipc_single",
251      "samgr:samgr_proxy",
252    ]
253  }
254
255  ohos_shared_library("wifi_sdk") {
256    branch_protector_ret = "pac_ret"
257
258    sanitize = {
259      cfi = true  # Enable/disable control flow integrity detection
260      boundary_sanitize = true  # Enable boundary san detection
261      cfi_cross_dso = true  # Cross-SO CFI Checks
262      integer_overflow = true  # Enable integer overflow detection
263      ubsan = true  # Enable some Ubsan options
264      debug = false
265    }
266    install_enable = true
267    sources = [
268      "c_adapter/src/wifi_c_device.cpp",
269      "c_adapter/src/wifi_c_event.cpp",
270      "c_adapter/src/wifi_c_hid2d.cpp",
271      "c_adapter/src/wifi_c_hotspot.cpp",
272      "c_adapter/src/wifi_c_p2p.cpp",
273      "c_adapter/src/wifi_c_utils.cpp",
274      "src/network_selection.cpp",
275      "src/wifi_device.cpp",
276      "src/wifi_device_callback_stub.cpp",
277      "src/wifi_hid2d.cpp",
278      "src/wifi_hid2d_msg.cpp",
279      "src/wifi_hotspot.cpp",
280      "src/wifi_hotspot_callback_stub.cpp",
281      "src/wifi_msg.cpp",
282      "src/wifi_p2p.cpp",
283      "src/wifi_p2p_callback_stub.cpp",
284      "src/wifi_p2p_msg.cpp",
285      "src/wifi_sa_event.cpp",
286      "src/wifi_scan.cpp",
287      "src/wifi_scan_callback_stub.cpp",
288    ]
289
290    deps = [
291      ":wifi_device_proxy_impl",
292      ":wifi_hotspot_proxy_impl",
293      ":wifi_p2p_proxy_impl",
294      ":wifi_scan_proxy_impl",
295      "$WIFI_ROOT_DIR/utils:wifi_utils",
296    ]
297
298    external_deps = [
299      "bounds_checking_function:libsec_shared",
300      "c_utils:utils",
301      "hilog:libhilog",
302      "ipc:ipc_single",
303      "samgr:samgr_proxy",
304    ]
305
306    defines = [
307      "STA_INSTANCE_MAX_NUM=$wifi_feature_with_sta_num",
308      "AP_INSTANCE_MAX_NUM=$wifi_feature_with_ap_num",
309    ]
310
311    if (wifi_feature_with_random_mac_addr) {
312      defines += [ "SUPPORT_RANDOM_MAC_ADDR" ]
313    }
314    cflags = memory_optimization_cflags
315    cflags_cc = memory_optimization_cflags_cc
316    ldflags = memory_optimization_ldflags
317    cflags_cc += [
318      "-std=c++17",
319      "-fno-rtti",
320    ]
321
322    ldflags += [
323      "-fPIC",
324      "-Wl,-E",
325    ]
326
327    configs = [
328      ":wifi_sdk_config",
329      ":wifi_sdk_header",
330    ]
331
332    public_configs = [ ":wifi_sdk_header" ]
333
334    part_name = "wifi"
335    subsystem_name = "communication"
336    innerapi_tags = [ "platformsdk" ]
337    version_script = "libwifi_sdk.map"
338  }
339}
340