1# Copyright (c) 2022 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 "$NETSTACK_DIR/frameworks/js/napi/http/http_module/include", 23 ] 24 if (current_os != "ohos") { 25 cflags = [ "-std=c++17" ] 26 } 27 if (product_name != "ohos-sdk") { 28 defines = [ "ENABLE_EVENT_HANDLER" ] 29 } 30} 31 32ohos_static_library("napi_utils") { 33 sources = [ 34 "src/base_context.cpp", 35 "src/event_listener.cpp", 36 "src/event_manager.cpp", 37 "src/module_template.cpp", 38 "src/napi_utils.cpp", 39 ] 40 41 part_name = "netstack" 42 subsystem_name = "communication" 43 public_configs = [ ":napi_utils_public_config" ] 44 45 deps = [ "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp" ] 46 47 public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ] 48 external_deps = [ 49 "c_utils:utils", 50 "hilog:libhilog", 51 "napi:ace_napi", 52 ] 53 if (product_name != "ohos-sdk") { 54 external_deps += [ "eventhandler:libeventhandler" ] 55 } 56} 57 58ohos_static_library("napi_utils_static") { 59 sources = [ 60 "src/base_context.cpp", 61 "src/event_listener.cpp", 62 "src/event_manager.cpp", 63 "src/module_template.cpp", 64 "src/napi_utils.cpp", 65 ] 66 67 public_configs = [ ":napi_utils_public_config" ] 68 69 deps = [ "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp" ] 70 71 if (current_os == "ohos") { 72 public_deps = [ "$NETSTACK_DIR/utils:stack_utils_common" ] 73 external_deps = [ 74 "c_utils:utils", 75 "eventhandler:libeventhandler", 76 "hilog:libhilog", 77 "napi:ace_napi", 78 ] 79 } else { 80 public_deps = [ 81 "$ARKUI_ROOT/napi:ace_napi", 82 "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static", 83 ] 84 } 85} 86