# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//foundation/communication/netstack/netstack_config.gni") config("http_client_config") { # header file path include_dirs = [ "$THIRD_PARTY_ROOT/curl/include", "$NETSTACK_DIR/interfaces/innerkits/http_client/include", ] cflags = [] if (is_double_framework) { cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] } if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } if (is_standard_system) { cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] } if (defined(build_public_version) && build_public_version) { cflags += [ "-DBUILD_PUBLIC_VERSION" ] } if (is_mingw) { defines = [ "WINDOWS_PLATFORM" ] } else if (is_mac) { defines = [ "MAC_PLATFORM" ] } } ohos_shared_library("http_client") { sources = [ "$NETSTACK_NATIVE_ROOT/http/http_client/http_client.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_constant.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_error.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_request.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_response.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_task.cpp", "$NETSTACK_NATIVE_ROOT/http/http_client/http_client_time.cpp", ] include_dirs = [ "$NETSTACK_DIR/utils/common_utils/include", "$NETSTACK_DIR/utils/log/include", "$NETSTACK_NATIVE_ROOT/http/http_client/include", ] cflags = [ "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-O2", ] cflags_cc = [ "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-O2", ] version_script = "libhttp_client.map" public_configs = [ ":http_client_config" ] deps = [ "$THIRD_PARTY_ROOT/curl:curl_shared" ] deps += [ "$NETSTACK_DIR/utils:stack_utils_common", "$NETSTACK_DIR/utils/napi_utils:napi_utils", ] if (is_mingw || is_mac) { sources += [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ] deps += [ "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp_static" ] external_deps = [ "netmanager_base:net_conn_manager_if" ] } else { deps += [ "$NETSTACK_DIR/utils:stack_utils_common", "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", ] external_deps = [ "hilog:libhilog", "netmanager_base:net_conn_manager_if", ] if (product_name != "ohos-sdk") { external_deps += [ "init:libbegetutil" ] } } innerapi_tags = [ "platformsdk" ] part_name = "netstack" subsystem_name = "communication" }