1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/arkui/ace_engine/ace_config.gni")
16import(
17    "//foundation/arkui/ace_engine/adapter/ohos/services/uiservice/uiservicems.gni")
18
19ohos_prebuilt_etc("ui_service.cfg") {
20  relative_install_dir = "init"
21  source = "ui_service.cfg"
22  part_name = ace_engine_part
23  subsystem_name = ace_engine_subsystem
24}
25
26group("uiservice_target") {
27  deps = [ ":uiservice" ]
28}
29
30group("unittest") {
31  testonly = true
32
33  deps = [ "test:unittest" ]
34}
35
36config("uiservicems_config") {
37  include_dirs = [
38    "include/",
39    "$ace_root/interfaces/inner_api/ui_service_manager/include",
40  ]
41  cflags = []
42  if (target_cpu == "arm") {
43    cflags += [ "-DBINDER_IPC_32BIT" ]
44  }
45}
46
47template("uiservice_static") {
48  forward_variables_from(invoker, "*")
49
50  ohos_source_set(target_name) {
51    subsystem_name = ace_engine_subsystem
52    part_name = ace_engine_part
53    defines += invoker.defines
54    cflags_cc += invoker.cflags_cc
55    branch_protector_ret = "pac_ret"
56    sources = uiservice_files
57    configs = [
58      ":uiservicems_config",
59      "$ace_root:ace_config",
60    ]
61    external_deps = [
62      "ability_base:want",
63      "access_token:libtokenid_sdk",
64      "c_utils:utils",
65      "eventhandler:libeventhandler",
66      "hilog:libhilog",
67      "ipc:ipc_core",
68      "safwk:system_ability_fwk",
69    ]
70
71    if (uiservice_xcollie_enable) {
72      external_deps += [ "hicollie:libhicollie" ]
73      defines += [ "UISERVICE_MGR_XCOLLIE_ENABLE" ]
74    }
75  }
76}
77
78foreach(item, ace_platforms) {
79  platform = item.name
80  if (platform == "ohos") {
81    # generate uiservice_static lib
82    uiservice_static("uiservice_static_" + item.name) {
83      defines = []
84      config = {
85      }
86
87      if (defined(item.config)) {
88        config = item.config
89      }
90
91      if (defined(config.defines)) {
92        defines = config.defines
93      }
94
95      if (defined(config.cflags_cc)) {
96        cflags_cc = config.cflags_cc
97      }
98    }
99  }
100}
101
102ohos_shared_library("uiservice") {
103  sanitize = {
104    cfi = true
105    cfi_cross_dso = true
106    debug = false
107  }
108  branch_protector_ret = "pac_ret"
109  deps = [ ":uiservice_static_ohos" ]
110  part_name = ace_engine_part
111  subsystem_name = ace_engine_subsystem
112  configs = [ "$ace_root:ace_coverage_config" ]
113  external_deps = [ "hilog:libhilog" ]
114}
115