# 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("//foundation/arkui/ace_engine/ace_config.gni")

config("form_render_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "$ace_root/frameworks",
    "include/",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
}

ohos_shared_library("ace_form_render") {
  branch_protector_ret = "pac_ret"

  if (current_os == "ohos") {
    sanitize = {
      cfi = true
      cfi_cross_dso = true
      cfi_no_nvcall = true
      cfi_vcall_icall_only = true
      integer_overflow = true
      boundary_sanitize = true
      debug = ace_sanitize_debug
    }
  }
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_group.cpp",
  ]

  configs = [
    "$ace_root:ace_config",
    "$ace_root:ace_coverage_config",
  ]

  public_configs = [ ":form_render_config" ]

  deps = [ "$ace_root/interfaces/inner_api/ace:ace_uicontent" ]

  external_deps = [
    "ability_base:configuration",
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_utils",
    "form_fwk:form_render_info",
    "form_fwk:form_utils",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
    "window_manager:libwm",
  ]

  subsystem_name = ace_engine_subsystem
  innerapi_tags = [ "platformsdk_indirect" ]
  part_name = ace_engine_part
}