# Copyright (c) 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("//build/ohos.gni")

config("userauth_executors_public_config") {
  include_dirs = [
    "../../../interfaces/inner_api",
    "../../../interfaces/inner_api/iam_executor",
  ]
}

ohos_shared_library("userauth_executors") {
  sanitize = {
    integer_overflow = true
    ubsan = true
    boundary_sanitize = true
    cfi = true
    cfi_cross_dso = true
    debug = false
    blocklist = "../../../cfi_blocklist.txt"
  }
  branch_protector_ret = "pac_ret"
  sources = [
    "src/async_command/abandon_command.cpp",
    "src/async_command/async_command_base.cpp",
    "src/async_command/auth_command.cpp",
    "src/async_command/collect_command.cpp",
    "src/async_command/custom_command.cpp",
    "src/async_command/enroll_command.cpp",
    "src/async_command/identify_command.cpp",
    "src/driver.cpp",
    "src/driver_manager.cpp",
    "src/executor.cpp",
    "src/framework/executor_mgr_wrapper.cpp",
    "src/framework/framework_executor_callback.cpp",
    "src/iauth_executor_hdi.cpp",
    "src/idriver_manager.cpp",
    "src/listener/auth_executor_mgr_status_listener.cpp",
    "src/listener/driver_manager_status_listener.cpp",
  ]

  include_dirs = [
    "include",
    "include/async_command",
    "include/framework",
    "include/listener",
  ]

  cflags = [ "-Oz" ]

  configs = [ "../../../common:iam_log_config" ]

  public_configs = [ ":userauth_executors_public_config" ]

  remove_configs = [ "//build/config/compiler:no_exceptions" ]

  if (use_musl) {
    version_script = "user_auth_executors_map"
  }

  deps = [
    "../../../common:iam_utils",
    "../../../frameworks/native/client:userauth_client",
    "../../../frameworks/native/common:attributes",
    "../../../frameworks/native/common:dfx",
  ]

  external_deps = [
    "c_utils:utils",
    "hdf_core:libhdi",
    "hilog:libhilog",
    "init:libbeget_proxy",
    "init:libbegetutil",
    "ipc:ipc_single",
    "samgr:samgr_proxy",
  ]

  subsystem_name = "useriam"
  part_name = "user_auth_framework"
}