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