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 build for new ng pipeline, also will use new flutter 30 enable_ng_build = false 31 32 # Enable metal in iOS or MacOS 33 shell_enable_metal = false 34 35 # Enable pgo for building. 36 ace_engine_feature_enable_pgo = false 37 38 # Set pgo profdata path 39 ace_engine_feature_pgo_path = "" 40 41 # Enable atomic for building. 42 ace_engine_feature_enable_atomic = false 43 44 # Set Instruction Sched Model 45 ace_engine_feature_sched_model = "" 46 47 # Enable test coverage 48 ace_engine_feature_enable_coverage = false 49 50 # Enalbe point light 51 ace_engine_feature_enable_point_light = true 52 53 # Set atomicservice basic engine so path 54 ace_engine_feature_asbng_path = "" 55 56 # Disable in OH Core 57 ace_engine_standard_fonts_enable = true 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 75enable_dump_drawcmd = false 76is_ohos_standard_system = is_standard_system && !is_arkui_x 77use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64" 78use_mac = "${current_os}_${current_cpu}" == "mac_x64" || 79 "${current_os}_${current_cpu}" == "mac_arm64" 80use_ios = "${current_os}_${current_cpu}" == "ios_x64" || 81 "${current_os}_${current_cpu}" == "ios_arm64" 82use_linux = "${current_os}_${current_cpu}" == "linux_x64" 83 84use_hilog = is_mingw || is_mac || is_linux || is_ohos || is_ohos_standard_system 85 86# Config path 87ace_root = "//foundation/arkui/ace_engine" 88hilog_root = "//base/hiviewdfx/hilog" 89ace_napi_frameworks = "//foundation/arkui/ace_engine/frameworks" 90ace_napi = "//foundation/arkui/napi" 91arkui_root = "//foundation/arkui" 92ace_graphic = "//foundation/graphic/graphic_2d" 93 94if (!defined(aosp_libs_dir)) { 95 aosp_libs_dir = "//prebuilts/aosp_prebuilt_libs/asdk_libs" 96} 97libs_root = "${aosp_libs_dir}/sdk" 98 99ability_runtime_path = "//foundation/ability/ability_runtime" 100ability_runtime_napi_path = "${ability_runtime_path}/frameworks/js/napi" 101graphic_2d_path = "//foundation/graphic/graphic_2d" 102ark_ets_path = "//arkcompiler/ets_runtime" 103crossplatform_plugin_root = "//plugins" 104crossplatform_multimedia_root = "//foundation/multimedia" 105skia_root_new = "//third_party/skia" 106 107# arkui-x 108flutter_root = "//third_party/flutter" 109ace_flutter_engine_root = "$flutter_root/build" 110ark_toolchain_path = "//arkcompiler/toolchain" 111 112# Config toolchain 113windows_buildtool = "//build/toolchain/mingw:mingw_x86_64" 114if (!defined(default_aosp_source_dir)) { 115 default_aosp_source_dir = "/" 116} 117objcopy_default = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin/objcopy" 118objcopy_mingw = "${default_aosp_source_dir}/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin/objcopy" 119objcopy_x86_64 = "${default_clang_base_path}/bin/llvm-objcopy" 120if ("${current_os}_${current_cpu}" == "mac_arm64") { 121 mac_buildtool = "//build/toolchain/mac:clang_arm64" 122} else if ("${current_os}_${current_cpu}" == "mac_x64") { 123 mac_buildtool = "//build/toolchain/mac:clang_x64" 124} 125 126objcopy_clang = "$clang_base_path/bin/llvm-objcopy" 127 128if (is_ohos_standard_system) { 129 objcopy_default = "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy" 130} else if (is_arkui_x) { 131 if (host_os == "mac") { 132 objcopy_default = objcopy_clang 133 } else if (defined(aosp_objcopy)) { 134 objcopy_default = aosp_objcopy 135 } 136} 137 138# Config subsystem name 139ace_engine_subsystem = "arkui" 140 141# Config part name 142if (is_ohos_standard_system) { 143 ace_engine_part = "ace_engine" 144 hilog_deps = [ "hilog:libhilog" ] 145 ark_runtime_path = "//arkcompiler/runtime_core" 146} else { 147 if (is_arkui_x) { 148 ace_engine_part = "ace_engine_cross" 149 } else { 150 ace_engine_part = "ace_engine_full" 151 } 152 hilog_deps = [ "hilog:libhilog" ] 153 ark_runtime_path = "//arkcompiler/runtime_core" 154} 155 156# Config defines 157ace_wearable_defines = [ "WEARABLE_PRODUCT" ] 158ace_ivi_defines = [ "IVI_PRODUCT" ] 159 160ace_common_defines = [ "ACE_LOG_TAG=\"Ace\"" ] 161 162if (use_hilog) { 163 ace_common_defines += [ "USE_HILOG" ] 164} 165 166if (enable_glfw_window) { 167 ace_common_defines += [ "USE_GLFW_WINDOW" ] 168} 169 170if (use_clang_coverage) { 171 ace_common_defines += [ "USE_CLANG_COVERAGE" ] 172} 173 174if (enable_ace_debug) { 175 ace_common_defines += [ "ACE_DEBUG" ] 176} 177 178if (enable_ace_instance_log) { 179 ace_common_defines += [ "ACE_INSTANCE_LOG" ] 180} 181 182if (enable_dump_drawcmd) { 183 ace_common_defines += [ "DUMP_DRAW_CMD" ] 184} 185 186if (build_variant == "user") { 187 ace_common_defines += [ "IS_RELEASE_VERSION" ] 188} 189 190ace_use_new_skia = true 191 192ace_use_rosen_drawing = false 193if (defined(use_rosen_drawing) && use_rosen_drawing) { 194 ace_use_rosen_drawing = true 195 ace_common_defines += [ "USE_ROSEN_DRAWING" ] 196} 197 198if (enable_graphic_text_gine) { 199 ace_common_defines += [ "USE_GRAPHIC_TEXT_GINE" ] 200} 201 202if (enable_ng_build) { 203 ace_common_defines += [ "NG_BUILD" ] 204} 205 206if (!defined(global_parts_info) || 207 defined(global_parts_info.account_os_account)) { 208 os_account_exists = true 209 ace_common_defines += [ "OS_ACCOUNT_EXISTS" ] 210} else { 211 os_account_exists = false 212} 213 214if (is_emulator) { 215 ace_common_defines += [ "IS_EMULATOR" ] 216} 217 218if (defined(global_parts_info)) { 219 if (defined(global_parts_info.resourceschedule_frame_aware_sched) || 220 defined( 221 global_parts_info.hmosresourceschedule_frame_aware_sched_override)) { 222 frame_trace_support = true 223 } else { 224 frame_trace_support = false 225 } 226} 227 228if (defined(global_parts_info.multimedia_camera_framework)) { 229 enable_camera_framework = true 230 ace_common_defines += [ "CAMERA_FRAMEWORK_EXISTS" ] 231} else { 232 enable_camera_framework = false 233} 234 235if (defined(global_parts_info.multimedia_player_framework) || is_arkui_x) { 236 enable_player_framework = true 237 ace_common_defines += [ "PLAYER_FRAMEWORK_EXISTS" ] 238} else { 239 enable_player_framework = false 240} 241 242if (defined(global_parts_info.multimedia_audio_framework)) { 243 enable_audio_framework = true 244 ace_common_defines += [ "AUDIO_FRAMEWORK_EXISTS" ] 245} else { 246 enable_audio_framework = false 247} 248 249if (!defined(global_parts_info) || 250 defined(global_parts_info.security_security_component_manager)) { 251 security_component_enable = true 252 ace_common_defines += [ "SECURITY_COMPONENT_ENABLE" ] 253} else { 254 security_component_enable = false 255} 256 257if (defined(global_parts_info) && 258 defined(global_parts_info.resourceschedule_ffrt)) { 259 ace_common_defines += [ "FFRT_EXISTS" ] 260 resourceschedule_ffrt_support = true 261} else { 262 resourceschedule_ffrt_support = false 263} 264 265if (!defined(global_parts_info) || 266 defined(global_parts_info.ability_form_fwk)) { 267 form_fwk_enable = true 268} else { 269 form_fwk_enable = false 270} 271 272if (defined(global_parts_info) && 273 defined(global_parts_info.hiviewdfx_hicollie)) { 274 uiservice_xcollie_enable = true 275} else { 276 uiservice_xcollie_enable = false 277} 278 279if (!defined(global_parts_info) || 280 defined(global_parts_info.graphic_graphic_2d_ext)) { 281 if (ace_engine_feature_enable_aps) { 282 ace_common_defines += [ "APS_ENABLE" ] 283 } 284} 285 286if (ace_engine_feature_asbng_path == "") { 287 ace_engine_feature_asbng_path_enable = false 288} else { 289 ace_engine_feature_asbng_path_enable = true 290} 291 292ace_platforms = [] 293 294_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir) 295_adapters = exec_script("build/search.py", [ _ace_adapter_dir ], "list lines") 296foreach(item, _adapters) { 297 import_var = { 298 } 299 import_var = { 300 import("$ace_root/adapter/$item/build/platform.gni") 301 } 302 303 if (defined(import_var.platforms)) { 304 foreach(platform, import_var.platforms) { 305 if (!is_arkui_x || 306 (is_arkui_x && defined(platform.cross_platform_support) && 307 platform.cross_platform_support)) { 308 if (defined(platform.name)) { 309 ace_platforms += [ platform ] 310 } 311 } 312 } 313 } 314} 315 316current_platform = { 317} 318foreach(item, ace_platforms) { 319 if ((use_mingw_win && item.name == "windows") || 320 (use_mac && item.name == "mac") || (use_linux && item.name == "linux")) { 321 current_platform = item 322 } 323} 324 325if (ace_engine_feature_enable_split_mode) { 326 ace_common_defines += [ "ENABLE_SPLIT_MODE" ] 327} 328 329if (ace_engine_feature_enable_nav_split_mode) { 330 ace_common_defines += [ "ENABLE_NAV_SPLIT_MODE" ] 331} 332