• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/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  # only available when 'enable_ace_debug' set to 'true', show the LOGD infos.
24  enable_ace_debug_log = true
25
26  # only available when 'enable_ace_debug' set to 'true', show the private logs.
27  enable_ace_private_log = true
28
29  # show the instance id in logs.
30  enable_ace_instance_log = true
31
32  # Disable glfw window to build for PC preview scenario.
33  enable_glfw_window = false
34
35  # Enable metal in iOS or MacOS
36  shell_enable_metal = false
37
38  # Enable pgo for building.
39  ace_engine_feature_enable_pgo = 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  # Enable test coverage
48  ace_engine_feature_enable_coverage = false
49
50  # Disable in OH Core
51  ace_engine_standard_fonts_enable = true
52
53  # Sanitize debug
54  ace_sanitize_debug = false
55
56  # Enable when build for text engine adapter
57  enable_graphic_text_gine = true
58}
59
60enable_dump_drawcmd = false
61is_ohos_standard_system = is_standard_system && !is_arkui_x
62use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64"
63use_mac = "${current_os}_${current_cpu}" == "mac_x64" ||
64          "${current_os}_${current_cpu}" == "mac_arm64"
65use_ios = "${current_os}_${current_cpu}" == "ios_x64" ||
66          "${current_os}_${current_cpu}" == "ios_arm64"
67use_linux = "${current_os}_${current_cpu}" == "linux_x64"
68
69# Config path
70ace_root = "//foundation/arkui/ace_engine"
71ace_napi_frameworks = "//foundation/arkui/ace_engine/frameworks"
72ace_napi = "//foundation/arkui/napi"
73ace_graphic = "//foundation/graphic/graphic_2d"
74ace_hitrace = "//base/hiviewdfx/hitrace"
75c_utils_root = "//commonlibrary/c_utils"
76
77if (!defined(aosp_libs_dir)) {
78  aosp_libs_dir = "//prebuilts/aosp_prebuilt_libs/asdk_libs"
79}
80libs_root = "${aosp_libs_dir}/sdk"
81
82ability_runtime_path = "//foundation/ability/ability_runtime"
83ability_runtime_inner_api_path = "${ability_runtime_path}/interfaces/inner_api"
84ability_runtime_inner_kits_path = "${ability_runtime_path}/interfaces/kits"
85ability_runtime_kits_path = "${ability_runtime_path}/frameworks/kits"
86ability_runtime_napi_path = "${ability_runtime_path}/frameworks/js/napi"
87ability_runtime_services_path = "${ability_runtime_path}/services"
88accessibility_path = "//foundation/barrierfree/accessibility"
89flutter_root = "//third_party/flutter"
90ace_flutter_engine_root = "$flutter_root/build"
91expat_root = "//third_party/expat"
92cjson_root = "//third_party/cJSON"
93jsoncpp_root = "//third_party/jsoncpp"
94ark_tools_root = "//prebuilts/ace-toolkit/ace-loader/panda"
95node_js_path = "//prebuilts/ace-toolkit/nodejs/current/bin/"
96ark_toolchain_path = "//arkcompiler/toolchain"
97window_manager_path = "//foundation/window/window_manager"
98graphic_2d_path = "//foundation/graphic/graphic_2d"
99ark_ets_path = "//arkcompiler/ets_runtime"
100crossplatform_plugin_root = "//plugins"
101crossplatform_multimedia_root = "//foundation/multimedia"
102skia_root_new = "//third_party/skia"
103
104# Config toolchain
105windows_buildtool = "//build/toolchain/mingw:mingw_x86_64"
106if (!defined(default_aosp_source_dir)) {
107  default_aosp_source_dir = "/"
108}
109objcopy_default = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/objcopy"
110objcopy_mingw = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin/objcopy"
111objcopy_x86_64 = "${default_clang_base_path}/bin/llvm-objcopy"
112if ("${current_os}_${current_cpu}" == "mac_arm64") {
113  mac_buildtool = "//build/toolchain/mac:clang_arm64"
114} else if ("${current_os}_${current_cpu}" == "mac_x64") {
115  mac_buildtool = "//build/toolchain/mac:clang_x64"
116}
117
118objcopy_clang = "$clang_base_path/bin/llvm-objcopy"
119
120if (is_ohos_standard_system) {
121  objcopy_default = "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy"
122  node_js_path = "//prebuilts/build-tools/common/nodejs/current/bin/"
123} else if (is_arkui_x) {
124  if (host_os == "mac") {
125    objcopy_default = objcopy_clang
126  } else if (defined(aosp_objcopy)) {
127    objcopy_default = aosp_objcopy
128  }
129}
130
131# Config subsystem name
132ace_engine_subsystem = "arkui"
133
134# Config part name
135if (is_ohos_standard_system) {
136  ace_engine_part = "ace_engine"
137  hilog_deps = [ "hilog:libhilog" ]
138  ark_runtime_path = "//arkcompiler/runtime_core"
139} else {
140  if (is_arkui_x) {
141    ace_engine_part = "ace_engine_cross"
142  } else {
143    ace_engine_part = "ace_engine_full"
144  }
145  hilog_deps = [ "hilog:libhilog" ]
146  ark_runtime_path = "//arkcompiler/runtime_core"
147}
148
149# Config defines
150ace_wearable_defines = [ "WEARABLE_PRODUCT" ]
151ace_ivi_defines = [ "IVI_PRODUCT" ]
152
153ace_common_defines = [ "ACE_LOG_TAG=\"Ace\"" ]
154
155if (enable_glfw_window) {
156  ace_common_defines += [ "USE_GLFW_WINDOW" ]
157}
158
159if (use_clang_coverage) {
160  ace_common_defines += [ "USE_CLANG_COVERAGE" ]
161}
162
163if (enable_ace_debug) {
164  ace_common_defines += [ "ACE_DEBUG" ]
165  if (enable_ace_debug_log) {
166    ace_common_defines += [ "ACE_DEBUG_LOG" ]
167  }
168  if (enable_ace_private_log) {
169    ace_common_defines += [ "ACE_PRIVATE_LOG" ]
170  }
171}
172
173if (enable_ace_instance_log) {
174  ace_common_defines += [ "ACE_INSTANCE_LOG" ]
175}
176
177if (enable_dump_drawcmd) {
178  ace_common_defines += [ "DUMP_DRAW_CMD" ]
179}
180
181ace_use_new_skia = true
182
183ace_use_rosen_drawing = false
184if (defined(use_rosen_drawing) && use_rosen_drawing) {
185  ace_use_rosen_drawing = true
186  ace_common_defines += [ "USE_ROSEN_DRAWING" ]
187}
188
189if (enable_graphic_text_gine) {
190  ace_common_defines += [ "USE_GRAPHIC_TEXT_GINE" ]
191}
192
193if (!defined(global_parts_info) ||
194    defined(global_parts_info.account_os_account)) {
195  os_account_exists = true
196  ace_common_defines += [ "OS_ACCOUNT_EXISTS" ]
197} else {
198  os_account_exists = false
199}
200
201if (is_emulator) {
202  ace_common_defines += [ "IS_EMULATOR" ]
203}
204
205if (defined(global_parts_info)) {
206  if (defined(global_parts_info.resourceschedule_frame_aware_sched) ||
207      defined(
208          global_parts_info.hmosresourceschedule_frame_aware_sched_override)) {
209    frame_trace_support = true
210  } else {
211    frame_trace_support = false
212  }
213}
214
215if (defined(global_parts_info.multimedia_camera_framework)) {
216  enable_camera_framework = true
217  ace_common_defines += [ "CAMERA_FRAMEWORK_EXISTS" ]
218} else {
219  enable_camera_framework = false
220}
221
222if (defined(global_parts_info.multimedia_player_framework) || is_arkui_x) {
223  enable_player_framework = true
224  ace_common_defines += [ "PLAYER_FRAMEWORK_EXISTS" ]
225} else {
226  enable_player_framework = false
227}
228
229if (!defined(global_parts_info) ||
230    defined(global_parts_info.security_security_component_manager)) {
231  security_component_enable = true
232  ace_common_defines += [ "SECURITY_COMPONENT_ENABLE" ]
233} else {
234  security_component_enable = false
235}
236
237if (defined(global_parts_info) &&
238    defined(global_parts_info.resourceschedule_ffrt)) {
239  ace_common_defines += [ "FFRT_EXISTS" ]
240  resourceschedule_ffrt_support = true
241} else {
242  resourceschedule_ffrt_support = false
243}
244
245ace_platforms = []
246
247_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir)
248_adapters = exec_script("build/search.py", [ _ace_adapter_dir ], "list lines")
249foreach(item, _adapters) {
250  import_var = {
251  }
252  import_var = {
253    import("$ace_root/adapter/$item/build/platform.gni")
254  }
255
256  if (defined(import_var.platforms)) {
257    foreach(platform, import_var.platforms) {
258      if (!is_arkui_x ||
259          (is_arkui_x && defined(platform.cross_platform_support) &&
260           platform.cross_platform_support)) {
261        if (defined(platform.name)) {
262          ace_platforms += [ platform ]
263        }
264      }
265    }
266  }
267}
268
269current_platform = {
270}
271foreach(item, ace_platforms) {
272  if ((use_mingw_win && item.name == "windows") ||
273      (use_mac && item.name == "mac") || (use_linux && item.name == "linux")) {
274    current_platform = item
275  }
276}
277