From bada8e0ef946f09402d55417fac9070d7b49e2f2 Mon Sep 17 00:00:00 2001 From: vagin ivan Date: Fri, 14 Oct 2022 14:01:04 +0300 Subject: [PATCH] Fix GN build for OHOS Signed-off-by: vagin ivan --- BUILD.gn | 34 ++++++++++++++++++++++++---------- runtime/CMakeLists.txt | 1 + runtime/base/string_helper.h | 2 +- subproject_sources.gn | 14 +++++++++++--- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 062632fe0..752f45217 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -28,7 +28,10 @@ group("ark_host_mac_tools_packages") { } config("ark_config") { - defines = [ "PANDA_WITH_ECMASCRIPT" ] + defines = [ + "PANDA_WITH_ECMASCRIPT", + "ARK_INTRINSIC_SET", + ] } config("assembler") { @@ -53,10 +56,12 @@ config("runtime") { include_dirs = [ "$ark_root/plugins/ecmascript/runtime/", "$target_gen_dir", - "$root_gen_dir", - "$ark_root/ark-third-party/icu/icu4c/source/common", - "$ark_root/ark-third-party/icu/icu4c/source/i18n", - "$ark_root/ark-third-party/icu/icu4c/source/", + "$ark_root_gen_dir", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/i18n", + "$ark_third_party_root/icu/icu4c/source", + "$ark_third_party_root/icu", ] configs = [ "es2panda:libes2panda_public_config", @@ -67,22 +72,31 @@ config("runtime") { config("runtime_interpreter_impl") { include_dirs = [ - "$ark_root/ark-third-party/icu/icu4c/source/common", - "$ark_root/ark-third-party/icu/icu4c/source/i18n", - "$ark_root/ark-third-party/icu/icu4c/source/", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/i18n", + "$ark_third_party_root/icu/icu4c/source/", + "$ark_third_party_root/icu", ] } -# Empty inlined ecmastblib. -action("ecmastblib_inline_h") { +ark_asm_gen("ecmastdlib") { + input_file = "ecmastdlib/ecmastdlib.pa" + output_file = "$target_gen_dir/ecmastdlib.abc" +} + +action("ecmastdlib_inline_h") { script = "ecmastdlib/ecmastdlib_inline_gen.rb" outputs = [ "$target_gen_dir/ecmastdlib_inline_gen.h" ] + stdlib = get_target_outputs(":ecmastdlib") args = [ "-t", rebase_path("ecmastdlib/ecmastdlib_inline_gen.h.erb", root_build_dir), "-o", rebase_path("$target_gen_dir/ecmastdlib_inline_gen.h"), + "-d", + rebase_path(stdlib[0], root_build_dir), ] + deps = [ ":ecmastdlib" ] } # Substitute ICU path diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 8542c2b1d..0998ce76d 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -276,6 +276,7 @@ set(ICU_INCLUDE_DIR ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source/common ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source/i18n ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source + ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu ) target_include_directories(arkruntime_static diff --git a/runtime/base/string_helper.h b/runtime/base/string_helper.h index 30248b1f2..f8e593858 100644 --- a/runtime/base/string_helper.h +++ b/runtime/base/string_helper.h @@ -28,7 +28,7 @@ #include "plugins/ecmascript/runtime/ecma_vm.h" #include "plugins/ecmascript/runtime/js_thread.h" #include "plugins/ecmascript/runtime/object_factory.h" -#include "ark-third-party/icu/icu4c/source/common/unicode/unistr.h" +#include "icu4c/source/common/unicode/unistr.h" #include "libpandafile/file_items.h" namespace panda::ecmascript::base { diff --git a/subproject_sources.gn b/subproject_sources.gn index 34d3a8ecb..bf13a67cb 100644 --- a/subproject_sources.gn +++ b/subproject_sources.gn @@ -15,6 +15,8 @@ import("//ark/runtime_core/ark_root.gni") _plugin_dir = get_path_info(".", "abspath") assert(string_replace(_plugin_dir, "//", "") != _plugin_dir) +enable_bytecode_optimizer = true + srcs_assembler = [ "assembler/extension/ecmascript_meta.cpp" ] srcs_isa = [ "isa/isa.yaml" ] srcs_compiler = [ @@ -39,17 +41,23 @@ irtoc_plugins = [ arkruntime_header_sub_deps = [ "$_plugin_dir:ecma_intrinsics_gen_arkruntime", - "$_plugin_dir:ecmastblib_inline_h", "$_plugin_dir:substitute_icu_path", ] +arkruntime_stdlib_sub_deps = [ + "$_plugin_dir:ecmastdlib_inline_h", +] arkcompiler_deps = [ "$_plugin_dir:isa_gen_ecma_compiler_ecmascript_inst_builder_gen_cpp" ] arkbytecodeopt_deps = [ "$_plugin_dir:isa_gen_ecma_bytecodeopt_ecmascript_codegen_intrinsics_gen_inc", ] +arkruntime_third_party_deps = [ + "icu/icu4c:shared_icui18n", + "icu/icu4c:shared_icuuc", +] arkruntime_deps = [ - "$ark_third_party_root/icu:shared_icui18n", - "$ark_third_party_root/icu:shared_icuuc", + "$ark_third_party_root/icu/icu4c:shared_icui18n", + "$ark_third_party_root/icu/icu4c:shared_icuuc", "$ark_root/assembler:libarkassembler_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", "$_plugin_dir/es2panda:libes2panda_frontend_static", -- Gitee