1# Copyright (c) 2022-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/netstack/netstack_config.gni") 16 17config("napi_utils_public_config") { 18 include_dirs = [ 19 "include", 20 "$THIRD_PARTY_ROOT/node/src", 21 "$NETSTACK_DIR/utils/log/include", 22 ] 23 if (current_os != "ohos") { 24 cflags = [ "-std=c++17" ] 25 } 26} 27 28ohos_static_library("napi_utils") { 29 sanitize = { 30 cfi = true 31 cfi_cross_dso = true 32 debug = false 33 } 34 35 branch_protector_ret = "pac_ret" 36 37 sources = [ 38 "src/base_context.cpp", 39 "src/event_listener.cpp", 40 "src/event_manager.cpp", 41 "src/module_template.cpp", 42 "src/napi_utils.cpp", 43 "src/secure_char.cpp", 44 "src/timing.cpp", 45 ] 46 47 part_name = "netstack" 48 subsystem_name = "communication" 49 public_configs = [ ":napi_utils_public_config" ] 50 51 public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ] 52 external_deps = [ 53 "cJSON:cjson", 54 "c_utils:utils", 55 "hilog:libhilog", 56 "napi:ace_napi", 57 ] 58} 59 60ohos_static_library("napi_utils_static") { 61 sanitize = { 62 cfi = true 63 cfi_cross_dso = true 64 debug = false 65 } 66 67 branch_protector_ret = "pac_ret" 68 69 sources = [ 70 "src/base_context.cpp", 71 "src/event_listener.cpp", 72 "src/event_manager.cpp", 73 "src/module_template.cpp", 74 "src/napi_utils.cpp", 75 "src/secure_char.cpp", 76 "src/timing.cpp", 77 ] 78 79 public_configs = [ ":napi_utils_public_config" ] 80 81 external_deps = [ "cJSON:cjson" ] 82 83 if (current_os == "ohos") { 84 public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ] 85 external_deps += [ 86 "c_utils:utils", 87 "hilog:libhilog", 88 "napi:ace_napi", 89 ] 90 } else { 91 public_deps = [ 92 "$ARKUI_ROOT/napi:ace_napi", 93 "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static", 94 ] 95 } 96} 97