arkcompiler_toolchain/BUILD.gn
liu-zelin 680e411d1e fix build error
Signed-off-by: liu-zelin <liuzelin8@huawei.com>
Change-Id: Ib659897075cfb99151544243073b22ea706c3e01
2023-10-24 12:36:08 +08:00

238 lines
5.2 KiB
Plaintext

# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# 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.
import("//arkcompiler/toolchain/toolchain.gni")
config("hiviewdfx_config") {
defines = []
if (enable_dump_in_faultlog) {
defines += [ "ENABLE_DUMP_IN_FAULTLOG" ]
}
if (enable_bytrace) {
defines += [ "ENABLE_BYTRACE" ]
cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ]
}
if (enable_hitrace) {
defines += [ "ENABLE_HITRACE" ]
}
if (enable_hilog) {
defines += [ "ENABLE_HILOG" ]
}
include_dirs = [ "$hilog_root/include" ]
}
config("ark_platform_config") {
configs = [ ":hiviewdfx_config" ]
defines = []
if (is_ohos) {
defines += [
"OHOS_PLATFORM",
"UNIX_PLATFORM",
]
} else if (is_linux) {
defines += [
"LINUX_PLATFORM",
"UNIX_PLATFORM",
]
} else if (is_mingw) {
defines += [ "WINDOWS_PLATFORM" ]
} else if (target_os == "android") {
if (!ark_standalone_build) {
defines += [
"ANDROID_PLATFORM",
"UNIX_PLATFORM",
]
} else {
defines += [ "UNIX_PLATFORM" ]
}
} else if (target_os == "ios") {
defines += [
"UNIX_PLATFORM",
"IOS_PLATFORM",
]
} else if (is_mac) {
defines += [
"MAC_PLATFORM",
"UNIX_PLATFORM",
]
} else {
defines += [ "UNIX_PLATFORM" ]
}
}
config("ark_toolchain_common_config") {
configs = [
":ark_platform_config",
":ark_toolchain_public_config",
":hiviewdfx_config",
]
defines = [ "PANDA_ENABLE_LTO" ]
cflags_cc = [
"-Wall",
"-Wshadow",
"-Werror",
"-Wextra",
"-pedantic",
"-Wno-invalid-offsetof",
"-Wno-gnu-statement-expression",
"-pipe",
"-Wdate-time",
"-funwind-tables",
"-fasynchronous-unwind-tables",
"-Wformat=2",
]
if (is_linux) {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_TARGET_LINUX",
"PANDA_USE_FUTEX",
]
} else if (is_mingw) {
cflags_cc += [
"-std=c++17",
"-Wno-ignored-attributes",
]
defines += [
"PANDA_TARGET_WINDOWS",
"_CRTBLD",
"__LIBMSVCRT__",
]
} else if (is_mac) {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_TARGET_MACOS",
]
} else if (target_os == "android") {
defines += [
"PANDA_TARGET_ANDROID",
"PANDA_TARGET_UNIX",
"PANDA_USE_FUTEX",
]
if (!ark_standalone_build) {
defines += [ "ENABLE_ANLOG" ]
}
} else if (target_os == "ios") {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_TARGET_IOS",
]
} else {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_USE_FUTEX",
]
if (!is_standard_system && (current_cpu != "arm" || is_wearable_product)) {
defines += [ "PANDA_TARGET_MOBILE" ]
}
}
if (is_debug) {
cflags_cc += [
"-O0",
"-ggdb3",
]
} else {
defines += [ "NDEBUG" ]
}
}
config("ark_toolchain_public_config") {
defines = []
# debug is not compatible with ios for now
if (!is_mingw && !is_mac && target_os != "ios") {
defines += [
"ECMASCRIPT_SUPPORT_CPUPROFILER",
"ECMASCRIPT_SUPPORT_HEAPPROFILER",
"ECMASCRIPT_SUPPORT_HEAPSAMPLING",
"ECMASCRIPT_SUPPORT_SNAPSHOT",
"ECMASCRIPT_SUPPORT_DEBUGGER",
]
} else if (target_os == "android") {
defines += [
"ECMASCRIPT_SUPPORT_CPUPROFILER",
"ECMASCRIPT_SUPPORT_DEBUGGER",
]
}
include_dirs = [
# Dependent on runtime_core include
"$ark_root",
"$js_root",
".",
]
}
# ecmascript unit testcase config
config("toolchain_test_config") {
visibility = [
"./test/fuzztest/*",
"./tooling/test/*",
"./websocket/test/*",
]
configs = [ ":ark_toolchain_common_config" ]
ldflags = [ "-Wl,-rpath=\$ORIGIN/" ]
}
group("ark_toolchain_packages") {
deps = []
if (host_os != "mac") {
deps += [
"./inspector:ark_debugger",
"./inspector:connectserver_debugger",
"./tooling:libark_ecma_debugger",
"./tooling/client:libark_client",
"./tooling/client/ark_cli:arkdb",
]
}
}
group("ark_toolchain_unittest") {
testonly = true
deps = []
if (host_os != "mac") {
deps += [
"//arkcompiler/toolchain/tooling/test:unittest",
"//arkcompiler/toolchain/websocket/test:unittest",
]
if (is_ohos && is_standard_system) {
deps += [ "//arkcompiler/toolchain/test/fuzztest:fuzztest" ]
}
}
}
group("ark_toolchain_host_unittest") {
testonly = true
deps = []
if (host_os != "mac") {
# js unittest
deps += [
"//arkcompiler/toolchain/tooling/test:host_unittest",
"//arkcompiler/toolchain/websocket/test:host_unittest",
]
}
}
group("ark_js_host_unittest") {
testonly = true
deps = [
"//arkcompiler/ets_runtime:ark_runtime_host_unittest",
"//arkcompiler/toolchain:ark_toolchain_host_unittest",
]
}