arkcompiler_runtime_core/libpandabase/BUILD.gn
luobinghao 70d81f0016 Disable add filesystem source file when target is arkui_x
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IA5GQM?from=project-issue

Signed-off-by: luobinghao <luobinghao@huawei.com>
Change-Id: I832e9ae505be513e002b14b7e3194aa554f392aa
2024-06-14 14:51:31 +08:00

282 lines
8.6 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/runtime_core/ark_config.gni")
config("arkbase_public_config") {
include_dirs = [
"$ark_root",
"$ark_root/libpandabase",
"$target_gen_dir/include",
"$target_gen_dir",
]
if (enable_hilog) {
include_dirs += [ "$hilog_root/include" ]
}
include_dirs += platform_include_dirs
}
config("arkbase_fuzz_config") {
configs = [ "$build_root/config/compiler:exceptions" ]
defines = [ "SUPPORT_KNOWN_EXCEPTION" ]
}
ark_gen_file("events_gen") {
template_file = "events/events_gen.h.erb"
data_file = "events/events.yaml"
requires = [ "events/events.rb" ]
output_file = "$target_gen_dir/events_gen.h"
}
ark_gen_file("base_options_h") {
template_file = "../templates/options/options.h.erb"
data_file = "options.yaml"
requires = [ "../templates/common.rb" ]
output_file = "$target_gen_dir/generated/base_options.h"
}
action("generate_version_file") {
script = "$ark_root/gn/build/cmake_configure_file.py"
sources = [ "$ark_root/libpandabase/templates/ark_version.h.in" ]
outputs = [ "$root_gen_dir/libpandabase/ark_version.h" ]
hash = exec_script("$ark_root/gn/build/find_git.sh",
[ rebase_path("${ark_root}", "$root_build_dir") ],
"trim string")
if (hash == "") {
args = [
rebase_path(sources[0], "$root_build_dir"),
rebase_path(outputs[0], "$root_build_dir"),
]
} else {
args = [
rebase_path(sources[0], "$root_build_dir"),
rebase_path(outputs[0], "$root_build_dir"),
"ARK_VERSION_GIT_HASH=${hash}",
]
}
}
if (is_mingw) {
libarkbase_sources = [
"$ark_root/libpandabase/mem/arena_allocator.cpp",
"$ark_root/libpandabase/mem/base_mem_stats.cpp",
"$ark_root/libpandabase/mem/code_allocator.cpp",
"$ark_root/libpandabase/mem/mem_config.cpp",
"$ark_root/libpandabase/mem/pool_manager.cpp",
"$ark_root/libpandabase/mem/pool_map.cpp",
"$ark_root/libpandabase/os/filesystem.cpp",
"$ark_root/libpandabase/os/mutex.cpp",
"$ark_root/libpandabase/os/native_stack.cpp",
"$ark_root/libpandabase/os/stacktrace_stub.cpp",
"$ark_root/libpandabase/os/time.cpp",
"$ark_root/libpandabase/utils/json_builder.cpp",
"$ark_root/libpandabase/utils/json_parser.cpp",
"$ark_root/libpandabase/utils/logger.cpp",
"$ark_root/libpandabase/utils/time.cpp",
"$ark_root/libpandabase/utils/type_converter.cpp",
"$ark_root/libpandabase/utils/utf.cpp",
"$ark_root/platforms/windows/libpandabase/error.cpp",
"$ark_root/platforms/windows/libpandabase/file.cpp",
"$ark_root/platforms/windows/libpandabase/filesystem.cpp",
"$ark_root/platforms/windows/libpandabase/library_loader.cpp",
"$ark_root/platforms/windows/libpandabase/mem.cpp",
"$ark_root/platforms/windows/libpandabase/thread.cpp",
"$ark_root/platforms/windows/libpandabase/trace.cpp",
]
} else {
libarkbase_sources = [
"$ark_root/libpandabase/mem/arena_allocator.cpp",
"$ark_root/libpandabase/mem/base_mem_stats.cpp",
"$ark_root/libpandabase/mem/code_allocator.cpp",
"$ark_root/libpandabase/mem/mem_config.cpp",
"$ark_root/libpandabase/mem/pool_manager.cpp",
"$ark_root/libpandabase/mem/pool_map.cpp",
"$ark_root/libpandabase/os/native_stack.cpp",
"$ark_root/libpandabase/os/property.cpp",
# product build
"$ark_root/libpandabase/os/stacktrace_stub.cpp",
"$ark_root/libpandabase/os/time.cpp",
"$ark_root/libpandabase/trace/trace.cpp",
"$ark_root/libpandabase/utils/json_builder.cpp",
"$ark_root/libpandabase/utils/json_parser.cpp",
"$ark_root/libpandabase/utils/logger.cpp",
"$ark_root/libpandabase/utils/time.cpp",
"$ark_root/libpandabase/utils/type_converter.cpp",
"$ark_root/libpandabase/utils/utf.cpp",
"$ark_root/platforms/unix/libpandabase/error.cpp",
"$ark_root/platforms/unix/libpandabase/file.cpp",
"$ark_root/platforms/unix/libpandabase/filesystem.cpp",
"$ark_root/platforms/unix/libpandabase/library_loader_resolve_symbol.cpp",
"$ark_root/platforms/unix/libpandabase/mem.cpp",
"$ark_root/platforms/unix/libpandabase/native_stack.cpp",
"$ark_root/platforms/unix/libpandabase/property.cpp",
"$ark_root/platforms/unix/libpandabase/thread.cpp",
"$ark_root/platforms/unix/libpandabase/trace.cpp",
]
if (!is_mob || is_linux || current_os == "android" || target_os == "ios") {
libarkbase_sources +=
[ "$ark_root/platforms/unix/libpandabase/library_loader_load.cpp" ]
}
if (!is_mac && target_os != "ios") {
libarkbase_sources += [
"$ark_root/libpandabase/os/filesystem.cpp",
"$ark_root/platforms/unix/libpandabase/exec.cpp",
"$ark_root/platforms/unix/libpandabase/futex/fmutex.cpp",
"$ark_root/platforms/unix/libpandabase/futex/mutex.cpp",
]
} else {
libarkbase_sources += [ "$ark_root/libpandabase/os/mutex.cpp" ]
}
if (is_mac && !is_arkui_x) {
libarkbase_sources += [ "$ark_root/libpandabase/os/filesystem.cpp" ]
}
}
if (is_debug) {
libarkbase_sources += [ "$ark_root/libpandabase/utils/debug.cpp" ]
}
if (current_cpu == "arm64" && !is_mac && target_os != "ios") {
libarkbase_sources +=
[ "$ark_root/libpandabase/arch/aarch64/cpu_features.cpp" ]
} else {
libarkbase_sources +=
[ "$ark_root/libpandabase/arch/default/cpu_features.cpp" ]
}
libarkbase_configs = [
":arkbase_public_config",
"$ark_root:ark_config",
]
group("arkbase_header_deps") {
deps = [
":base_options_h",
":events_gen",
":generate_version_file",
":logger_enum_gen_h",
":logger_impl_gen_h",
]
}
libarkbase_deps = [ ":arkbase_header_deps" ]
ohos_source_set("libarkbase_static_fuzz") {
sources = libarkbase_sources
public_configs = libarkbase_configs
public_configs += [ ":arkbase_fuzz_config" ]
deps = libarkbase_deps
external_deps = [ sdk_libc_secshared_dep ]
part_name = "runtime_core"
subsystem_name = "arkcompiler"
}
ohos_static_library("libarkbase_static") {
sources = libarkbase_sources
public_configs = libarkbase_configs
deps = libarkbase_deps
if (!ark_standalone_build) {
public_external_deps = [ sdk_libc_secshared_dep ]
} else {
external_deps = [ sdk_libc_secshared_dep ]
}
if (enable_hilog) {
public_external_deps += [ "hilog:libhilog" ]
}
part_name = "runtime_core"
subsystem_name = "arkcompiler"
}
ohos_shared_library("libarkbase") {
stack_protector_ret = false
deps = [ ":libarkbase_static" ]
external_deps = [ sdk_libc_secshared_dep ]
if (!is_mingw && !is_mac) {
output_extension = "so"
}
if (!is_standard_system) {
relative_install_dir = "ark"
}
part_name = "runtime_core"
subsystem_name = "arkcompiler"
}
ohos_source_set("libarkbase_frontend_set_static") {
sources = libarkbase_sources
public_configs = libarkbase_configs
deps = libarkbase_deps
external_deps = [ sdk_libc_secshared_dep ]
part_name = "runtime_core"
subsystem_name = "arkcompiler"
}
ohos_static_library("libarkbase_frontend_static") {
stack_protector_ret = false
deps = [ ":libarkbase_frontend_set_static" ]
part_name = "runtime_core"
subsystem_name = "arkcompiler"
}
action("logger_yaml_gen") {
script = "$ark_root/libpandabase/templates/logger_gen.rb"
inputs = [ "$ark_root/libpandabase/templates/logger.yaml" ]
outputs = [ "$root_gen_dir/libpandabase/logger.yaml" ]
args = [
"-p",
rebase_path("$target_gen_dir/../plugin_options.yaml", root_build_dir),
"-d",
rebase_path(inputs[0], root_build_dir),
"-o",
rebase_path(outputs[0], root_build_dir),
]
deps = [ "$ark_root:concat_plugins_yamls" ]
}
ark_gen_file("logger_enum_gen_h") {
extra_dependencies = [ ":logger_yaml_gen" ]
template_file = "templates/logger_enum_gen.h.erb"
data_file = "$root_gen_dir/libpandabase/logger.yaml"
requires = [ "$ark_root/libpandabase/templates/logger.rb" ]
output_file = "$target_gen_dir/include/logger_enum_gen.h"
}
ark_gen_file("logger_impl_gen_h") {
extra_dependencies = [ ":logger_yaml_gen" ]
template_file = "templates/logger_impl_gen.inc.erb"
data_file = "$root_gen_dir/libpandabase/logger.yaml"
requires = [ "$ark_root/libpandabase/templates/logger.rb" ]
output_file = "$target_gen_dir/include/logger_impl_gen.inc"
}