1# Copyright (c) 2021-2022 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 34 if (is_mingw || is_mac) { 35 cflags = [ 36 "-std=c++17", 37 "-stdlib=libc++", 38 ] 39 } 40 if (is_mingw) { 41 defines = [ "WINDOWS_PLATFORM" ] 42 } else if (is_mac) { 43 defines = [ "MAC_PLATFORM" ] 44 } else if (product_name != "ohos-sdk") { 45 defines = [ "HTTP_PROXY_ENABLE" ] 46 } 47} 48 49ohos_shared_library("http") { 50 sources = [ 51 "async_context/src/request_context.cpp", 52 "async_work/src/http_async_work.cpp", 53 "cache/base64/src/base64_utils.cpp", 54 "cache/cache_proxy/src/cache_proxy.cpp", 55 "cache/cache_strategy/src/http_cache_request.cpp", 56 "cache/cache_strategy/src/http_cache_response.cpp", 57 "cache/cache_strategy/src/http_cache_strategy.cpp", 58 "cache/cache_strategy/src/http_time.cpp", 59 "cache/lru_cache/src/disk_handler.cpp", 60 "cache/lru_cache/src/lru_cache.cpp", 61 "cache/lru_cache/src/lru_cache_disk_handler.cpp", 62 "constant/src/constant.cpp", 63 "http_exec/src/http_exec.cpp", 64 "http_module/src/http_module.cpp", 65 "options/src/http_request_options.cpp", 66 "options/src/http_response.cpp", 67 ] 68 69 configs = [ ":http_config" ] 70 71 deps = [ "$THIRD_PARTY_ROOT/curl:curl_shared" ] 72 if (is_mingw || is_mac) { 73 sources += 74 [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ] 75 deps += [ 76 "$ARKUI_ROOT/napi:ace_napi", 77 "$NETSTACK_DIR/utils/napi_utils:napi_utils_static", 78 "$THIRD_PARTY_ROOT/bounds_checking_function:libsec_static", 79 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static", 80 ] 81 } else { 82 deps += [ 83 "$NETSTACK_DIR/utils:stack_utils_common", 84 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 85 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", 86 ] 87 external_deps = [ 88 "c_utils:utils", 89 "hiviewdfx_hilog_native:libhilog", 90 "napi:ace_napi", 91 ] 92 if (product_name != "ohos-sdk") { 93 external_deps += [ "init:libbegetutil" ] 94 } 95 } 96 97 relative_install_dir = "module/net" 98 part_name = "netstack" 99 subsystem_name = "communication" 100} 101