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