1# Copyright (c) 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("../../../dsoftbus.gni")
16
17ohos_static_library("wifi_direct") {
18  defines += [ "__STDC_FORMAT_MACROS" ]
19  if (is_asan) {
20    defines += [ "ASAN_BUILD" ]
21  }
22
23  wifi_direct_path = "$dsoftbus_root_path/core/connection/wifi_direct_cpp"
24  wifi_direct_connection_src = []
25
26  wifi_direct_connection_inc = [
27    "$dsoftbus_root_path/adapter/common/include",
28    "$dsoftbus_root_path/adapter/common/net/wifi/include",
29    "$dsoftbus_root_path/core/adapter/authentication/include",
30    "$dsoftbus_root_path/core/adapter/bus_center/include",
31    "$dsoftbus_root_path/core/authentication/include",
32    "$dsoftbus_root_path/core/authentication/interface",
33    "$dsoftbus_root_path/core/bus_center/interface",
34    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
35    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
36    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
37    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
38    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
39    "$dsoftbus_root_path/core/bus_center/utils/include/",
40    "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
41    "$dsoftbus_root_path/core/common/dfx/interface/include",
42    "$dsoftbus_root_path/core/common/include",
43    "$dsoftbus_root_path/core/connection/interface",
44    "$dsoftbus_root_path/core/connection/manager",
45    "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
46    "$dsoftbus_root_path/core/discovery/interface",
47    "$dsoftbus_root_path/core/discovery/manager/include",
48    "$dsoftbus_root_path/core/transmission/trans_channel/proxy/include",
49    "$dsoftbus_root_path/interfaces/inner_kits/lnn",
50    "$dsoftbus_root_path/interfaces/kits/common",
51    "$dsoftbus_root_path/interfaces/kits/discovery",
52    "$dsoftbus_root_path/interfaces/kits/bus_center",
53  ]
54
55  if (!defined(ohos_lite)) {
56    wifi_direct_connection_inc +=
57        [ "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux" ]
58  }
59
60  wifi_direct_connection_external_deps = []
61
62  if (dsoftbus_feature_conn_p2p == true &&
63      softbus_communication_wifi_feature == true) {
64    sanitize = {
65      cfi = true
66      cfi_cross_dso = true
67      debug = false
68    }
69    branch_protector_ret = "pac_ret"
70    wifi_direct_connection_src += [
71      "$wifi_direct_path/adapter/p2p_adapter.cpp",
72      "$wifi_direct_path/channel/auth_negotiate_channel.cpp",
73      "$wifi_direct_path/channel/proxy_negotiate_channel.cpp",
74      "$wifi_direct_path/channel/dummy_negotiate_channel.cpp",
75      "$wifi_direct_path/command/connect_command.cpp",
76      "$wifi_direct_path/command/command_factory.cpp",
77      "$wifi_direct_path/command/disconnect_command.cpp",
78      "$wifi_direct_path/command/force_disconnect_command.cpp",
79      "$wifi_direct_path/command/negotiate_command.cpp",
80      "$wifi_direct_path/command/processor_selector_factory.cpp",
81      "$wifi_direct_path/command/simple_processor_selector.cpp",
82      "$wifi_direct_path/data/inner_link.cpp",
83      "$wifi_direct_path/data/interface_info.cpp",
84      "$wifi_direct_path/data/interface_manager.cpp",
85      "$wifi_direct_path/data/ipv4_info.cpp",
86      "$wifi_direct_path/data/link_info.cpp",
87      "$wifi_direct_path/data/link_manager.cpp",
88      "$wifi_direct_path/data/negotiate_message.cpp",
89      "$wifi_direct_path/data/wifi_config_info.cpp",
90      "$wifi_direct_path/event/wifi_direct_event_dispatcher.cpp",
91      "$wifi_direct_path/entity/p2p_available_state.cpp",
92      "$wifi_direct_path/entity/p2p_connect_state.cpp",
93      "$wifi_direct_path/entity/p2p_create_group_state.cpp",
94      "$wifi_direct_path/entity/p2p_destroy_group_state.cpp",
95      "$wifi_direct_path/entity/p2p_entity.cpp",
96      "$wifi_direct_path/entity/p2p_entity_state.cpp",
97      "$wifi_direct_path/entity/p2p_unavailable_state.cpp",
98      "$wifi_direct_path/entity/p2p_broadcast_receiver.cpp",
99      "$wifi_direct_path/processor/p2p_v1_processor.cpp",
100      "$wifi_direct_path/processor/null_processor.cpp",
101      "$wifi_direct_path/protocol/json_protocol.cpp",
102      "$wifi_direct_path/protocol/tlv_protocol.cpp",
103      "$wifi_direct_path/utils/wifi_direct_anonymous.cpp",
104      "$wifi_direct_path/utils/duration_statistic.cpp",
105      "$wifi_direct_path/utils/wifi_direct_trace.cpp",
106      "$wifi_direct_path/utils/wifi_direct_utils.cpp",
107      "$wifi_direct_path/wifi_direct_executor.cpp",
108      "$wifi_direct_path/wifi_direct_initiator.cpp",
109      "$wifi_direct_path/wifi_direct_ip_manager.cpp",
110      "$wifi_direct_path/wifi_direct_manager.cpp",
111      "$wifi_direct_path/wifi_direct_role_option.cpp",
112      "$wifi_direct_path/wifi_direct_scheduler.cpp",
113      "$wifi_direct_path/utils/wifi_direct_dfx.cpp",
114    ]
115
116    if (dsoftbus_feature_ex_kits == true) {
117      import(
118          "../../../dsoftbus_enhance/core/connection/wifi_direct_cpp/wifi_direct.gni")
119
120      wifi_direct_connection_inc += wifi_direct_connection_enhance_inc
121      wifi_direct_connection_src += wifi_direct_connection_enhance_src
122      wifi_direct_connection_external_deps +=
123          wifi_direct_connection_enhance_external_deps
124    }
125
126    wifi_direct_connection_external_deps += [
127      "bounds_checking_function:libsec_shared",
128      "cJSON:cjson",
129      "c_utils:utils",
130      "hilog:libhilog",
131      "hitrace:libhitracechain",
132      "init:libbegetutil",
133      "json:nlohmann_json_static",
134      "netmanager_base:net_conn_manager_if",
135      "wifi:wifi_sdk",
136    ]
137
138    remove_configs = [
139      "//build/config/compiler:no_rtti",
140      "//build/config/compiler:no_exceptions",
141    ]
142
143    configs = [
144      "//build/config/compiler:rtti",
145      "//build/config/compiler:exceptions",
146    ]
147  } else {
148    wifi_direct_connection_src +=
149        [ "$wifi_direct_path/wifi_direct_manager_virtual.c" ]
150  }
151
152  include_dirs = wifi_direct_connection_inc
153  sources = wifi_direct_connection_src
154  external_deps = wifi_direct_connection_external_deps
155
156  part_name = "dsoftbus"
157  subsystem_name = "communication"
158}
159