2022-08-17 09:00:15 +00:00
|
|
|
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
2021-09-04 08:06:49 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-06-20 09:59:16 +00:00
|
|
|
if (!defined(ark_standalone_build)) {
|
2022-10-24 15:31:14 +00:00
|
|
|
ark_standalone_build = false
|
|
|
|
}
|
|
|
|
|
2023-02-10 07:38:16 +00:00
|
|
|
declare_args() {
|
|
|
|
# If true, use icu to implement Intl APIs.
|
|
|
|
# If false, use @ohos.intl APIs to implement Intl APIs.
|
|
|
|
enable_ark_intl = true
|
2023-10-24 09:29:58 +00:00
|
|
|
run_regress_test = false
|
2023-11-07 08:53:04 +00:00
|
|
|
|
2023-12-14 08:10:15 +00:00
|
|
|
# If true, enable fuzz option. Default false.
|
|
|
|
enable_fuzz_option = false
|
|
|
|
|
2024-05-08 07:41:38 +00:00
|
|
|
# Enable pgo for building.
|
2024-05-27 03:13:19 +00:00
|
|
|
ets_runtime_feature_enable_pgo = false
|
2024-05-08 07:41:38 +00:00
|
|
|
|
|
|
|
# Set pgo profdata path.
|
2024-05-27 03:13:19 +00:00
|
|
|
ets_runtime_feature_pgo_path = ""
|
2024-05-08 07:41:38 +00:00
|
|
|
|
2024-05-31 14:53:03 +00:00
|
|
|
# Defaults for fort
|
|
|
|
enable_jit_fort = false
|
|
|
|
enable_jit_code_sign = false
|
|
|
|
disable_fort_switch = false
|
|
|
|
enable_fort_global = false
|
|
|
|
|
2023-11-07 08:53:04 +00:00
|
|
|
TARGET = "x86_64"
|
|
|
|
HOST_ARCH = 64
|
2024-05-30 03:26:49 +00:00
|
|
|
|
|
|
|
# If true app_aot_disable_list, app_aot_disable_list, app_jit_enable_list will be placed in /etc/ark
|
|
|
|
# Default false.
|
|
|
|
js_runtime_feature_enable_list = false
|
2023-11-07 08:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (target_cpu == "arm64") {
|
|
|
|
TARGET = "aarch64"
|
2023-02-10 07:38:16 +00:00
|
|
|
}
|
2023-11-10 03:17:56 +00:00
|
|
|
MAPLEALL_ROOT = "//arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple"
|
2023-11-07 08:53:04 +00:00
|
|
|
MAPLEALL_THIRD_PARTY_ROOT = "//third_party"
|
2023-02-10 07:38:16 +00:00
|
|
|
|
2022-10-24 15:31:14 +00:00
|
|
|
if (!ark_standalone_build) {
|
|
|
|
build_root = "//build"
|
|
|
|
ark_third_party_root = "//third_party"
|
|
|
|
import("$build_root/ohos.gni")
|
2022-05-12 13:57:08 +00:00
|
|
|
} else {
|
2022-10-24 15:31:14 +00:00
|
|
|
ark_third_party_root = "//arkcompiler/toolchain/build/third_party_gn"
|
2022-08-04 07:37:10 +00:00
|
|
|
import("$build_root/ark.gni")
|
2022-05-12 13:57:08 +00:00
|
|
|
}
|
2022-10-24 15:31:14 +00:00
|
|
|
ark_root = "//arkcompiler/runtime_core"
|
|
|
|
js_root = "//arkcompiler/ets_runtime"
|
2023-02-10 07:38:16 +00:00
|
|
|
global_root = "//base/global/i18n"
|
2023-03-02 02:49:38 +00:00
|
|
|
hilog_root = "//base/hiviewdfx/hilog/interfaces/native/innerkits"
|
2023-10-12 09:01:58 +00:00
|
|
|
qos_root = "//foundation/resourceschedule/qos_manager"
|
2024-05-31 14:53:03 +00:00
|
|
|
code_sign_root = "//base/security/code_signature/interfaces/innerkits"
|
2021-09-11 03:05:55 +00:00
|
|
|
compile_llvm_online = false
|
2021-10-12 03:50:58 +00:00
|
|
|
run_with_asan = false
|
2023-12-14 08:10:15 +00:00
|
|
|
if (enable_fuzz_option) {
|
|
|
|
run_with_asan = true
|
|
|
|
}
|
2022-08-27 02:03:37 +00:00
|
|
|
enable_leak_check = false
|
2022-10-26 02:39:13 +00:00
|
|
|
enable_cow_array = true
|
2022-10-31 12:31:21 +00:00
|
|
|
enable_coverage = false
|
2022-12-02 03:41:58 +00:00
|
|
|
enable_asm_assert = false
|
2023-02-15 09:17:18 +00:00
|
|
|
ark_compile_mode = "debug"
|
2023-11-03 08:50:37 +00:00
|
|
|
if (defined(is_arkui_x) && is_arkui_x && defined(runtime_mode) &&
|
2023-10-12 09:10:22 +00:00
|
|
|
runtime_mode == "release") {
|
|
|
|
ark_compile_mode = "release"
|
2023-06-14 06:15:02 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 03:50:58 +00:00
|
|
|
asan_lib_path = "/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux"
|
2023-05-29 08:50:41 +00:00
|
|
|
|
|
|
|
# under /system/lib64 dir
|
|
|
|
arkcompiler_relative_lib_path = "module/arkcompiler"
|
2022-12-14 10:12:25 +00:00
|
|
|
if (is_standard_system || ark_standalone_build) {
|
2022-08-04 07:37:10 +00:00
|
|
|
icu_part_name = "icu"
|
|
|
|
icu_subsystem_name = "thirdparty"
|
|
|
|
} else {
|
|
|
|
icu_part_name = "i18n"
|
|
|
|
icu_subsystem_name = "global"
|
|
|
|
}
|
2021-09-04 08:06:49 +00:00
|
|
|
|
2023-11-03 08:50:37 +00:00
|
|
|
if (defined(is_arkui_x) && is_arkui_x && target_os == "ios") {
|
2023-02-22 07:17:34 +00:00
|
|
|
sdk_libc_secshared_dep =
|
|
|
|
"$ark_third_party_root/bounds_checking_function:libsec_static"
|
|
|
|
} else {
|
|
|
|
sdk_libc_secshared_dep =
|
|
|
|
"$ark_third_party_root/bounds_checking_function:libsec_shared"
|
|
|
|
}
|
2022-03-09 02:42:44 +00:00
|
|
|
sdk_libc_secshared_config =
|
2022-10-24 15:31:14 +00:00
|
|
|
"$ark_third_party_root/bounds_checking_function:libsec_public_config"
|
2021-10-12 03:50:58 +00:00
|
|
|
|
2023-03-18 11:29:35 +00:00
|
|
|
# ohos device, windows previewer, mac previewer
|
2023-11-03 08:50:37 +00:00
|
|
|
enable_hilog = !ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) &&
|
2023-03-18 11:29:35 +00:00
|
|
|
(is_ohos || is_mingw || is_mac)
|
2024-03-27 08:57:09 +00:00
|
|
|
enable_hisysevent =
|
|
|
|
!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos &&
|
|
|
|
is_standard_system
|
2023-11-03 08:50:37 +00:00
|
|
|
enable_dump_in_faultlog =
|
|
|
|
!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos &&
|
|
|
|
is_standard_system
|
|
|
|
enable_bytrace =
|
|
|
|
!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos &&
|
|
|
|
is_standard_system
|
|
|
|
enable_hitrace =
|
|
|
|
!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos &&
|
|
|
|
is_standard_system
|
2021-10-12 03:50:58 +00:00
|
|
|
|
2023-03-18 11:29:35 +00:00
|
|
|
hiviewdfx_deps = []
|
|
|
|
hiviewdfx_ext_deps = []
|
|
|
|
if (enable_dump_in_faultlog) {
|
2023-11-27 03:23:57 +00:00
|
|
|
hiviewdfx_ext_deps += [
|
|
|
|
"faultloggerd:libfaultloggerd",
|
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
2023-03-18 11:29:35 +00:00
|
|
|
}
|
|
|
|
if (enable_bytrace) {
|
2023-06-20 06:18:16 +00:00
|
|
|
hiviewdfx_ext_deps += [ "hitrace:hitrace_meter" ]
|
2023-03-18 11:29:35 +00:00
|
|
|
}
|
|
|
|
if (enable_hitrace) {
|
2023-06-20 06:18:16 +00:00
|
|
|
hiviewdfx_ext_deps += [ "hitrace:libhitracechain" ]
|
2023-03-18 11:29:35 +00:00
|
|
|
}
|
|
|
|
if (enable_hilog) {
|
2024-02-06 07:55:27 +00:00
|
|
|
hiviewdfx_ext_deps += [ "hilog:libhilog" ]
|
2021-10-12 03:50:58 +00:00
|
|
|
}
|
2024-03-27 08:57:09 +00:00
|
|
|
if (enable_hisysevent) {
|
|
|
|
hiviewdfx_ext_deps += [ "hisysevent:libhisysevent" ]
|
|
|
|
}
|
2023-05-31 09:59:11 +00:00
|
|
|
|
2023-11-03 08:50:37 +00:00
|
|
|
enable_target_compilation =
|
|
|
|
!ark_standalone_build && !is_mac && !(defined(is_arkui_x) && is_arkui_x) &&
|
|
|
|
current_cpu == "arm64"
|
2023-05-29 14:13:40 +00:00
|
|
|
|
|
|
|
have_local_code_sign = false
|
|
|
|
if (defined(global_parts_info) &&
|
|
|
|
defined(global_parts_info.security_code_signature) &&
|
|
|
|
global_parts_info.security_code_signature) {
|
|
|
|
have_local_code_sign = true
|
|
|
|
}
|
|
|
|
enable_local_code_sign = false
|
|
|
|
if (have_local_code_sign && enable_target_compilation) {
|
|
|
|
enable_local_code_sign = true
|
|
|
|
}
|
2024-05-31 14:53:03 +00:00
|
|
|
if (!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos &&
|
|
|
|
enable_fort_global && is_standard_system && target_cpu == "arm64" &&
|
|
|
|
!is_emulator && defined(global_parts_info) &&
|
|
|
|
defined(global_parts_info.security_code_signature)) {
|
|
|
|
enable_jit_code_sign = true
|
|
|
|
enable_jit_fort = true
|
|
|
|
}
|
2023-09-19 07:38:21 +00:00
|
|
|
|
2023-09-22 05:32:32 +00:00
|
|
|
ets_runtime_output_path = "ets_runtime/ets_runtime"
|
2024-02-06 07:55:27 +00:00
|
|
|
|
|
|
|
template("libark_jsruntime_common_set") {
|
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
|
|
|
|
ohos_source_set(target_name) {
|
2024-05-06 08:03:35 +00:00
|
|
|
if (target_name == "libark_jsruntime_arm_set" && is_ohos &&
|
2024-05-06 14:59:11 +00:00
|
|
|
is_standard_system && !is_arkui_x && target_cpu == "arm64") {
|
2024-05-06 08:03:35 +00:00
|
|
|
include_dirs = [
|
|
|
|
"$js_root",
|
|
|
|
"$js_root/ecmascript/napi/include",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2024-03-14 01:20:39 +00:00
|
|
|
stack_protector_ret = false
|
|
|
|
|
2024-02-06 07:55:27 +00:00
|
|
|
if (is_ohos && is_standard_system) {
|
|
|
|
stub_an_file_path =
|
|
|
|
"/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
|
|
|
|
} else {
|
|
|
|
stub_an_file_path =
|
|
|
|
rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
|
|
|
|
}
|
|
|
|
defines = [ "STUB_AN_FILE=\"${stub_an_file_path}\"" ]
|
|
|
|
|
|
|
|
if (current_cpu == "arm64") {
|
|
|
|
defines += [ "ENABLE_POSTFORK_FORCEEXPAND" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
sources = invoker.ecma_source
|
|
|
|
sources += invoker.ecma_profiler_source
|
|
|
|
sources += invoker.ecma_debugger_source
|
|
|
|
sources += invoker.hitrace_scope_source
|
|
|
|
sources += invoker.ecma_platform_source
|
|
|
|
|
|
|
|
if (is_ohos) {
|
|
|
|
sources += invoker.ecma_stackinfo_source
|
|
|
|
}
|
|
|
|
|
|
|
|
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
|
|
|
|
public_configs += [ ":include_llvm" ]
|
|
|
|
|
|
|
|
configs = [
|
|
|
|
"$js_root:ark_jsruntime_common_config",
|
|
|
|
"$js_root:asm_interp_enable_config",
|
|
|
|
]
|
|
|
|
|
|
|
|
cflags_cc = []
|
|
|
|
if (is_standard_system || target_os == "android" || target_os == "ios") {
|
|
|
|
cflags_cc += [ "-fvisibility=hidden" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
external_deps = []
|
|
|
|
|
|
|
|
if (enable_dump_in_faultlog) {
|
|
|
|
external_deps += [ "libuv:uv" ]
|
|
|
|
}
|
|
|
|
|
2024-05-06 08:03:35 +00:00
|
|
|
if (target_name == "libark_jsruntime_arm_set" && is_ohos &&
|
2024-05-10 09:01:32 +00:00
|
|
|
is_standard_system && !is_arkui_x) {
|
2024-05-09 07:35:16 +00:00
|
|
|
defines += [ "ENABLE_FFRT_INTERFACES" ]
|
2024-05-06 08:03:35 +00:00
|
|
|
external_deps += [
|
|
|
|
"ffrt:libffrt",
|
|
|
|
"hilog:libhilog",
|
|
|
|
]
|
|
|
|
}
|
2024-02-06 07:55:27 +00:00
|
|
|
deps = []
|
|
|
|
if (!is_arkui_x) {
|
|
|
|
external_deps += [ "runtime_core:arkfile_header_deps" ]
|
|
|
|
} else {
|
|
|
|
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_ohos && is_standard_system && !is_arkui_x &&
|
2024-02-28 09:14:38 +00:00
|
|
|
defined(global_parts_info) &&
|
|
|
|
defined(global_parts_info.resourceschedule_qos_manager)) {
|
2024-02-06 07:55:27 +00:00
|
|
|
defines += [ "ENABLE_QOS" ]
|
|
|
|
external_deps += [ "qos_manager:qos" ]
|
|
|
|
}
|
|
|
|
|
2024-04-16 06:31:34 +00:00
|
|
|
if (!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) &&
|
|
|
|
is_ohos && is_standard_system) {
|
|
|
|
external_deps += [ "init:libbegetutil" ]
|
2024-04-19 04:17:42 +00:00
|
|
|
defines += [
|
2024-04-22 07:38:21 +00:00
|
|
|
"GET_PARAMETER_FOR_JIT",
|
2024-04-19 04:17:42 +00:00
|
|
|
"JIT_ESCAPE_ENABLE",
|
2024-05-16 12:07:53 +00:00
|
|
|
"AOT_ESCAPE_ENABLE",
|
2024-05-12 11:02:47 +00:00
|
|
|
"OHOS_GET_PARAMETER",
|
2024-04-19 04:17:42 +00:00
|
|
|
]
|
2024-04-16 06:31:34 +00:00
|
|
|
}
|
|
|
|
|
2024-04-26 07:20:40 +00:00
|
|
|
if (ark_standalone_build) {
|
|
|
|
defines += [ "STANDALONE_MODE" ]
|
|
|
|
}
|
|
|
|
|
2024-05-31 14:53:03 +00:00
|
|
|
include_dirs = []
|
|
|
|
if (enable_jit_code_sign) {
|
|
|
|
defines += [ "CODE_SIGN_ENABLE" ]
|
|
|
|
if (disable_fort_switch) {
|
|
|
|
defines += [ "JIT_FORT_DISABLE" ]
|
|
|
|
}
|
|
|
|
include_dirs += [
|
|
|
|
"$code_sign_root/common/include",
|
|
|
|
"$code_sign_root/jit_code_sign/include",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2024-02-06 07:55:27 +00:00
|
|
|
if (enable_target_compilation) {
|
|
|
|
external_deps += [ "c_utils:utils" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# hiviewdfx libraries
|
|
|
|
external_deps += hiviewdfx_ext_deps
|
|
|
|
deps += hiviewdfx_deps
|
|
|
|
|
|
|
|
if (ark_standalone_build || is_arkui_x) {
|
2024-02-07 04:01:14 +00:00
|
|
|
deps += [ "$ark_third_party_root/zlib:libz" ]
|
2024-02-06 07:55:27 +00:00
|
|
|
} else {
|
|
|
|
external_deps += [ "zlib:shared_libz" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
part_name = "ets_runtime"
|
|
|
|
subsystem_name = "arkcompiler"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template("libark_jsruntime_intl_common_set") {
|
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
|
|
|
|
ohos_source_set(target_name) {
|
2024-03-14 01:20:39 +00:00
|
|
|
stack_protector_ret = false
|
2024-02-06 07:55:27 +00:00
|
|
|
sources = invoker.intl_sources
|
|
|
|
|
|
|
|
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
|
|
|
|
|
|
|
|
configs = [ "$js_root:ark_jsruntime_common_config" ]
|
|
|
|
|
|
|
|
cflags_cc = []
|
|
|
|
if (is_standard_system || target_os == "android" || target_os == "ios") {
|
|
|
|
cflags_cc += [ "-fvisibility=hidden" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
external_deps = []
|
|
|
|
deps = []
|
|
|
|
if (!is_arkui_x) {
|
|
|
|
external_deps += [ "runtime_core:arkfile_header_deps" ]
|
|
|
|
} else {
|
|
|
|
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
# hiviewdfx libraries
|
|
|
|
external_deps += hiviewdfx_ext_deps
|
|
|
|
deps += hiviewdfx_deps
|
|
|
|
|
|
|
|
part_name = "ets_runtime"
|
|
|
|
subsystem_name = "arkcompiler"
|
|
|
|
}
|
|
|
|
}
|