From 10df50a25d72e066bc312cdd548905eb0c9af2e1 Mon Sep 17 00:00:00 2001 From: jiangyong Date: Mon, 14 Feb 2022 20:10:15 +0800 Subject: [PATCH 1/3] extract source_set Signed-off-by: jiangyong --- BUILD.gn | 73 +++++++++++---------- ark_config.gni | 8 ++- assembler/BUILD.gn | 75 ++++++++++++++++----- dprof/BUILD.gn | 23 +++++-- isa/BUILD.gn | 6 +- libpandabase/BUILD.gn | 48 ++++++++++---- libpandafile/BUILD.gn | 46 +++++++++---- libziparchive/BUILD.gn | 46 +++++++++---- runtime/BUILD.gn | 119 ++++++++++++++++++++++++---------- runtime/asm_defines/BUILD.gn | 82 ++++++++++++++++------- verification/gen/BUILD.gn | 13 ++-- verification/verification.gni | 6 +- 12 files changed, 387 insertions(+), 158 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index f30ca7fdd9..99eb906472 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,46 +11,53 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (defined(ark_flag)) { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} -group("ark_packages") { - if (host_os != "mac") { - deps = [ - "$ark_root/libpandabase:libarkbase", - "$ark_root/libpandafile:libarkfile", - "$ark_root/libziparchive:libarkziparchive", - ] +if (!defined(ark_flag)) { + group("ark_packages") { + if (host_os != "mac") { + deps = [ + "$ark_root/libpandabase:libarkbase", + "$ark_root/libpandafile:libarkfile", + "$ark_root/libziparchive:libarkziparchive", + ] + } } -} -group("ark_host_linux_tools_packages") { - if (host_os != "mac") { - deps = [ - "$ark_root/assembler:ark_asm(${host_toolchain})", - "$ark_root/disassembler:ark_disasm(${host_toolchain})", - "$ark_root/libpandabase:libarkbase(${host_toolchain})", - "$ark_root/libpandafile:libarkfile(${host_toolchain})", - "$ark_root/libziparchive:libarkziparchive(${host_toolchain})", - ] + group("ark_host_linux_tools_packages") { + if (host_os != "mac") { + deps = [ + "$ark_root/assembler:ark_asm(${host_toolchain})", + "$ark_root/disassembler:ark_disasm(${host_toolchain})", + "$ark_root/libpandabase:libarkbase(${host_toolchain})", + "$ark_root/libpandafile:libarkfile(${host_toolchain})", + "$ark_root/libziparchive:libarkziparchive(${host_toolchain})", + ] + } } -} -group("ark_host_windows_tools_packages") { - if (host_os != "mac" && !ark_standalone_build) { - deps = [ - "$ark_root/assembler:ark_asm(//build/toolchain/mingw:mingw_x86_64)", - "$ark_root/disassembler:ark_disasm(//build/toolchain/mingw:mingw_x86_64)", - ] + group("ark_host_windows_tools_packages") { + if (host_os != "mac" && !ark_standalone_build) { + deps = [ + "$ark_root/assembler:ark_asm(//build/toolchain/mingw:mingw_x86_64)", + "$ark_root/disassembler:ark_disasm(//build/toolchain/mingw:mingw_x86_64)", + ] + } } -} -group("ark_host_mac_tools_packages") { - if (host_os == "mac") { - deps = [ - "$ark_root/assembler:ark_asm(//build/toolchain/mac:clang_x64)", - "$ark_root/disassembler:ark_disasm(//build/toolchain/mac:clang_x64)", - ] + group("ark_host_mac_tools_packages") { + if (host_os == "mac") { + deps = [ + "$ark_root/assembler:ark_asm(//build/toolchain/mac:clang_x64)", + "$ark_root/disassembler:ark_disasm(//build/toolchain/mac:clang_x64)", + ] + } } } diff --git a/ark_config.gni b/ark_config.gni index 057ccd8058..e79bbd15db 100644 --- a/ark_config.gni +++ b/ark_config.gni @@ -21,7 +21,11 @@ if (ark_standalone_build) { with_ecmascript = true use_pbqp = true } else { - ark_root = "//ark/runtime_core" + if (!defined(ark_flag)) { + ark_root = "//ark/runtime_core" + } else { + ark_root = "//runtime_core" + } ark_third_party_root = "//third_party" with_ecmascript = false use_pbqp = false @@ -30,7 +34,7 @@ if (ark_standalone_build) { ark_enable_global_register_variables = true enable_bytecode_optimizer = false -if (ark_standalone_build) { +if (ark_standalone_build || defined(ark_flag)) { sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secshared" sdk_libc_secshared_config = "$ark_third_party_root/securec:libsec_public_config" diff --git a/assembler/BUILD.gn b/assembler/BUILD.gn index ecf04b5de7..f3ecb52fa9 100644 --- a/assembler/BUILD.gn +++ b/assembler/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("$root_runtime_core/ark_config.gni") +} config("arkassembler_public_config") { include_dirs = [ @@ -47,10 +52,10 @@ libarkassembler_configs = [ "$ark_root/libpandafile:arkfile_public_config", ] -ohos_shared_library("libarkassembler") { +source_set("libarkassembler_static") { sources = libarkassembler_sources - configs = libarkassembler_configs + public_configs = libarkassembler_configs deps = [ ":ark_asm_ecmascript_meta_gen_h", @@ -65,17 +70,12 @@ ohos_shared_library("libarkassembler") { "$ark_root/libpandafile:libarkfile", sdk_libc_secshared_dep, ] - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkassembler_frontend_static") { +source_set("libarkassembler_frontend_set") { sources = libarkassembler_sources - configs = libarkassembler_configs + public_configs = libarkassembler_configs deps = [ ":ark_asm_ecmascript_meta_gen_h", @@ -92,12 +92,12 @@ ohos_static_library("libarkassembler_frontend_static") { ] } -ohos_executable("ark_asm") { +source_set("ark_asm_static") { sources = [ "pandasm.cpp" ] include_dirs = [ "$target_gen_dir" ] - configs = [ + public_configs = [ sdk_libc_secshared_config, ":arkassembler_public_config", "$ark_root:ark_config", @@ -111,13 +111,54 @@ ohos_executable("ark_asm") { "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", ] +} + +if (!defined(ark_flag)) { + ohos_executable("ark_asm") { + deps = [ ":ark_asm_static" ] + + if (!is_mac && !is_mingw && !ark_standalone_build) { + ldflags = [ "-static-libstdc++" ] + } + + install_enable = true + subsystem_name = "ark" + } - if (!is_mac && !is_mingw && !ark_standalone_build) { - ldflags = [ "-static-libstdc++" ] + ohos_shared_library("libarkassembler") { + deps = [ ":libarkassembler_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + + ohos_static_library("libarkassembler_frontend_static") { + deps = [ ":libarkassembler_frontend_set" ] + } +} else { + ark_executable("ark_asm") { + deps = [ ":ark_asm_static" ] + ldflags = [ + "-shared", + "-ldl", + "-lm", + ] + if (!is_mac && !is_mingw && !ark_standalone_build) { + ldflags += [ "-static-libstdc++" ] + } } - install_enable = true - subsystem_name = "ark" + ark_shared_library("libarkassembler") { + deps = [ ":libarkassembler_static" ] + output_extension = "so" + } + + ark_static_library("libarkassembler_frontend_static") { + deps = [ ":libarkassembler_frontend_set" ] + } } ark_isa_gen("isa_gen_libarkassembler") { diff --git a/dprof/BUILD.gn b/dprof/BUILD.gn index 6496e70f84..6db8e35295 100644 --- a/dprof/BUILD.gn +++ b/dprof/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("$root_runtime_core/ark_config.gni") +} config("libdprof_config") { include_dirs = [ @@ -22,14 +27,14 @@ config("libdprof_config") { ] } -ohos_static_library("libdprof") { +source_set("libdprof_static") { sources = [ "libdprof/dprof/ipc/ipc_message.cpp", "libdprof/dprof/ipc/ipc_unix_socket.cpp", "libdprof/dprof/profiling_data.cpp", ] - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", sdk_libc_secshared_config, @@ -38,3 +43,13 @@ ohos_static_library("libdprof") { deps = [ "$ark_root/libpandabase:libarkbase" ] } + +if (!defined(ark_flag)) { + ohos_static_library("libdprof") { + deps = [ ":libdprof_static" ] + } +} else { + ark_static_library("libdprof") { + deps = [ ":libdprof_static" ] + } +} diff --git a/isa/BUILD.gn b/isa/BUILD.gn index 62aa71f001..2d59723015 100644 --- a/isa/BUILD.gn +++ b/isa/BUILD.gn @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") +if (defined(ark_flag)) { + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") +} action("isa_combine") { script = "$ark_root/isa/combine.rb" diff --git a/libpandabase/BUILD.gn b/libpandabase/BUILD.gn index d5404d9b59..cbfbe8ebe4 100644 --- a/libpandabase/BUILD.gn +++ b/libpandabase/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkbase_public_config") { include_dirs = [ @@ -122,24 +127,43 @@ libarkbase_deps = [ sdk_libc_secshared_dep, ] -ohos_shared_library("libarkbase") { +source_set("libarkbase_static") { sources = libarkbase_sources - configs = libarkbase_configs + public_configs = libarkbase_configs deps = libarkbase_deps - - output_extension = "so" - if (!is_standard_system) { - relative_install_dir = "ark" - } - subsystem_name = "ark" } -ohos_static_library("libarkbase_frontend_static") { +source_set("libarkbase_frontend_set") { sources = libarkbase_sources - configs = libarkbase_configs + public_configs = libarkbase_configs deps = libarkbase_deps } + +if (!defined(ark_flag)) { + ohos_shared_library("libarkbase") { + deps = [ ":libarkbase_static" ] + + output_extension = "so" + if (!is_standard_system) { + relative_install_dir = "ark" + } + subsystem_name = "ark" + } + + ohos_static_library("libarkbase_frontend_static") { + deps = [ ":libarkbase_frontend_set" ] + } +} else { + ark_shared_library("libarkbase") { + deps = [ ":libarkbase_static" ] + output_extension = "so" + } + + ark_static_library("libarkbase_frontend_static") { + deps = [ ":libarkbase_frontend_set" ] + } +} diff --git a/libpandafile/BUILD.gn b/libpandafile/BUILD.gn index 6d9b5e656f..0b86be2cd6 100644 --- a/libpandafile/BUILD.gn +++ b/libpandafile/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkfile_public_config") { include_dirs = [ @@ -57,10 +62,10 @@ libarkfile_configs = [ ":arkfile_public_config", ] -ohos_shared_library("libarkfile") { +source_set("libarkfile_static") { sources = libarkfile_sources - configs = libarkfile_configs + public_configs = libarkfile_configs deps = [ ":isa_gen_libarkfile_bytecode_emitter_def_gen_h", @@ -74,18 +79,12 @@ ohos_shared_library("libarkfile") { "$ark_root/libziparchive:libarkziparchive", sdk_libc_secshared_dep, ] - - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkfile_frontend_static") { +source_set("libarkfile_frontend_set") { sources = libarkfile_sources - configs = libarkfile_configs + public_configs = libarkfile_configs deps = [ ":isa_gen_libarkfile_bytecode_emitter_def_gen_h", @@ -101,6 +100,29 @@ ohos_static_library("libarkfile_frontend_static") { ] } +if (!defined(ark_flag)) { + ohos_shared_library("libarkfile") { + deps = [ ":libarkfile_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + ohos_static_library("libarkfile_frontend_static") { + deps = [ ":libarkfile_frontend_set" ] + } +} else { + ark_shared_library("libarkfile") { + deps = [ ":libarkfile_static" ] + output_extension = "so" + } + ark_static_library("libarkfile_frontend_static") { + deps = [ ":libarkfile_frontend_set" ] + } +} + ark_gen_file("libarkfile_type_gen_h") { template_file = "templates/type.h.erb" data_file = "types.yaml" diff --git a/libziparchive/BUILD.gn b/libziparchive/BUILD.gn index 7b050e19ef..a8dc55b8d8 100644 --- a/libziparchive/BUILD.gn +++ b/libziparchive/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} config("arkziparchive_config") { include_dirs = [ @@ -30,10 +35,10 @@ config("arkziparchive_config") { } } -ohos_shared_library("libarkziparchive") { +source_set("libarkziparchive_static") { sources = [ "zip_archive.cpp" ] - configs = [ + public_configs = [ ":arkziparchive_config", "$ark_root:ark_config", sdk_libc_secshared_config, @@ -49,17 +54,12 @@ ohos_shared_library("libarkziparchive") { } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } - if (!is_standard_system) { - relative_install_dir = "ark" - } - output_extension = "so" - subsystem_name = "ark" } -ohos_static_library("libarkziparchive_frontend_static") { +source_set("libarkziparchive_frontend_set") { sources = [ "zip_archive.cpp" ] - configs = [ + public_configs = [ ":arkziparchive_config", "$ark_root:ark_config", sdk_libc_secshared_config, @@ -69,10 +69,32 @@ ohos_static_library("libarkziparchive_frontend_static") { "$ark_root/libpandabase:libarkbase_frontend_static", sdk_libc_secshared_dep, ] - if (!ark_standalone_build) { deps += [ "//third_party/zlib:libz" ] } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } } + +if (!defined(ark_flag)) { + ohos_shared_library("libarkziparchive") { + deps = [ ":libarkziparchive_static" ] + + if (!is_standard_system) { + relative_install_dir = "ark" + } + output_extension = "so" + subsystem_name = "ark" + } + ohos_static_library("libarkziparchive_frontend_static") { + deps = [ ":libarkziparchive_frontend_set" ] + } +} else { + ark_shared_library("libarkziparchive") { + deps = [ ":libarkziparchive_static" ] + output_extension = "so" + } + ark_static_library("libarkziparchive_frontend_static") { + deps = [ ":libarkziparchive_frontend_set" ] + } +} diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index eef4721019..9fe497faf9 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -11,9 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") -import("$ark_root/verification/verification.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") + import("$ark_root/verification/verification.gni") +} else { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") + import("$ark_root/verification/verification.gni") +} config("arkruntime_public_config") { include_dirs = [ @@ -62,7 +68,7 @@ group("arkruntime_header_deps") { ] } -ohos_static_library("libarkruntime_static") { +source_set("libarkruntime_set") { sources = [ "arch/asm_support.cpp", "assert_gc_scope.cpp", @@ -200,7 +206,7 @@ ohos_static_library("libarkruntime_static") { sources += core_vm_sources sources += verifier_sources - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", @@ -244,24 +250,6 @@ ohos_static_library("libarkruntime_static") { ":bridge_dispatch_dyn_amd64", ] } - - if (current_cpu == "amd64" || current_cpu == "x64" || - current_cpu == "x86_64") { - ldflags = [ "-latomic" ] - } - - output_extension = "a" - subsystem_name = "ark" -} - -ohos_shared_library("libarkruntime") { - deps = [ ":libarkruntime_static" ] - - output_extension = "so" - if (!is_standard_system) { - relative_install_dir = "ark" - } - subsystem_name = "ark" } config("arkruntime_interpreter_impl_config") { @@ -300,10 +288,10 @@ config("arkruntime_interpreter_impl_config") { } } -ohos_static_library("arkruntime_interpreter_impl") { +source_set("arkruntime_interpreter_impl_static") { sources = [ "interpreter/interpreter_impl.cpp" ] - configs = [ + public_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", @@ -319,6 +307,55 @@ ohos_static_library("arkruntime_interpreter_impl") { ] } +if (!defined(ark_flag)) { + ohos_static_library("libarkruntime_static") { + deps = [ ":libarkruntime_set" ] + + if (current_cpu == "amd64" || current_cpu == "x64" || + current_cpu == "x86_64") { + ldflags = [ "-latomic" ] + } + + output_extension = "a" + subsystem_name = "ark" + } + + ohos_shared_library("libarkruntime") { + deps = [ ":libarkruntime_static" ] + + output_extension = "so" + if (!is_standard_system) { + relative_install_dir = "ark" + } + subsystem_name = "ark" + } + + ohos_static_library("arkruntime_interpreter_impl") { + deps = [ ":arkruntime_interpreter_impl_static" ] + } +} else { + ark_static_library("libarkruntime_static") { + deps = [ ":libarkruntime_set" ] + + if (current_cpu == "amd64" || current_cpu == "x64" || + current_cpu == "x86_64") { + ldflags = [ "-latomic" ] + } + + output_extension = "a" + } + + ark_shared_library("libarkruntime") { + deps = [ ":libarkruntime_static" ] + + output_extension = "so" + } + + ark_static_library("arkruntime_interpreter_impl") { + deps = [ ":arkruntime_interpreter_impl_static" ] + } +} + template("gen_intrinsics_yaml") { assert(defined(invoker.data_files), "data_files required!") assert(defined(invoker.output_file), "output_file required!") @@ -368,15 +405,29 @@ ark_isa_gen("isa_gen_libarkruntime") { isa = "$root_gen_dir/isa/isa.yaml" isa_api = "$ark_root/isa/isapi.rb" bridge_dispatch_template = "templates/bridge_dispatch.S.erb" -bridge_archs = [ - "aarch64", - "arm", - "armhf", - "amd64", - "x86", - "x86_64", - "x64", -] +if (!defined(ark_flag)) { + bridge_archs = [ + "aarch64", + "arm", + "armhf", + "amd64", + "x86", + "x86_64", + "x64", + ] +} else { + bridge_archs = [ + "aarch64", + "arm", + "armhf", + "amd64", + + #"x86", + "x86_64", + "x64", + ] +} + foreach(arch, bridge_archs) { ark_gen_file("bridge_dispatch_${arch}") { data_file = isa diff --git a/runtime/asm_defines/BUILD.gn b/runtime/asm_defines/BUILD.gn index be455aaeaf..3940cd6286 100644 --- a/runtime/asm_defines/BUILD.gn +++ b/runtime/asm_defines/BUILD.gn @@ -11,36 +11,68 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (!defined(ark_flag)) { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} else { + import("//build/ark.gni") + import("$root_runtime_core/ark_config.gni") +} config("asmdefines_public_config") { include_dirs = [ "$target_gen_dir/generated/" ] } -ohos_static_library("asm_defines") { - sources = [ "defines.cpp" ] - configs = [ - "$ark_root:ark_config", - "$ark_root/runtime:arkruntime_public_config", - "$ark_root/libpandabase:arkbase_public_config", - sdk_libc_secshared_config, - "$ark_root/libpandafile:arkfile_public_config", - ] - cflags_cc = [ - "-Wno-invalid-offsetof", - "-S", - ] - output_dir = "$target_gen_dir/generated" - output_extension = "S" - output_name = "libasm_defines" - deps = [ - "$ark_root/libpandafile:libarkfile", - "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", - "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", - "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", - sdk_libc_secshared_dep, - ] +if (!defined(ark_flag)) { + ohos_static_library("asm_defines") { + sources = [ "defines.cpp" ] + configs = [ + "$ark_root:ark_config", + "$ark_root/runtime:arkruntime_public_config", + "$ark_root/libpandabase:arkbase_public_config", + sdk_libc_secshared_config, + "$ark_root/libpandafile:arkfile_public_config", + ] + cflags_cc = [ + "-Wno-invalid-offsetof", + "-S", + ] + output_dir = "$target_gen_dir/generated" + output_extension = "S" + output_name = "libasm_defines" + deps = [ + "$ark_root/libpandafile:libarkfile", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", + sdk_libc_secshared_dep, + ] + } +} else { + ark_static_library("asm_defines") { + sources = [ "defines.cpp" ] + configs = [ + "$ark_root:ark_config", + "$ark_root/runtime:arkruntime_public_config", + "$ark_root/libpandabase:arkbase_public_config", + sdk_libc_secshared_config, + "$ark_root/libpandafile:arkfile_public_config", + ] + cflags_cc = [ + "-Wno-invalid-offsetof", + "-S", + ] + output_dir = "$target_gen_dir/generated" + output_extension = "S" + output_name = "libasm_defines" + deps = [ + "$ark_root/libpandafile:libarkfile", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_gen_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_intrinsics_h", + "$ark_root/runtime:arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp", + sdk_libc_secshared_dep, + ] + } } action("asm_defines_generator") { diff --git a/verification/gen/BUILD.gn b/verification/gen/BUILD.gn index 440644e9a4..fafc4cb5dd 100644 --- a/verification/gen/BUILD.gn +++ b/verification/gen/BUILD.gn @@ -11,8 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") -import("//build/ohos.gni") +if (defined(ark_flag)) { + import("//build/ark.gni") + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") + import("//build/ohos.gni") +} config("verification_public_config") { include_dirs = [ @@ -37,9 +42,7 @@ ark_isa_gen("isa_gen_verification_gen") { ] sources = "templates" ## ark_root/templates destination = "$target_gen_dir/include" ## target_gen_dir/include - extra_dependencies = [ - ":verification_abs_int_inl_compat_checks_h", - ] + extra_dependencies = [ ":verification_abs_int_inl_compat_checks_h" ] } ark_gen_file("verification_verifier_messages_h") { diff --git a/verification/verification.gni b/verification/verification.gni index 1af659e307..0e7025fffe 100644 --- a/verification/verification.gni +++ b/verification/verification.gni @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/runtime_core/ark_config.gni") +if (defined(ark_flag)) { + import("//runtime_core/ark_config.gni") +} else { + import("//ark/runtime_core/ark_config.gni") +} type_sources = [ "$ark_root/verification/type/type_param.cpp", -- Gitee From 0900d04b6cc301f2a614df84f0beb1efea4cc161 Mon Sep 17 00:00:00 2001 From: swx1119547 Date: Fri, 25 Feb 2022 09:10:57 +0800 Subject: [PATCH 2/3] Move the third_party to build/core Signed-off-by: swx1119547 --- ark_config.gni | 3 ++- assembler/BUILD.gn | 2 +- dprof/BUILD.gn | 2 +- libpandafile/BUILD.gn | 4 ++-- libziparchive/BUILD.gn | 9 ++++---- runtime/BUILD.gn | 12 +++++------ runtime/asm_defines/BUILD.gn | 2 +- runtime/templates/bridge_helpers_x64.rb | 25 ++++++++++++++++++++++ runtime/templates/bridge_helpers_x86_64.rb | 25 ++++++++++++++++++++++ 9 files changed, 67 insertions(+), 17 deletions(-) create mode 100755 runtime/templates/bridge_helpers_x64.rb create mode 100755 runtime/templates/bridge_helpers_x86_64.rb diff --git a/ark_config.gni b/ark_config.gni index e79bbd15db..2632817f10 100644 --- a/ark_config.gni +++ b/ark_config.gni @@ -23,10 +23,11 @@ if (ark_standalone_build) { } else { if (!defined(ark_flag)) { ark_root = "//ark/runtime_core" + ark_third_party_root = "//third_party" } else { ark_root = "//runtime_core" + ark_third_party_root = "//build/core/third_party" } - ark_third_party_root = "//third_party" with_ecmascript = false use_pbqp = false } diff --git a/assembler/BUILD.gn b/assembler/BUILD.gn index f3ecb52fa9..306b5825d3 100644 --- a/assembler/BUILD.gn +++ b/assembler/BUILD.gn @@ -16,7 +16,7 @@ if (!defined(ark_flag)) { import("//build/ohos.gni") } else { import("//build/ark.gni") - import("$root_runtime_core/ark_config.gni") + import("//runtime_core/ark_config.gni") } config("arkassembler_public_config") { diff --git a/dprof/BUILD.gn b/dprof/BUILD.gn index 6db8e35295..a277c1232c 100644 --- a/dprof/BUILD.gn +++ b/dprof/BUILD.gn @@ -16,7 +16,7 @@ if (!defined(ark_flag)) { import("//build/ohos.gni") } else { import("//build/ark.gni") - import("$root_runtime_core/ark_config.gni") + import("//runtime_core/ark_config.gni") } config("libdprof_config") { diff --git a/libpandafile/BUILD.gn b/libpandafile/BUILD.gn index 0b86be2cd6..d7668c6afc 100644 --- a/libpandafile/BUILD.gn +++ b/libpandafile/BUILD.gn @@ -29,8 +29,8 @@ config("arkfile_public_config") { if (!ark_standalone_build) { include_dirs += [ - "//third_party/zlib", - "//third_party/zlib/contrib/minizip", + "$ark_third_party_root/zlib", + "$ark_third_party_root/zlib/contrib/minizip", ] } else { include_dirs += [ "$ark_third_party_root/miniz" ] diff --git a/libziparchive/BUILD.gn b/libziparchive/BUILD.gn index a8dc55b8d8..a8894d3cca 100644 --- a/libziparchive/BUILD.gn +++ b/libziparchive/BUILD.gn @@ -27,8 +27,8 @@ config("arkziparchive_config") { if (!ark_standalone_build) { include_dirs += [ - "//third_party/zlib", - "//third_party/zlib/contrib/minizip", + "$ark_third_party_root/zlib", + "$ark_third_party_root/zlib/contrib/minizip", ] } else { include_dirs += [ "$ark_third_party_root/miniz" ] @@ -48,9 +48,8 @@ source_set("libarkziparchive_static") { "$ark_root/libpandabase:libarkbase", sdk_libc_secshared_dep, ] - if (!ark_standalone_build) { - deps += [ "//third_party/zlib:libz" ] + deps += [ "$ark_third_party_root/zlib:libz" ] } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } @@ -70,7 +69,7 @@ source_set("libarkziparchive_frontend_set") { sdk_libc_secshared_dep, ] if (!ark_standalone_build) { - deps += [ "//third_party/zlib:libz" ] + deps += [ "$ark_third_party_root/zlib:libz" ] } else { deps += [ "$ark_third_party_root/miniz:libminiz" ] } diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 9fe497faf9..4b234359b2 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -27,9 +27,9 @@ config("arkruntime_public_config") { "$target_gen_dir", "$target_gen_dir/generated", "$target_gen_dir/include", - "//third_party/icu/icu4c/source/common", - "//third_party/icu/icu4c/source/i18n", - "//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/", ] configs = [ "$ark_root/verification/gen:verification_public_config" ] } @@ -262,9 +262,9 @@ config("arkruntime_interpreter_impl_config") { "$target_gen_dir", "$target_gen_dir/generated", "$target_gen_dir/include", - "//third_party/icu/icu4c/source/common", - "//third_party/icu/icu4c/source/i18n", - "//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/", ] cflags_cc = [ diff --git a/runtime/asm_defines/BUILD.gn b/runtime/asm_defines/BUILD.gn index 3940cd6286..f23534ca9a 100644 --- a/runtime/asm_defines/BUILD.gn +++ b/runtime/asm_defines/BUILD.gn @@ -16,7 +16,7 @@ if (!defined(ark_flag)) { import("//build/ohos.gni") } else { import("//build/ark.gni") - import("$root_runtime_core/ark_config.gni") + import("//runtime_core/ark_config.gni") } config("asmdefines_public_config") { diff --git a/runtime/templates/bridge_helpers_x64.rb b/runtime/templates/bridge_helpers_x64.rb new file mode 100755 index 0000000000..166d414de5 --- /dev/null +++ b/runtime/templates/bridge_helpers_x64.rb @@ -0,0 +1,25 @@ +# Copyright (c) 2021 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. + +def cmp_opcode(imm) + return "cmpl $#{imm}, %ecx" +end + +def jump_eq(target) + return "je #{target}" +end + +def handler_path(name) + return "bridge/arch/amd64/handle_#{name}_amd64.S" +end + diff --git a/runtime/templates/bridge_helpers_x86_64.rb b/runtime/templates/bridge_helpers_x86_64.rb new file mode 100755 index 0000000000..166d414de5 --- /dev/null +++ b/runtime/templates/bridge_helpers_x86_64.rb @@ -0,0 +1,25 @@ +# Copyright (c) 2021 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. + +def cmp_opcode(imm) + return "cmpl $#{imm}, %ecx" +end + +def jump_eq(target) + return "je #{target}" +end + +def handler_path(name) + return "bridge/arch/amd64/handle_#{name}_amd64.S" +end + -- Gitee From 05ca9cc2b17cf345c2ac822b3db8af38fe3db488 Mon Sep 17 00:00:00 2001 From: songhao Date: Mon, 21 Mar 2022 10:22:20 +0800 Subject: [PATCH 3/3] 3.14-3.24 Signed-off-by: songhao --- ark_config.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ark_config.gni b/ark_config.gni index 2632817f10..9f60a6db30 100644 --- a/ark_config.gni +++ b/ark_config.gni @@ -41,7 +41,7 @@ if (ark_standalone_build || defined(ark_flag)) { "$ark_third_party_root/securec:libsec_public_config" if (is_mingw || is_mac || is_linux) { - sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secstatic" + sdk_libc_secshared_dep = "$ark_third_party_root/securec:libc_secshared" } } else { sdk_libc_secshared_dep = "//utils/native/base:utilsecurec_shared" -- Gitee