1# Copyright (c) 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_client_config") { 18 # header file path 19 include_dirs = [ 20 "$THIRD_PARTY_ROOT/curl/include", 21 "$NETSTACK_DIR/interfaces/innerkits/http_client/include", 22 ] 23 24 cflags = [] 25 if (is_double_framework) { 26 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 27 } 28 if (target_cpu == "arm") { 29 cflags += [ "-DBINDER_IPC_32BIT" ] 30 } 31 if (is_standard_system) { 32 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 33 } 34 if (defined(build_public_version) && build_public_version) { 35 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 36 } 37 38 if (is_mingw) { 39 defines = [ "WINDOWS_PLATFORM" ] 40 } else if (is_mac) { 41 defines = [ "MAC_PLATFORM" ] 42 } 43} 44 45ohos_shared_library("http_client") { 46 sources = [ 47 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client.cpp", 48 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_constant.cpp", 49 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_error.cpp", 50 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_request.cpp", 51 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_response.cpp", 52 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_task.cpp", 53 "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_time.cpp", 54 ] 55 56 include_dirs = [ 57 "$NETSTACK_DIR/utils/common_utils/include", 58 "$NETSTACK_DIR/utils/log/include", 59 "$NETSTACK_NATIVE_ROOT/http/http_client/include", 60 ] 61 62 version_script = "libhttp_client.map" 63 64 public_configs = [ ":http_client_config" ] 65 66 deps = [ "$THIRD_PARTY_ROOT/curl:curl_shared" ] 67 deps += [ 68 "$NETSTACK_DIR/utils:stack_utils_common", 69 "$NETSTACK_DIR/utils/napi_utils:napi_utils", 70 ] 71 72 if (is_mingw || is_mac) { 73 sources += 74 [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ] 75 deps += [ "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static" ] 76 } else { 77 deps += [ 78 "$NETSTACK_DIR/utils:stack_utils_common", 79 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", 80 ] 81 external_deps = [ "hilog:libhilog" ] 82 if (product_name != "ohos-sdk") { 83 external_deps += [ "init:libbegetutil" ] 84 } 85 } 86 87 innerapi_tags = [ "platformsdk" ] 88 part_name = "netstack" 89 subsystem_name = "communication" 90} 91