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