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