1# Copyright (c) 2021-2023 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")
16
17# build static
18template("ace_ohos_standard_source_set") {
19  forward_variables_from(invoker, "*")
20
21  ohos_source_set(target_name) {
22    subsystem_name = ace_engine_subsystem
23    part_name = ace_engine_part
24    defines += invoker.defines
25    cflags_cc += invoker.cflags_cc
26
27    sources = [
28      "$ace_root/adapter/ohos/entrance/ace_ability.cpp",
29      "$ace_root/adapter/ohos/entrance/ace_application_info.cpp",
30      "$ace_root/adapter/ohos/entrance/ace_container.cpp",
31      "$ace_root/adapter/ohos/entrance/ace_data_ability.cpp",
32      "$ace_root/adapter/ohos/entrance/ace_extra_input_data.cpp",
33      "$ace_root/adapter/ohos/entrance/ace_form_ability.cpp",
34      "$ace_root/adapter/ohos/entrance/ace_new_pipe_judgement.cpp",
35      "$ace_root/adapter/ohos/entrance/ace_service_ability.cpp",
36      "$ace_root/adapter/ohos/entrance/ace_view_ohos.cpp",
37      "$ace_root/adapter/ohos/entrance/aps_monitor_impl.cpp",
38      "$ace_root/adapter/ohos/entrance/capability_registry.cpp",
39      "$ace_root/adapter/ohos/entrance/data_ability_helper_standard.cpp",
40      "$ace_root/adapter/ohos/entrance/dialog_container.cpp",
41      "$ace_root/adapter/ohos/entrance/file_asset_provider_impl.cpp",
42      "$ace_root/adapter/ohos/entrance/form_utils_impl.cpp",
43      "$ace_root/adapter/ohos/entrance/hap_asset_provider_impl.cpp",
44      "$ace_root/adapter/ohos/entrance/mmi_event_convertor.cpp",
45      "$ace_root/adapter/ohos/entrance/navigation_controller_helper.cpp",
46      "$ace_root/adapter/ohos/entrance/pa_container.cpp",
47      "$ace_root/adapter/ohos/entrance/plugin_utils_impl.cpp",
48      "$ace_root/adapter/ohos/entrance/subwindow/subwindow_ohos.cpp",
49      "$ace_root/adapter/ohos/entrance/touch_event_convertor.cpp",
50      "$ace_root/adapter/ohos/entrance/window/foldable_window_ohos.cpp",
51
52      # innerkits impl
53      "$ace_root/adapter/ohos/entrance/ui_content_impl.cpp",
54      "$ace_root/adapter/ohos/entrance/ui_event_impl.cpp",
55      "$ace_root/adapter/ohos/entrance/utils.cpp",
56
57      # drag window
58      "$ace_root/adapter/ohos/entrance/window/drag_window_ohos.cpp",
59
60      # ArkTs Card
61      "$ace_root/adapter/ohos/entrance/form_module_preloader.cpp",
62
63      # Dynamic Component
64      "$ace_root/adapter/ohos/entrance/dynamic_component/dynamic_component_renderer_impl.cpp",
65      "$ace_root/adapter/ohos/entrance/dynamic_component/uv_task_wrapper_impl.cpp",
66
67      #Miscdevice Vibrator
68      "$ace_root/adapter/ohos/entrance/vibrator/vibrator_utils.cpp",
69
70      # CJUtils
71      "$ace_root/adapter/ohos/entrance/cj_utils/cj_utils.cpp",
72
73      # AudioHaptic
74      "$ace_root/adapter/ohos/entrance/timepicker/timepicker_haptic_factory.cpp",
75    ]
76
77    if (enable_audio_framework && enable_player_framework) {
78      sources += [
79        "$ace_root/adapter/ohos/entrance/timepicker/timepicker_haptic_controller.cpp",
80        "$ace_root/adapter/ohos/entrance/timepicker/timepicker_haptic_impl.cpp",
81      ]
82    }
83
84    if (target_cpu == "arm64") {
85      defines += [ "_ARM64_" ]
86    }
87    if (current_os == "ohos" && current_cpu == "x86_64") {
88      defines += [ "SIMULATOR_64" ]
89    }
90
91    configs = [ "$ace_root:ace_config" ]
92
93    include_dirs = [ "$ace_root/interfaces/inner_api/ui_session" ]
94
95    deps = [
96      "$ace_root/adapter/ohos/capability:ace_capability_ohos",
97      "$ace_root/interfaces/inner_api/ace:ace_uicontent",
98      "$ace_root/interfaces/inner_api/ui_session:ui_session",
99    ]
100
101    external_deps = [
102      "ability_base:base",
103      "ability_base:configuration",
104      "ability_base:extractortool",
105      "ability_base:view_data",
106      "ability_base:want",
107      "ability_runtime:ability_connect_callback_stub",
108      "ability_runtime:ability_context_native",
109      "ability_runtime:ability_manager",
110      "ability_runtime:abilitykit_native",
111      "ability_runtime:app_context",
112      "ability_runtime:auto_fill_manager",
113      "ability_runtime:data_ability_helper",
114      "ability_runtime:napi_common",
115      "ability_runtime:ui_extension",
116      "bundle_framework:appexecfwk_core",
117      "common_event_service:cesfwk_innerkits",
118      "data_share:datashare_consumer",
119      "ets_runtime:libark_jsruntime",
120      "eventhandler:libeventhandler",
121      "graphic_2d:2d_graphics",
122      "graphic_2d:librender_service_client",
123      "i18n:intl_util",
124      "input:libmmi-client",
125      "ipc:ipc_core",
126      "ipc:ipc_napi",
127      "miscdevice:vibrator_interface_native",
128      "napi:ace_napi",
129      "preferences:native_preferences",
130      "relational_store:native_dataability",
131      "relational_store:native_rdb",
132      "resource_management:global_resmgr",
133      "safwk:system_ability_fwk",
134      "samgr:samgr_proxy",
135      "window_manager:libdm",
136      "window_manager:libwm",
137      "window_manager:libwsutils",
138      "window_manager:scene_session",
139      "window_manager:screen_session_manager_client",
140      "zlib:shared_libz",
141    ]
142    defines += [ "INDEXER_SUPPORT_VIBRATOR" ]
143    if (defined(config.enable_rosen_backend) && config.enable_rosen_backend) {
144      external_deps += [ "graphic_2d:librender_service_base" ]
145    }
146
147    if (form_fwk_enable) {
148      external_deps += [
149        "form_fwk:fmskit_native",
150        "form_fwk:fmskit_provider_client",
151        "form_fwk:form_manager",
152      ]
153    }
154
155    if (defined(config.media_library_exists) && config.media_library_exists) {
156      external_deps += [ "media_library:media_library_manager" ]
157    }
158
159    if (enable_audio_framework) {
160      external_deps += [ "audio_framework:audio_client" ]
161    }
162
163    if (enable_player_framework) {
164      external_deps += [ "player_framework:audio_haptic" ]
165    }
166
167    if (enable_graphic_text_gine) {
168      external_deps += [ "graphic_2d:rosen_text" ]
169    }
170
171    if (os_account_exists) {
172      external_deps += [ "os_account:os_account_innerkits" ]
173    }
174    deps +=
175        [ "$ace_root/interfaces/inner_api/ui_service_manager:ui_service_mgr" ]
176  }
177}
178
179foreach(item, ace_platforms) {
180  platform = item.name
181  if (platform == "ohos" || platform == "ohos_ng") {
182    ace_ohos_standard_source_set("ace_ohos_standard_entrance_${platform}") {
183      defines = []
184      cflags_cc = []
185      config = {
186      }
187
188      if (defined(item.config)) {
189        config = item.config
190      }
191
192      if (defined(config.defines)) {
193        defines = config.defines
194      }
195
196      if (defined(config.cflags_cc)) {
197        cflags_cc = config.cflags_cc
198      }
199    }
200  }
201}
202