# 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")
import("//foundation/aafwk/standard/aafwk.gni")

config("formmgr_sdk_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "include/",
    "//third_party/json/include",
    "//utils/system/safwk/native/include",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/include",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
    "//foundation/aafwk/standard/interfaces/innerkits/app_manager/include/appmgr",
    "//foundation/appexecfwk/standard/common/log/include",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
}

ohos_shared_library("form_manager") {
  sources = [
    "src/form_host_proxy.cpp",
    "src/form_host_stub.cpp",
    "src/form_js_info.cpp",
    "src/form_mgr_proxy.cpp",
    "src/form_mgr_stub.cpp",
    "src/form_provider_data.cpp",
    "src/form_provider_info.cpp",
    "src/form_provider_proxy.cpp",
    "src/form_provider_stub.cpp",
    "src/form_supply_proxy.cpp",
    "src/form_supply_stub.cpp",
    "src/provider_connect_proxy.cpp",
    "src/provider_connect_stub.cpp",
  ]

  public_configs = [
    ":formmgr_sdk_config",
    "${services_path}/formmgr:formmgr_config",
  ]

  deps = [
    "${appexecfwk_path}/common:libappexecfwk_common",
    "${innerkits_path}/want:want",
    "//foundation/aafwk/standard/interfaces/innerkits/app_manager:app_manager",
    "//third_party/jsoncpp:jsoncpp",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]

  subsystem_name = "aafwk"
  part_name = "form_runtime"
}
