# 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", "$THIRD_PARTY_ROOT/node/src", "$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/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", "napi:ace_napi", ] 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/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 (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", "napi:ace_napi", ] } else { public_deps = [ "$ARKUI_ROOT/napi:ace_napi", "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static", ] } }