1# Copyright (c) 2023-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("networksecurity_napi_config") { 18 include_dirs = [ 19 "async_context/include", 20 "async_work/include", 21 "net_ssl_exec/include", 22 "net_ssl_module/include", 23 "$THIRD_PARTY_ROOT/openssl/include", 24 "$NETSTACK_DIR/frameworks/native/net_ssl/include", 25 "$NETSTACK_DIR/interfaces/innerkits/net_ssl/include", 26 "$NETSTACK_DIR/utils/common_utils/include", 27 ] 28 29 if (is_mingw || is_mac) { 30 cflags = [ 31 "-std=c++17", 32 "-stdlib=libc++", 33 ] 34 } 35 if (is_mingw) { 36 defines = [ "WINDOWS_PLATFORM" ] 37 } else if (is_mac) { 38 defines = [ "MAC_PLATFORM" ] 39 } 40} 41 42ohos_shared_library("networksecurity_napi") { 43 sanitize = { 44 cfi = true 45 cfi_cross_dso = true 46 debug = false 47 } 48 49 branch_protector_ret = "pac_ret" 50 51 sources = [ 52 "async_context/src/cert_context.cpp", 53 "async_work/src/net_ssl_async_work.cpp", 54 "net_ssl_exec/src/net_ssl_exec.cpp", 55 "net_ssl_module/src/net_ssl_module.cpp", 56 ] 57 cflags = [ 58 "-fstack-protector-strong", 59 "-D_FORTIFY_SOURCE=2", 60 "-O2", 61 ] 62 cflags_cc = [ 63 "-fstack-protector-strong", 64 "-D_FORTIFY_SOURCE=2", 65 "-O2", 66 ] 67 68 configs = [ ":networksecurity_napi_config" ] 69 70 deps = [] 71 if (is_mingw || is_mac) { 72 sources += 73 [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ] 74 deps += [ 75 "$ARKUI_ROOT/napi:ace_napi", 76 "$NETSTACK_DIR/utils/napi_utils:napi_utils_static", 77 ] 78 } else { 79 deps += [ 80 "$NETSTACK_DIR/interfaces/innerkits/net_ssl:net_ssl", 81 "$NETSTACK_DIR/utils:stack_utils_common", 82 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 83 ] 84 external_deps = [ 85 "hilog:libhilog", 86 "napi:ace_napi", 87 "openssl:libcrypto_shared", 88 "openssl:libssl_shared", 89 ] 90 } 91 defines = [] 92 if (defined(global_parts_info) && 93 defined(global_parts_info.communication_netmanager_base) && 94 global_parts_info.communication_netmanager_base) { 95 external_deps += [ "netmanager_base:net_conn_manager_if" ] 96 defines += [ "HAS_NETMANAGER_BASE=1" ] 97 } else { 98 defines += [ "HAS_NETMANAGER_BASE=0" ] 99 } 100 101 relative_install_dir = "module/net" 102 part_name = "netstack" 103 subsystem_name = "communication" 104} 105