# 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")
SUBSYSTEM_DIR = "//foundation/aafwk/standard"

config("fmskit_config") {
  defines = [
    "APP_LOG_TAG = \"FmskitNative\"",
    "LOG_DOMAIN = 0xD001151",
  ]
}
config("fmskit_public_config") {
  include_dirs = [
    "//foundation/aafwk/standard/frameworks/kits/fmskit/native/include",
    "${appexecfwk_path}/common/log/include",
    "//foundation/aafwk/standard/interfaces/innerkits/form_manager/include",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
    "//foundation/aafwk/standard/interfaces/innerkits/want/include",
    "//utils/system/safwk/native/include",
  ]
}

# build so
ohos_shared_library("fmskit_native") {
  configs = [ ":fmskit_config" ]
  public_configs = [ ":fmskit_public_config" ]
  sources = [
    "$SUBSYSTEM_DIR/frameworks/kits/fmskit/native/src/form_errors.cpp",
    "$SUBSYSTEM_DIR/frameworks/kits/fmskit/native/src/form_host_client.cpp",
    "$SUBSYSTEM_DIR/frameworks/kits/fmskit/native/src/form_mgr.cpp",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = [
    "${appexecfwk_path}/common:libappexecfwk_common",
    "//foundation/aafwk/standard/interfaces/innerkits/form_manager:form_manager",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "ability_runtime:app_manager",
    "ability_runtime:want",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "samgr_standard:samgr_proxy",
  ]

  subsystem_name = "aafwk"
  part_name = "form_runtime"
}
