• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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/config/clang/clang.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17
18# Config args
19declare_args() {
20  # ace debug flag, enable debug features: like dcheck, thread-checker, mem-monitor...
21  enable_ace_debug = false
22
23  # show the instance id in logs.
24  enable_ace_instance_log = true
25
26  # Disable glfw window to build for PC preview scenario.
27  enable_glfw_window = false
28
29  # Enable metal in iOS or MacOS
30  shell_enable_metal = false
31
32  # Enable pgo for building.
33  ace_engine_feature_enable_pgo = false
34
35  # Enable pgo for building.
36  ace_engine_feature_enable_codemerge = false
37
38  # Enable AArch64 instruction prefetch for building.
39  ace_engine_feature_enable_inst_prefetch = false
40
41  # Set pgo profdata path
42  ace_engine_feature_pgo_path = ""
43
44  # Enable atomic for building.
45  ace_engine_feature_enable_atomic = false
46
47  # Set Instruction Sched Model
48  ace_engine_feature_sched_model = ""
49
50  # Enable test coverage
51  ace_engine_feature_enable_coverage = false
52
53  # Enalbe point light
54  ace_engine_feature_enable_point_light = true
55
56  # Set atomicservice basic engine so path
57  ace_engine_feature_asbng_path = ""
58
59  # Sanitize debug
60  ace_sanitize_debug = false
61
62  # Enable when build for text engine adapter
63  enable_graphic_text_gine = true
64
65  # Enable split_mode support
66  ace_engine_feature_enable_split_mode = false
67
68  # Enable navigation split mode support
69  ace_engine_feature_enable_nav_split_mode = false
70
71  # Enable aps framework support
72  ace_engine_feature_enable_aps = false
73
74  # Enable wearable product support
75  ace_engine_feature_wearable = false
76
77  # Enable form size change animation
78  ace_engine_feature_enable_form_size_change_animation = true
79
80  # Enalbe form menu default, wearable product is not supported
81  ace_engine_feature_form_menu_enable = true
82
83  # Enable ace_engine circular screen
84  ace_engine_feature_enable_digital_crown = false
85
86  # Enable event extra handling
87  ace_engine_feature_enable_event_extra_handling = false
88
89  # Enable ace_engine circle feature
90  ace_engine_enable_circle_feature = true
91
92  # Enable long press gesture extra handling
93  ace_engine_feature_enable_long_press_gesture_extra_handling = false
94
95  # Enable skia upgrade
96  ace_engine_feature_enable_upgrade_skia = true
97}
98
99enable_dump_drawcmd = false
100is_ohos_standard_system = is_standard_system && !is_arkui_x
101use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64"
102use_mac = "${current_os}_${current_cpu}" == "mac_x64" ||
103          "${current_os}_${current_cpu}" == "mac_arm64"
104use_ios = "${current_os}_${current_cpu}" == "ios_x64" ||
105          "${current_os}_${current_cpu}" == "ios_arm64"
106use_linux = "${current_os}_${current_cpu}" == "linux_x64" ||
107            "${current_os}_${current_cpu}" == "linux_arm64"
108
109use_hilog = is_mingw || is_mac || is_linux || is_ohos || is_ohos_standard_system
110
111# Config path
112ace_root = "//foundation/arkui/ace_engine"
113hilog_root = "//base/hiviewdfx/hilog"
114ace_napi_frameworks = "//foundation/arkui/ace_engine/frameworks"
115ace_napi = "//foundation/arkui/napi"
116arkui_root = "//foundation/arkui"
117ace_graphic = "//foundation/graphic/graphic_2d"
118
119if (!defined(aosp_libs_dir)) {
120  aosp_libs_dir = "//prebuilts/aosp_prebuilt_libs/asdk_libs"
121}
122libs_root = "${aosp_libs_dir}/sdk"
123
124ability_runtime_path = "//foundation/ability/ability_runtime"
125graphic_2d_path = "//foundation/graphic/graphic_2d"
126ark_ets_path = "//arkcompiler/ets_runtime"
127crossplatform_plugin_root = "//plugins"
128crossplatform_multimedia_root = "//foundation/multimedia"
129if (ace_engine_feature_enable_upgrade_skia) {
130  skia_root_new = "//third_party/skia/m133"
131} else {
132  skia_root_new = "//third_party/skia"
133}
134c_utils_header_path = "//commonlibrary/c_utils/base/include"
135ace_graphic_surface = "//foundation/graphic/graphic_surface"
136
137# arkui-x
138flutter_root = "//third_party/flutter"
139ace_flutter_engine_root = "$flutter_root/build"
140ark_toolchain_path = "//arkcompiler/toolchain"
141ace_drag = "//base/msdp/device_status"
142acd_input = "//foundation/multimodalinput/input"
143arkuix_graphic_surface = "//foundation/appframework/graphic_surface"
144
145# Config toolchain
146windows_buildtool = "//build/toolchain/mingw:mingw_x86_64"
147if (!defined(default_aosp_source_dir)) {
148  default_aosp_source_dir = "/"
149}
150objcopy_default = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/objcopy"
151objcopy_mingw = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin/objcopy"
152objcopy_x86_64 = "${default_clang_base_path}/bin/llvm-objcopy"
153if ("${current_os}_${current_cpu}" == "mac_arm64") {
154  mac_buildtool = "//build/toolchain/mac:clang_arm64"
155} else if ("${current_os}_${current_cpu}" == "mac_x64") {
156  mac_buildtool = "//build/toolchain/mac:clang_x64"
157}
158
159objcopy_clang = "$clang_base_path/bin/llvm-objcopy"
160
161if (is_ohos_standard_system) {
162  if (host_cpu == "arm64") {
163    objcopy_default =
164        "//prebuilts/clang/ohos/linux-aarch64/llvm/bin/llvm-objcopy"
165  } else {
166    objcopy_default =
167        "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy"
168  }
169} else if (is_arkui_x) {
170  if (host_os == "mac") {
171    objcopy_default = objcopy_clang
172  } else if (defined(aosp_objcopy)) {
173    objcopy_default = aosp_objcopy
174  }
175}
176
177# Config subsystem name
178ace_engine_subsystem = "arkui"
179
180# Config part name
181if (is_ohos_standard_system) {
182  ace_engine_part = "ace_engine"
183  hilog_deps = [ "hilog:libhilog" ]
184  ark_runtime_path = "//arkcompiler/runtime_core"
185} else {
186  if (is_arkui_x) {
187    ace_engine_part = "ace_engine_cross"
188  } else {
189    ace_engine_part = "ace_engine_full"
190  }
191  hilog_deps = [ "hilog:libhilog" ]
192  ark_runtime_path = "//arkcompiler/runtime_core"
193}
194
195# Config defines
196ace_wearable_defines = [ "WEARABLE_PRODUCT" ]
197ace_ivi_defines = [ "IVI_PRODUCT" ]
198
199ace_common_defines = [ "ACE_LOG_TAG=\"Ace\"" ]
200
201if (use_hilog) {
202  ace_common_defines += [ "USE_HILOG" ]
203}
204
205if (enable_glfw_window) {
206  ace_common_defines += [ "USE_GLFW_WINDOW" ]
207}
208
209if (use_clang_coverage) {
210  ace_common_defines += [ "USE_CLANG_COVERAGE" ]
211}
212
213if (enable_ace_debug) {
214  ace_common_defines += [ "ACE_DEBUG" ]
215}
216
217if (enable_ace_instance_log) {
218  ace_common_defines += [ "ACE_INSTANCE_LOG" ]
219}
220
221if (enable_dump_drawcmd) {
222  ace_common_defines += [ "DUMP_DRAW_CMD" ]
223}
224
225if (build_variant == "user") {
226  ace_common_defines += [ "IS_RELEASE_VERSION" ]
227}
228
229ace_use_new_skia = true
230
231ace_use_rosen_drawing = false
232if (defined(use_rosen_drawing) && use_rosen_drawing) {
233  ace_use_rosen_drawing = true
234  ace_common_defines += [ "USE_ROSEN_DRAWING" ]
235}
236
237if (!defined(global_parts_info) ||
238    defined(global_parts_info.account_os_account)) {
239  os_account_exists = true
240  ace_common_defines += [ "OS_ACCOUNT_EXISTS" ]
241} else {
242  os_account_exists = false
243}
244
245if (is_emulator) {
246  ace_common_defines += [ "IS_EMULATOR" ]
247}
248
249if (defined(global_parts_info)) {
250  if (defined(global_parts_info.resourceschedule_frame_aware_sched) ||
251      defined(
252          global_parts_info.hmosresourceschedule_frame_aware_sched_override)) {
253    frame_trace_support = true
254  } else {
255    frame_trace_support = false
256  }
257}
258
259if (defined(global_parts_info) &&
260  defined(global_parts_info.resourceschedule_ffrt) && current_os == "ohos") {
261  ffrt_support = true
262} else {
263  ffrt_support = false
264}
265
266if (defined(global_parts_info.multimedia_camera_framework)) {
267  enable_camera_framework = true
268  ace_common_defines += [ "CAMERA_FRAMEWORK_EXISTS" ]
269} else {
270  enable_camera_framework = false
271}
272
273if (defined(global_parts_info.multimedia_player_framework) || is_arkui_x) {
274  enable_player_framework = true
275  ace_common_defines += [ "PLAYER_FRAMEWORK_EXISTS" ]
276} else {
277  enable_player_framework = false
278}
279
280if (defined(global_parts_info.multimedia_audio_framework)) {
281  enable_audio_framework = true
282  ace_common_defines += [ "AUDIO_FRAMEWORK_EXISTS" ]
283} else {
284  enable_audio_framework = false
285}
286
287if (defined(global_parts_info.thirdparty_qrcodegen) || is_arkui_x) {
288  qrcodegen_support = true
289  ace_common_defines += [ "QRCODEGEN_SUPPORT" ]
290} else {
291  qrcodegen_support = false
292}
293
294if (!defined(global_parts_info) ||
295    defined(global_parts_info.security_security_component_manager)) {
296  security_component_enable = true
297  ace_common_defines += [ "SECURITY_COMPONENT_ENABLE" ]
298} else {
299  security_component_enable = false
300}
301
302if (!defined(global_parts_info) ||
303    defined(global_parts_info.ability_form_fwk)) {
304  form_fwk_enable = true
305} else {
306  form_fwk_enable = false
307}
308
309if (defined(global_parts_info) &&
310    defined(global_parts_info.hiviewdfx_hicollie)) {
311  uiservice_xcollie_enable = true
312} else {
313  uiservice_xcollie_enable = false
314}
315
316if (!defined(global_parts_info) ||
317    defined(global_parts_info.graphic_graphic_2d_ext)) {
318  if (ace_engine_feature_enable_aps) {
319    ace_common_defines += [ "APS_ENABLE" ]
320  }
321}
322
323if (ace_engine_feature_asbng_path == "") {
324  ace_engine_feature_asbng_path_enable = false
325} else {
326  ace_engine_feature_asbng_path_enable = true
327}
328
329ace_platforms = []
330
331_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir)
332_adapters = exec_script("build/search.py", [ _ace_adapter_dir ], "list lines")
333foreach(item, _adapters) {
334  import_var = {
335  }
336  import_var = {
337    import("$ace_root/adapter/$item/build/platform.gni")
338  }
339
340  if (defined(import_var.platforms)) {
341    foreach(platform, import_var.platforms) {
342      if (!is_arkui_x ||
343          (is_arkui_x && defined(platform.cross_platform_support) &&
344           platform.cross_platform_support)) {
345        if (defined(platform.name)) {
346          ace_platforms += [ platform ]
347        }
348      }
349    }
350  }
351}
352
353current_platform = {
354}
355foreach(item, ace_platforms) {
356  if ((use_mingw_win && item.name == "windows") ||
357      (use_mac && item.name == "mac") || (use_linux && item.name == "linux")) {
358    current_platform = item
359  }
360}
361
362if (ace_engine_feature_enable_split_mode) {
363  ace_common_defines += [ "ENABLE_SPLIT_MODE" ]
364}
365
366if (ace_engine_feature_enable_nav_split_mode) {
367  ace_common_defines += [ "ENABLE_NAV_SPLIT_MODE" ]
368}
369
370if (ace_engine_feature_wearable) {
371  ace_common_defines += [ "ARKUI_WEARABLE" ]
372}
373
374if (ohos_indep_compiler_enable) {
375  indep_compile_includes =
376      [ "//binarys/third_party/icu/innerapis/shared_icuuc/includes" ]
377}
378
379if (ace_engine_feature_enable_form_size_change_animation) {
380  ace_common_defines += [ "FORM_SIZE_CHANGE_ANIMATION" ]
381}
382
383# Enable ArkUI static instructive code
384ace_engine_feature_enable_static_instructive_code = false
385
386if (ace_engine_feature_enable_static_instructive_code) {
387  ace_common_defines += [ "ACE_STATIC" ]
388}
389