# Copyright (c) 2021 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")
INPUT_ROOT_DIR = "./.."

if (defined(ohos_lite)) {
  config("input_hdi_public_config") {
    visibility = [ ":*" ]
    include_dirs = [
      "include",
      "$INPUT_ROOT_DIR/interfaces/include",
      "//third_party/bounds_checking_function/include",
    ]
  }

  ohos_shared_library("hdi_input") {
    output_extension = "z.so"
    sources = [
      "src/input_controller.c",
      "src/input_manager.c",
      "src/input_reporter.c",
    ]

    public_configs = [ ":input_hdi_public_config" ]
    include_dirs = []

    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
    external_deps = [
      "hdf_core:libhdf_utils",
      "hilog_lite:hilog_shared",
    ]
    defines = [ "__USER__" ]

    cflags = [
      "-Wall",
      "-Wextra",
      "-Werror",
      "-fsigned-char",
      "-fno-common",
      "-fno-strict-aliasing",
    ]

    subsystem_name = "hdf"

    install_images = [
      chipset_base_dir,
      "updater",
    ]
    innerapi_tags = [ "passthrough_indirect" ]
    part_name = "drivers_peripheral_input"
  }
} else {
  config("input_hdi_public_config") {
    visibility = [ ":*" ]
    include_dirs = [ "$INPUT_ROOT_DIR/interfaces/include" ]
  }

  ohos_shared_library("hdi_input") {
    sources = [
      "src/input_controller.c",
      "src/input_manager.c",
      "src/input_reporter.c",
    ]

    public_configs = [ ":input_hdi_public_config" ]
    include_dirs = [ "$INPUT_ROOT_DIR/hal/include" ]

    defines = [ "__OHOS__USER__" ]

    cflags = [
      "-Wall",
      "-Wextra",
      "-Werror",
      "-fsigned-char",
      "-fno-common",
      "-fno-strict-aliasing",
    ]

    subsystem_name = "hdf"
    if (is_standard_system) {
      external_deps = [
        "c_utils:utils",
        "hdf_core:libhdf_utils",
        "hilog:libhilog",
      ]
    } else {
      external_deps = [ "hilog:libhilog" ]
    }
    install_images = [
      chipset_base_dir,
      "updater",
    ]
    innerapi_tags = [ "passthrough_indirect" ]
    part_name = "drivers_peripheral_input"
  }
}