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("http_client_config") { 18 # header file path 19 include_dirs = [ 20 "$NETSTACK_DIR/interfaces/innerkits/http_client/include", 21 "$NETSTACK_DIR/utils/profiler_utils/include", 22 "$NETSTACK_DIR/utils/tlv_utils/include", 23 ] 24 25 cflags = [] 26 if (is_double_framework) { 27 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 28 } 29 if (target_cpu == "arm") { 30 cflags += [ "-DBINDER_IPC_32BIT" ] 31 } 32 if (is_standard_system) { 33 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 34 } 35 if (defined(build_public_version) && build_public_version) { 36 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 37 } 38 39 if (is_mingw) { 40 defines = [ "WINDOWS_PLATFORM" ] 41 } else if (is_mac) { 42 defines = [ "MAC_PLATFORM" ] 43 } else { 44 defines = [] 45 } 46 47 if (product_name != "ohos-sdk") { 48 defines += [ "HTTP_MULTIPATH_CERT_ENABLE" ] 49 } 50} 51 52ohos_shared_library("http_client") { 53 sanitize = { 54 cfi = true 55 cfi_cross_dso = true 56 debug = false 57 } 58 59 branch_protector_ret = "pac_ret" 60 61 sources = [ 62 "$NETSTACK_DIR/utils/http_over_curl/src/epoll_multi_driver.cpp", 63 "$NETSTACK_DIR/utils/http_over_curl/src/epoll_request_handler.cpp", 64 "$NETSTACK_DIR/utils/profiler_utils/src/http_client_network_message.cpp", 65 "$NETSTACK_DIR/utils/profiler_utils/src/i_network_message.cpp", 66 "$NETSTACK_DIR/utils/profiler_utils/src/netstack_network_profiler.cpp", 67 "$NETSTACK_DIR/utils/tlv_utils/src/tlv_utils.cpp", 68 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client.cpp", 69 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_constant.cpp", 70 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_error.cpp", 71 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_request.cpp", 72 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_response.cpp", 73 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_task.cpp", 74 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_time.cpp", 75 ] 76 77 include_dirs = [ 78 "$NETSTACK_DIR/utils/common_utils/include", 79 "$NETSTACK_DIR/utils/http_over_curl/include", 80 "$NETSTACK_DIR/utils/log/include", 81 "$NETSTACK_NATIVE_ROOT/http/http_client/include", 82 ] 83 84 cflags = [ 85 "-fstack-protector-strong", 86 "-D_FORTIFY_SOURCE=2", 87 "-O2", 88 ] 89 cflags_cc = [ 90 "-fstack-protector-strong", 91 "-D_FORTIFY_SOURCE=2", 92 "-O2", 93 ] 94 95 version_script = "libhttp_client.map" 96 97 public_configs = [ ":http_client_config" ] 98 99 deps = [ 100 "$NETSTACK_DIR/utils:stack_utils_common", 101 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 102 ] 103 104 public_external_deps = [ "curl:curl_shared" ] 105 106 if (is_mingw || is_mac) { 107 sources += [ 108 "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp", 109 "$NETSTACK_DIR/utils/common_utils/src/request_tracer.cpp", 110 ] 111 112 external_deps = [ "netmanager_base:net_conn_manager_if" ] 113 } else { 114 deps += [ "$NETSTACK_DIR/utils:stack_utils_common" ] 115 external_deps = [ 116 "ability_runtime:wantagent_innerkits", 117 "hilog:libhilog", 118 "hiprofiler:libnetwork_profiler", 119 "hitrace:hitrace_meter", 120 "netmanager_base:net_conn_manager_if", 121 "time_service:time_client", 122 ] 123 if (product_name != "ohos-sdk") { 124 external_deps += [ "init:libbegetutil" ] 125 } 126 } 127 128 external_deps += [ 129 "curl:curl_shared", 130 "openssl:libcrypto_shared", 131 "openssl:libssl_shared", 132 ] 133 134 innerapi_tags = [ "platformsdk" ] 135 part_name = "netstack" 136 subsystem_name = "communication" 137} 138