# Copyright (C) 2025 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("//foundation/systemabilitymgr/selectionfwk/selection_service.gni")
import("//build/ohos.gni")

config("selection_js_common_public_config") {
  visibility = [ "./*" ]
  include_dirs = [
    "./",
  ]
}

ohos_static_library("selection_common") {
  branch_protector_ret = "pac_ret"

  include_dirs = [
    "./",
    "../utils/include",
  ]
  sanitize = {
    cfi = true
    cfi_cross_dso = true
    cfi_vcall_icall_only = true
    debug = false
  }
  sources = [
    "event_checker.cpp",
    "callback_handler.cpp",
    "callback_object.cpp",
    "util.cpp",
    "selectionmethod_trace.cpp",
    "selectionfwk_js_utils.cpp",
  ]

  ldflags = [ "-Wl,--exclude-libs=ALL" ]
  cflags = [
    "-fdata-sections",
    "-ffunction-sections",
    "-fvisibility=hidden",
    "-Wno-c99-designator",
  ]
  public_configs = [ ":selection_js_common_public_config" ]
  deps = []
  external_deps = [
    "eventhandler:libeventhandler",
    "napi:ace_napi",
    "hilog:libhilog",
    "hitrace:hitrace_meter",
    "hitrace:libhitracechain",
    "ability_base:want",
    "ability_runtime:abilitykit_native",
    "ability_runtime:extensionkit_native",
    "ffrt:libffrt",
  ]
  part_name = "selectionfwk"
  subsystem_name = "systemabilitymgr"
}