1# Copyright (c) 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/netmanager_base/netmanager_base_config.gni") 16 17ohos_shared_library("cj_net_connection_ffi") { 18 sanitize = { 19 cfi = true 20 cfi_cross_dso = true 21 boundary_sanitize = true 22 all_ubsan = true 23 debug = false 24 } 25 26 branch_protector_ret = "pac_ret" 27 28 include_dirs = [ 29 "include", 30 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/async_context/include", 31 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/async_work/include", 32 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/connection_exec/include", 33 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/connection_module/include", 34 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/net_handle_interface/include", 35 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/observer/include", 36 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection/options/include", 37 "$NETMANAGER_BASE_ROOT/utils/log/include", 38 "$NETMANAGER_BASE_ROOT/utils/errorcode_utils/include", 39 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 40 ] 41 42 sources = [ 43 "src/net_connection_callback.cpp", 44 "src/net_connection_ffi.cpp", 45 "src/net_connection_impl.cpp", 46 ] 47 48 cflags = [ 49 "-fstack-protector-strong", 50 "-D_FORTIFY_SOURCE=2", 51 "-O2", 52 ] 53 54 cflags_cc = [ 55 "-fvisibility=hidden", 56 "-fstack-protector-strong", 57 "-D_FORTIFY_SOURCE=2", 58 "-O2", 59 ] 60 61 deps = [ 62 "$INNERKITS_ROOT/netconnclient:net_conn_manager_if", 63 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection:connection", 64 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/connection:connection_if", 65 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 66 "$NETMANAGER_BASE_ROOT/utils/napi_utils:napi_utils", 67 ] 68 69 external_deps = [ 70 "c_utils:utils", 71 "hilog:libhilog", 72 "ipc:ipc_core", 73 "ipc:ipc_napi", 74 "napi:ace_napi", 75 "napi:cj_bind_ffi", 76 "napi:cj_bind_native", 77 "samgr:samgr_proxy", 78 ] 79 80 defines = [] 81 82 if (build_ohos_sdk) { 83 defines += [ "PREVIEWER" ] 84 sources = [ "src/net_connection_mock.cpp" ] 85 } 86 87 if (current_os == "ohos") { 88 defines += [ "OHOS_PLATFORM" ] 89 } 90 91 if (current_os == "mingw") { 92 defines += [ "WINDOWS_PLATFORM" ] 93 } 94 95 innerapi_tags = [ "platformsdk" ] 96 part_name = "netmanager_base" 97 subsystem_name = "communication" 98} 99