1# Copyright (c) 2024 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("//foundation/communication/netmanager_ext/netmanager_ext_config.gni")
16
17config("wearable_distributed_net_manager_config") {
18  include_dirs = [
19    "include",
20    "$EXT_INNERKITS_ROOT/include",
21    "$NETMANAGER_EXT_ROOT/utils/log/include",
22    "$WEARABLE_DISTRIBUTED_NET_MANAGER_SOURCE_DIR/include",
23    "$NETWORKSHAREMANAGER_UTILS_DIR/event_report/include",
24  ]
25
26  defines = [
27    "NETMGR_LOG_TAG = \"WearableDistributedNetManager\"",
28    "LOG_DOMAIN = 0xD0015B0",
29    "WEARABLE_DISTRIBUTED_NET_CONFIG_PATH = \"/system/etc/communication/netmanager_ext/wearable_distributed_net_link_info.json\"",
30  ]
31
32  if (enable_netmgr_ext_debug) {
33    defines += [ "NETMGR_DEBUG" ]
34  }
35}
36
37wearable_distributed_net_manager_sources = [
38  "$WEARABLE_DISTRIBUTED_NET_MANAGER_SOURCE_DIR/src/wearable_distributed_net_config_forward.cpp",
39  "$WEARABLE_DISTRIBUTED_NET_MANAGER_SOURCE_DIR/src/wearable_distributed_net_link_info.cpp",
40  "$WEARABLE_DISTRIBUTED_NET_MANAGER_SOURCE_DIR/src/wearable_distributed_net_supplier_info.cpp",
41]
42
43wearable_distributed_net_manager_deps =
44    [ "$NETMANAGER_EXT_ROOT/utils:net_event_report" ]
45
46wearable_distributed_net_manager_external_deps = [
47  "ability_base:want",
48  "ability_base:zuri",
49  "ability_runtime:app_manager",
50  "bundle_framework:appexecfwk_base",
51  "bundle_framework:appexecfwk_core",
52  "cJSON:cjson",
53  "c_utils:utils",
54  "common_event_service:cesfwk_innerkits",
55  "eventhandler:libeventhandler",
56  "ffrt:libffrt",
57  "hilog:libhilog",
58  "hisysevent:libhisysevent",
59  "hitrace:hitrace_meter",
60  "ipc:ipc_core",
61  "netmanager_base:net_conn_manager_if",
62  "netmanager_base:net_conn_parcel",
63  "netmanager_base:net_data_share",
64  "netmanager_base:net_manager_common",
65  "netmanager_base:net_native_manager_if",
66  "netmanager_base:net_service_common",
67  "netmanager_base:netsys_client",
68  "netmanager_base:netsys_controller",
69  "netmanager_base:socket_permission",
70  "safwk:system_ability_fwk",
71  "samgr:samgr_proxy",
72]
73
74ohos_shared_library("wearable_distributed_net_manager") {
75  if (netmanager_ext_feature_wearable_distributed_net) {
76    sanitize = {
77      cfi = true
78      cfi_cross_dso = true
79      debug = false
80    }
81
82    branch_protector_ret = "pac_ret"
83
84    configs = [ ":wearable_distributed_net_manager_config" ]
85
86    sources = wearable_distributed_net_manager_sources
87    deps = wearable_distributed_net_manager_deps
88    external_deps = wearable_distributed_net_manager_external_deps
89
90    cflags = memory_optimization_cflags
91    cflags += [
92      "-fstack-protector-strong",
93      "-D_FORTIFY_SOURCE=2",
94      "-O2",
95    ]
96
97    cflags_cc = memory_optimization_cflags_cc
98    cflags_cc += [
99      "-fstack-protector-strong",
100      "-D_FORTIFY_SOURCE=2",
101      "-O2",
102    ]
103
104    ldflags = memory_optimization_ldflags
105
106    part_name = "netmanager_ext"
107    subsystem_name = "communication"
108  }
109}
110
111ohos_prebuilt_etc("wearable_distributed_net_link_info") {
112  source = "$NETMANAGER_EXT_ROOT/services/wearabledistributednetmanager/config/wearable_distributed_net_link_info.json"
113  install_enable = true
114  relative_install_dir = "communication/netmanager_ext"
115  part_name = "netmanager_ext"
116  subsystem_name = "communication"
117}
118