# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("//foundation/communication/netstack/netstack_config.gni")
config("napi_utils_public_config") {
include_dirs = [
"include",
"$NETSTACK_DIR/utils/log/include",
]
if (current_os != "ohos") {
cflags = [ "-std=c++17" ]
}
}
ohos_static_library("napi_utils") {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
sources = [
"src/base_context.cpp",
"src/event_listener.cpp",
"src/event_manager.cpp",
"src/hi_app_event_report.cpp",
"src/module_template.cpp",
"src/napi_utils.cpp",
"src/secure_char.cpp",
"src/timing.cpp",
]
part_name = "netstack"
subsystem_name = "communication"
public_configs = [ ":napi_utils_public_config" ]
public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ]
external_deps = [
"cJSON:cjson",
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
"libuv:uv",
"napi:ace_napi",
"node:node_header_notice",
]
if (!build_ohos_sdk) {
external_deps += [
"ability_base:configuration",
"ability_runtime:wantagent_innerkits",
"hiappevent:hiappevent_innerapi",
"time_service:time_client",
]
}
if (defined(global_parts_info) &&
defined(global_parts_info.communication_netmanager_base) &&
global_parts_info.communication_netmanager_base && is_ohos &&
is_standard_system && !is_arkui_x && product_name != "ohos-sdk") {
defines = [ "HAS_NETMANAGER_BASE=1" ]
external_deps += [ "ffrt:libffrt" ]
} else {
defines = [ "HAS_NETMANAGER_BASE=0" ]
}
}
ohos_static_library("napi_utils_static") {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
sources = [
"src/base_context.cpp",
"src/event_listener.cpp",
"src/event_manager.cpp",
"src/hi_app_event_report.cpp",
"src/module_template.cpp",
"src/napi_utils.cpp",
"src/secure_char.cpp",
"src/timing.cpp",
]
public_configs = [ ":napi_utils_public_config" ]
external_deps = [ "cJSON:cjson" ]
if (!build_ohos_sdk) {
external_deps += [
"ability_base:configuration",
"ability_runtime:wantagent_innerkits",
"hiappevent:hiappevent_innerapi",
"ipc:ipc_single",
"time_service:time_client",
]
}
if (defined(global_parts_info) &&
defined(global_parts_info.communication_netmanager_base) &&
global_parts_info.communication_netmanager_base && is_ohos &&
is_standard_system && !is_arkui_x && product_name != "ohos-sdk") {
defines = [ "HAS_NETMANAGER_BASE=1" ]
external_deps += [ "ffrt:libffrt" ]
} else {
defines = [ "HAS_NETMANAGER_BASE=0" ]
}
if (current_os == "ohos") {
public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ]
external_deps += [
"c_utils:utils",
"hilog:libhilog",
"libuv:uv",
"napi:ace_napi",
"node:node_header_notice",
]
} else {
external_deps += [
"libuv:uv",
"bounds_checking_function:libsec_static",
"napi:ace_napi",
"node:node_header_notice",
]
}
part_name = "netstack"
subsystem_name = "communication"
}