1# Copyright (c) 2021-2023 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_config") { 18 include_dirs = [ 19 "async_context/include", 20 "async_work/include", 21 "cache/base64/include", 22 "cache/cache_constant/include", 23 "cache/cache_proxy/include", 24 "cache/cache_strategy/include", 25 "cache/lru_cache/include", 26 "constant/include", 27 "http_exec/include", 28 "http_module/include", 29 "options/include", 30 "$THIRD_PARTY_ROOT/curl/include", 31 "$NETSTACK_DIR/utils/common_utils/include", 32 ] 33 if (defined(global_parts_info) && 34 defined(global_parts_info.communication_netmanager_base) && 35 global_parts_info.communication_netmanager_base) { 36 include_dirs += [ 37 "$NETMANAGER_BASE_INNERKITS_DIR/include", 38 "$NETMANAGER_BASE_INNERKITS_DIR/netconnclient/include", 39 ] 40 } 41 42 if (is_mingw || is_mac) { 43 cflags = [ 44 "-std=c++17", 45 "-stdlib=libc++", 46 ] 47 } 48 if (is_mingw) { 49 defines = [ "WINDOWS_PLATFORM" ] 50 } else if (is_mac) { 51 defines = [ "MAC_PLATFORM" ] 52 } else if (product_name != "ohos-sdk") { 53 defines = [ "HTTP_PROXY_ENABLE" ] 54 } 55} 56 57ohos_shared_library("http") { 58 sources = [ 59 "async_context/src/request_context.cpp", 60 "async_work/src/http_async_work.cpp", 61 "cache/base64/src/base64_utils.cpp", 62 "cache/cache_proxy/src/cache_proxy.cpp", 63 "cache/cache_strategy/src/http_cache_request.cpp", 64 "cache/cache_strategy/src/http_cache_response.cpp", 65 "cache/cache_strategy/src/http_cache_strategy.cpp", 66 "cache/cache_strategy/src/http_time.cpp", 67 "cache/lru_cache/src/disk_handler.cpp", 68 "cache/lru_cache/src/lru_cache.cpp", 69 "cache/lru_cache/src/lru_cache_disk_handler.cpp", 70 "constant/src/constant.cpp", 71 "http_exec/src/http_exec.cpp", 72 "http_module/src/http_module.cpp", 73 "options/src/http_request_options.cpp", 74 "options/src/http_response.cpp", 75 ] 76 77 configs = [ ":http_config" ] 78 79 deps = [ "$THIRD_PARTY_ROOT/curl:curl_shared" ] 80 if (is_mingw || is_mac) { 81 sources += 82 [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ] 83 deps += [ 84 "$ARKUI_ROOT/napi:ace_napi", 85 "$NETSTACK_DIR/utils/napi_utils:napi_utils_static", 86 "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static", 87 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static", 88 ] 89 } else { 90 deps += [ 91 "$NETSTACK_DIR/utils:stack_utils_common", 92 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 93 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", 94 ] 95 external_deps = [ 96 "hilog:libhilog", 97 "napi:ace_napi", 98 ] 99 if (defined(global_parts_info) && 100 defined(global_parts_info.communication_netmanager_base) && 101 global_parts_info.communication_netmanager_base) { 102 external_deps += [ "netmanager_base:net_conn_manager_if" ] 103 defines = [ "HAS_NETMANAGER_BASE=1" ] 104 } else { 105 defines = [ "HAS_NETMANAGER_BASE=0" ] 106 } 107 if (product_name != "ohos-sdk") { 108 external_deps += [ "init:libbegetutil" ] 109 } 110 } 111 112 relative_install_dir = "module/net" 113 part_name = "netstack" 114 subsystem_name = "communication" 115} 116