• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  cflags = [
63    "-fstack-protector-strong",
64    "-D_FORTIFY_SOURCE=2",
65    "-O2",
66  ]
67  cflags_cc = [
68    "-fstack-protector-strong",
69    "-D_FORTIFY_SOURCE=2",
70    "-O2",
71  ]
72
73  version_script = "libhttp_client.map"
74
75  public_configs = [ ":http_client_config" ]
76
77  deps = [ "$THIRD_PARTY_ROOT/curl:curl_shared" ]
78  deps += [
79    "$NETSTACK_DIR/utils:stack_utils_common",
80    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
81  ]
82
83  if (is_mingw || is_mac) {
84    sources +=
85        [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ]
86    deps += [ "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static" ]
87    external_deps = [ "netmanager_base:net_conn_manager_if" ]
88  } else {
89    deps += [
90      "$NETSTACK_DIR/utils:stack_utils_common",
91      "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp",
92    ]
93    external_deps = [
94      "hilog:libhilog",
95      "netmanager_base:net_conn_manager_if",
96    ]
97    if (product_name != "ohos-sdk") {
98      external_deps += [ "init:libbegetutil" ]
99    }
100  }
101
102  innerapi_tags = [ "platformsdk" ]
103  part_name = "netstack"
104  subsystem_name = "communication"
105}
106