# 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("../../windowmanager_aafwk.gni")

config("window_scene_common_public_config") {
  include_dirs = [
    "${window_base_path}/window_scene",
    "${window_base_path}/interfaces/include",

    # for window_manager_hilog
    "${window_base_path}/utils/include",
    "${window_base_path}/interfaces/innerkits/wm",
    "${window_base_path}/interfaces/innerkits/dm",
  ]
}

## Build libwindow_scene_common.so
ohos_shared_library("window_scene_common") {
  branch_protector_ret = "pac_ret"
  sanitize = {
    cfi = true
    cfi_cross_dso = true
    cfi_vcall_icall_only = true
    debug = false
  }
  sources = [
    "src/session_permission.cpp",
    "src/task_scheduler.cpp",
    "src/window_session_property.cpp",
  ]

  public_configs = [ ":window_scene_common_public_config" ]

  external_deps = [
    "ability_base:want",
    "ability_runtime:app_manager",
    "access_token:libaccesstoken_sdk",
    "access_token:libtokenid_sdk",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hilog:libhilog",
    "hitrace:hitrace_meter",
    "image_framework:image_native",
    "imf:inputmethod_client",
    "init:libbegetutil",
    "input:libmmi-client",
    "ipc:ipc_core",
    "ipc:ipc_single",
    "samgr:samgr_proxy",
  ]

  innerapi_tags = [ "platformsdk_indirect" ]
  part_name = "window_manager"
  subsystem_name = "window"

  defines = []
  if (build_variant == "user") {
    defines += [ "IS_RELEASE_VERSION" ]
  }
}