f4dc8b84创建于 29 天前历史提交
# Copyright (c) 2023-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("//build/ohos.gni")
import("//build/ohos/app/app.gni")
import("//foundation/ability/form_fwk/form_fwk.gni")

config("formrender_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "include",
    "${form_fwk_path}/common/include",
    "${form_fwk_path}/services/common/include",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
}

ohos_hap("formrender_service_hap") {
  hap_profile = "FormRenderService/entry/src/main/module.json"
  deps = [
    ":FormRender_js_assets",
    ":FormRender_resources",
  ]
  shared_libraries = [ ":formrender_service" ]
  certificate_profile = "${form_render_service_path}/signature/formrender.p7b"
  hap_name = "Form_Render_Service"
  part_name = "form_fwk"
  subsystem_name = "ability"
  module_install_dir = "app/com.ohos.formrenderservice"
}

ohos_js_assets("FormRender_js_assets") {
  hap_profile = "FormRenderService/entry/src/main/module.json"
  ets2abc = true
  source_dir = "FormRenderService/entry/src/main/ets"
}

ohos_app_scope("FormRender_app_profile") {
  app_profile = "FormRenderService/AppScope/app.json"
  sources = [ "FormRenderService/AppScope/resources" ]
}

ohos_resources("FormRender_resources") {
  sources = [ "FormRenderService/entry/src/main/resources" ]
  deps = [ ":FormRender_app_profile" ]
  hap_profile = "FormRenderService/entry/src/main/module.json"
}

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

  sanitize = {
    cfi = true
    cfi_cross_dso = true
    cfi_no_nvcall = true
    cfi_vcall_icall_only = true
    debug = false
  }
  install_enable = true

  configs = [ ":formrender_config" ]

  cflags_cc = [
    "-fdata-sections",
    "-ffunction-sections",
    "-Oz"
  ]

  ldflags = [
    "-flto",
    "-Wl,-z,relro",
    "-Wl,--exclude-libs=ALL",
    "-Wl,--gc-sections",
    "-Wl,--as-needed",
    "-Wl,--sort-common",
    "-Wl,--relax",
    "-Wl,-z,now",
    "-Wl,--icf=all",
  ]

  sources = [
    "src/form_memmgr_client.cpp",
    "src/form_memory_guard.cpp",
    "src/form_module_checker.cpp",
    "src/form_render_event_report.cpp",
    "src/form_render_record.cpp",
    "src/js_form_runtime.cpp",
    "src/form_render_service_mgr.cpp",
    "src/form_scoped_qos_promotion.cpp",
    "src/status_mgr_center/form_render_status.cpp",
    "src/status_mgr_center/form_render_status_mgr.cpp",
    "src/status_mgr_center/form_render_status_table.cpp",
    "src/status_mgr_center/form_render_status_task_mgr.cpp",
  ]

  defines = [
    "FMS_LOG_TAG = \"FormRenderService\"",
    "FMS_LOG_DOMAIN = 0xD001371",
  ]

  if (use_musl) {
    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
    }
  }

  deps = [
    "${form_fwk_path}:form_utils",
    "${form_fwk_path}:form_manager",
    "${form_fwk_path}:form_render_info",
    "${form_fwk_path}:form_common_info",
    "${form_fwk_path}/services/common:libform_common",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:extractortool",
    "ability_base:want",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:abilitykit_native",
    "ability_runtime:app_context",
    "ability_runtime:extensionkit_native",
    "ability_runtime:runtime",
    "ability_runtime:service_extension",
    "ace_engine:ace_form_render",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "common_event_service:cesfwk_innerkits",
    "config_policy:configpolicy_util",
    "ets_runtime:libark_jsruntime",
    "eventhandler:libeventhandler",
    "faultloggerd:libbacktrace_local",
    "faultloggerd:libdfx_dumpcatcher",
    "ffrt:libffrt",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "hitrace:hitrace_meter",
    "init:libbegetutil",
    "ipc:ipc_core",
    "ipc:ipc_napi",
    "napi:ace_napi",
    "samgr:samgr_proxy",
    "graphic_2d:librender_service_client",
    "graphic_2d:rosen_text",
    "ace_engine:ace_uicontent",
    "qos_manager:qos",
    "window_manager:libwm",
  ]

  subsystem_name = "ability"
  part_name = "form_fwk"
}

ohos_shared_library("formrender_service") {
  sanitize = {
    cfi = true
    cfi_cross_dso = true
    cfi_no_nvcall = true
    cfi_vcall_icall_only = true
    debug = false
  }
  install_enable = true

  configs = [ ":formrender_config" ]

  cflags_cc = [
    "-fdata-sections",
    "-ffunction-sections",
    "-Oz"
  ]

  ldflags = [
    "-flto",
    "-Wl,-z,relro",
    "-Wl,--exclude-libs=ALL",
    "-Wl,--gc-sections",
    "-Wl,--as-needed",
    "-Wl,--sort-common",
    "-Wl,--relax",
    "-Wl,-z,now",
    "-Wl,--icf=all",
  ]

  sources = [
    "src/form_render_impl.cpp",
    "src/form_render_service_extension.cpp",
  ]

  defines = [ "FMS_LOG_TAG = \"FormRenderService\"" ]

  if (use_musl) {
    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
    }
  }

  deps = [
    ":formrender",
    "${form_fwk_path}:form_utils",
    "${form_fwk_path}:form_manager",
    "${form_fwk_path}:form_render_info",
    "${form_fwk_path}:form_common_info",
    "${form_fwk_path}/services/common:libform_common",
  ]

  external_deps = [
    "ability_base:configuration",
    "ability_base:want",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:abilitykit_native",
    "ability_runtime:abilitykit_utils",
    "ability_runtime:app_context",
    "ability_runtime:extensionkit_native",
    "ability_runtime:runtime",
    "ability_runtime:service_extension",
    "ace_engine:ace_form_render",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "common_event_service:cesfwk_innerkits",
    "ets_runtime:libark_jsruntime",
    "eventhandler:libeventhandler",
    "ffrt:libffrt",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "hitrace:hitrace_meter",
    "image_framework:image_native",
    "ipc:ipc_core",
    "ipc:ipc_napi",
    "napi:ace_napi",
    "window_manager:libwm",
  ]

  defines = []
  if (form_runtime_power) {
    defines = [ "SUPPORT_POWER" ]
    external_deps += [ "power_manager:powermgr_client" ]
  }

  subsystem_name = "ability"
  part_name = "form_fwk"
}