1# Copyright (c) 2022-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("//foundation/communication/netmanager_ext/netmanager_ext_config.gni") 16 17config("net_tether_manager_config") { 18 include_dirs = [ 19 "$UTILS_ROOT/native/base/include", 20 "$UTILS_ROOT/system/safwk/native/include", 21 "$THIRD_PARTY_ROOT/json/include", 22 "$THIRD_PARTY_ROOT/openssl/include", 23 "$BASE_INNERKITS_ROOT/netshareclient/include", 24 "$BASE_INNERKITS_ROOT/netshareclient/include/proxy", 25 "$BASE_INNERKITS_ROOT/netshareclient/include/proxy/ipccallback", 26 "$BASE_INNERKITS_ROOT/ethernetclient/include/proxy", 27 "$BASE_INNERKITS_ROOT/netstatsclient/include", 28 "$EXT_INNERKITS_ROOT/include", 29 "$EXT_INNERKITS_ROOT/netshareclient/include", 30 "$EXT_INNERKITS_ROOT/netshareclient/include/proxy", 31 "$EXT_INNERKITS_ROOT/netshareclient/include/proxy/ipccallback", 32 "$NETCONNMANAGER_COMMON_DIR/include", 33 "$NETMANAGER_EXT_ROOT/utils/log/include", 34 "$NETWORKSHAREMANAGER_SOURCE_DIR/include", 35 "$NETWORKSHAREMANAGER_SOURCE_DIR/include/stub", 36 "$NETWORKSHAREMANAGER_UTILS_DIR/event_report/include", 37 "$BASE_INNERKITS_ROOT/include", 38 "$BASE_INNERKITS_ROOT/netconnclient/include", 39 "$BASE_INNERKITS_ROOT/netmanagernative/include", 40 "$BASE_INNERKITS_ROOT/dnsresolverclient/include", 41 "$NETSYSCONTROLLER_ROOT_DIR/include", 42 "$BLUETOOTH_ROOT/interfaces/inner_api/include", 43 "//third_party/jsoncpp/include/json", 44 "$NETMANAGER_BASE_ROOT/services/netmanagernative/include/netsys", 45 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 46 "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include", 47 ] 48 if (communication_wifi_switch_enable) { 49 include_dirs += [ 50 "$WIFI_MANAGER_ROOT/interfaces/kits/c", 51 "$WIFI_MANAGER_ROOT/frameworks/native/interfaces", 52 ] 53 } 54 if (usb_manager_enable) { 55 include_dirs += [ 56 "$USB_MANAGER_ROOT/interfaces/innerkits/native/include", 57 "$USB_MANAGER_ROOT/services/zidl/include", 58 "$USB_MANAGER_ROOT/utils/native/include", 59 ] 60 } 61} 62 63ohos_shared_library("net_tether_manager") { 64 sources = [ 65 "$NETWORKSHAREMANAGER_INNERKITS_SOURCE_DIR/src/proxy/ipccallback/sharing_event_callback_proxy.cpp", 66 "$NETWORKSHAREMANAGER_INNERKITS_SOURCE_DIR/src/proxy/ipccallback/sharing_event_callback_stub.cpp", 67 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_configuration.cpp", 68 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_hisysevent.cpp", 69 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_main_statemachine.cpp", 70 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_service.cpp", 71 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_sub_statemachine.cpp", 72 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_tracker.cpp", 73 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_upstreammonitor.cpp", 74 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/stub/networkshare_service_stub.cpp", 75 ] 76 77 configs = [ ":net_tether_manager_config" ] 78 79 deps = [ "$NETMANAGER_EXT_ROOT/utils:net_event_report" ] 80 81 cflags = [ 82 "-fvisibility=hidden", 83 "-fdata-sections", 84 "-ffunction-sections", 85 "-Os", 86 "-fstack-protector-strong", 87 "-D_FORTIFY_SOURCE=2", 88 "-O2", 89 ] 90 91 cflags_cc = [ 92 "-fvisibility-inlines-hidden", 93 "-Os", 94 "-fstack-protector-strong", 95 "-D_FORTIFY_SOURCE=2", 96 "-O2", 97 ] 98 99 ldflags = [ 100 "-Wl,--exclude-libs=ALL", 101 "-Wl,--gc-sections", 102 ] 103 104 external_deps = [ 105 "c_utils:utils", 106 "dhcp:dhcp_sdk", 107 "eventhandler:libeventhandler", 108 "ipc:ipc_core", 109 "netmanager_base:net_conn_manager_if", 110 "netmanager_base:net_data_share", 111 "netmanager_base:net_manager_common", 112 "netmanager_base:netsys_controller", 113 "safwk:system_ability_fwk", 114 ] 115 116 defines = [] 117 118 if (communication_wifi_switch_enable) { 119 defines += [ "WIFI_MODOULE" ] 120 external_deps += [ "wifi:wifi_sdk" ] 121 } 122 123 if (usb_manager_enable) { 124 defines += [ "USB_MODOULE" ] 125 external_deps += [ 126 "drivers_interface_usb:usb_idl_headers", 127 "usb_manager:usbsrv_client", 128 ] 129 } 130 131 if (communication_bluetooth_switch_enable) { 132 defines += [ "BLUETOOTH_MODOULE=1" ] 133 external_deps += [ "bluetooth:btframework" ] 134 } 135 136 defines += [ 137 "NETMGR_LOG_TAG = \"NetworkShareManager\"", 138 "LOG_DOMAIN = 0xD0015B0", 139 "NETWORK_SHARING_CONFIG_PATH = \"/system/etc/communication/netmanager_ext/network_share_config.cfg\"", 140 ] 141 142 if (enable_netmgr_ext_debug) { 143 defines += [ "NETMGR_DEBUG" ] 144 } 145 146 external_deps += [ "hilog:libhilog" ] 147 148 part_name = "netmanager_ext" 149 subsystem_name = "communication" 150} 151 152ohos_static_library("net_tether_manager_static") { 153 testonly = true 154 sources = [ 155 "$NETWORKSHAREMANAGER_INNERKITS_SOURCE_DIR/src/proxy/ipccallback/sharing_event_callback_proxy.cpp", 156 "$NETWORKSHAREMANAGER_INNERKITS_SOURCE_DIR/src/proxy/ipccallback/sharing_event_callback_stub.cpp", 157 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_configuration.cpp", 158 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_hisysevent.cpp", 159 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_main_statemachine.cpp", 160 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_service.cpp", 161 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_sub_statemachine.cpp", 162 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_tracker.cpp", 163 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/networkshare_upstreammonitor.cpp", 164 "$NETWORKSHAREMANAGER_SOURCE_DIR/src/stub/networkshare_service_stub.cpp", 165 ] 166 167 configs = [ ":net_tether_manager_config" ] 168 169 deps = [ 170 "$BASE_INNERKITS_ROOT/netconnclient:net_conn_manager_if", 171 "$NETMANAGER_BASE_ROOT/utils:net_data_share", 172 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 173 "$NETMANAGER_EXT_ROOT/utils:net_event_report", 174 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 175 ] 176 177 external_deps = [ 178 "c_utils:utils", 179 "dhcp:dhcp_sdk", 180 "eventhandler:libeventhandler", 181 "ipc:ipc_core", 182 "safwk:system_ability_fwk", 183 ] 184 185 defines = [] 186 187 if (communication_wifi_switch_enable) { 188 defines += [ "WIFI_MODOULE" ] 189 external_deps += [ "wifi:wifi_sdk" ] 190 } 191 192 if (usb_manager_enable) { 193 defines += [ "USB_MODOULE" ] 194 external_deps += [ 195 "drivers_interface_usb:usb_idl_headers", 196 "usb_manager:usbsrv_client", 197 ] 198 } 199 200 if (communication_bluetooth_switch_enable) { 201 defines += [ "BLUETOOTH_MODOULE=1" ] 202 external_deps += [ "bluetooth:btframework" ] 203 } 204 205 defines += [ 206 "NETMGR_LOG_TAG = \"NetworkShareManager\"", 207 "LOG_DOMAIN = 0xD0015B0", 208 "NETWORK_SHARING_CONFIG_PATH = \"/system/etc/communication/netmanager_ext/network_share_config.cfg\"", 209 ] 210 211 if (enable_netmgr_ext_debug) { 212 defines += [ "NETMGR_DEBUG" ] 213 } 214 215 external_deps += [ "hilog:libhilog" ] 216 217 part_name = "netmanager_ext" 218 subsystem_name = "communication" 219} 220 221## Install network_share_config.cfg to /system/etc/communication/netmanager_ext 222ohos_prebuilt_etc("network_share_config") { 223 source = "$NETMANAGER_EXT_ROOT/services/networksharemanager/network_share_config.cfg" 224 install_enable = true 225 relative_install_dir = "communication/netmanager_ext" 226 part_name = "netmanager_ext" 227} 228