# Copyright (c) 2021-2022 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("//base/hiviewdfx/faultloggerd/faultloggerd.gni")

if (defined(ohos_lite)) {
  shared_library("libfaultloggerd") {
    visibility = [ "*:*" ]

    include_dirs = [
      ".",
      "include",
      "$c_utils_include_path",
      "$faultloggerd_common_path/cutil",
      "$faultloggerd_common_path/dfxlog",
      "$faultloggerd_common_path/dfxutil",
      "$hilog_lite_include_path",
    ]

    sources = [
      "faultloggerd_client.cpp",
      "faultloggerd_socket.cpp",
    ]
    cflags = [ "-fstack-protector-strong" ]
    sources += [ "$c_utils_src_path/directory_ex.cpp" ]

    deps = [
      "$faultloggerd_path/common/cutil:dfx_cutil",
      "$faultloggerd_path/common/dfxlog:dfx_hilog",
      "$faultloggerd_path/common/dfxutil:dfx_util",
    ]

    external_deps = [
      "hilog_lite:hilog_shared",
      "init:libbegetutil",
    ]
  }
} else {
  config("faultloggerd_client_config") {
    visibility = [ "*:*" ]

    include_dirs = [
      "include",
      "$faultloggerd_interfaces_path/common",
    ]
  }

  ohos_shared_library("libfaultloggerd") {
    branch_protector_ret = "pac_ret"
    public_configs = [
      ":faultloggerd_client_config",
      "$faultloggerd_path/common/build:coverage_flags",
    ]

    sources = [
      "faultloggerd_client.cpp",
      "faultloggerd_socket.cpp",
    ]
    cflags = [ "-fstack-protector-strong" ]
    include_dirs = [ "." ]
    version_script = "libfaultloggerd.map"
    deps = [
      "$faultloggerd_common_path/cutil:dfx_cutil",
      "$faultloggerd_common_path/dfxlog:dfx_hilog",
      "$faultloggerd_common_path/dfxutil:dfx_util",
    ]
    external_deps = [
      "c_utils:utils",
      "hilog:libhilog",
      "init:libbegetutil",
    ]
    install_images = [
      "system",
      "updater",
    ]
    innerapi_tags = [
      "chipsetsdk_indirect",
      "platformsdk_indirect",
    ]
    part_name = "faultloggerd"
    subsystem_name = "hiviewdfx"
  }
}