diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 6d91281ebec..782e7b40bb1 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -128,6 +128,26 @@ config("dart_os_fuchsia_config") { defines = [ "DART_TARGET_OS_FUCHSIA" ] } +# We need to build gen_snapshot targeting Linux ARM64 during a build +# of the SDK. This configuration is used to unconditionally target +# Linux ARM64. It should not be combined with dart_os_config and dart_arch_config. +config("dart_linux_arm64_config") { + defines = [ + "DART_TARGET_OS_LINUX", + "TARGET_ARCH_ARM64", + ] +} + +# We need to build gen_snapshot targeting Linux ARM64 during a build +# of the SDK. This configuration is used to unconditionally target +# Linux ARM64. It should not be combined with dart_os_config and dart_arch_config. +config("dart_linux_x64_config") { + defines = [ + "DART_TARGET_OS_LINUX", + "TARGET_ARCH_X64", + ] +} + config("dart_arch_config") { defines = [] diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index b3a1350fd57..6b53a0b5900 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -107,6 +107,20 @@ build_libdart_builtin("libdart_builtin_product_host_targeting_host") { extra_configs = [ "..:dart_product_config" ] } +build_libdart_builtin("libdart_builtin_product_linux_x64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_x64_config", + ] +} + +build_libdart_builtin("libdart_builtin_product_linux_arm64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_arm64_config", + ] +} + template("build_native_assets_api") { extra_configs = [] if (defined(invoker.extra_configs)) { @@ -330,6 +344,31 @@ build_gen_snapshot("gen_snapshot_product_fuchsia") { ] } +build_gen_snapshot("gen_snapshot_product_linux_x64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_x64_config", + ] + extra_deps = [ + ":gen_snapshot_dart_io_product_linux_x64", + ":libdart_builtin_product_linux_x64", + "..:libdart_precompiler_product_linux_x64", + "../platform:libdart_platform_precompiler_product_linux_x64", + ] +} + +build_gen_snapshot("gen_snapshot_product_linux_arm64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_arm64_config", + ] + extra_deps = [ + ":gen_snapshot_dart_io_product_linux_arm64", + ":libdart_builtin_product_linux_arm64", + "..:libdart_precompiler_product_linux_arm64", + "../platform:libdart_platform_precompiler_product_linux_arm64", + ] +} build_gen_snapshot("gen_snapshot_host_targeting_host") { extra_configs = [ "..:dart_maybe_product_config" ] extra_deps = [ @@ -434,6 +473,20 @@ build_gen_snapshot_dart_io("gen_snapshot_dart_io_product_fuchsia") { ] } +build_gen_snapshot_dart_io("gen_snapshot_dart_io_product_linux_x64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_x64_config", + ] +} + +build_gen_snapshot_dart_io("gen_snapshot_dart_io_product_linux_arm64") { + extra_configs = [ + "..:dart_product_config", + "..:dart_linux_arm64_config", + ] +} + # A source set for the implementation of 'dart:io' library. template("dart_io") { extra_configs = [] diff --git a/runtime/configs.gni b/runtime/configs.gni index c8ef6312734..c4b1dd11881 100644 --- a/runtime/configs.gni +++ b/runtime/configs.gni @@ -63,6 +63,18 @@ _precompiler_host_targeting_host_config = _precompiler_product_host_targeting_host_config = _base_host_targeting_host_config + _precompiler_base + _product +_precompiler_product_linux_x64_config = + [ + "$_dart_runtime:dart_config", + "$_dart_runtime:dart_linux_x64_config", + ] + _product + _precompiler_base + +_precompiler_product_linux_arm64_config = + [ + "$_dart_runtime:dart_config", + "$_dart_runtime:dart_linux_arm64_config", + ] + _product + _precompiler_base + _all_configs = [ { suffix = "_jit" @@ -148,6 +160,20 @@ _all_configs = [ compiler = true is_product = false }, + { + suffix = "_precompiler_product_linux_x64" + configs = _precompiler_product_linux_x64_config + snapshot = false + compiler = true + is_product = true + }, + { + suffix = "_precompiler_product_linux_arm64" + configs = _precompiler_product_linux_arm64_config + snapshot = false + compiler = true + is_product = true + }, ] # This template creates a target for each of the configurations listed above. diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 16e84ce343b..83036decc65 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -860,6 +860,13 @@ group("create_full_sdk") { if (dart_include_wasm_opt) { public_deps += [ ":copy_wasm_opt" ] } + + # Do not include gen_snapshot binaries for cross-compilation into + # SDK, but add them as a dependency, so that they are built. + public_deps += [ + "../runtime/bin:gen_snapshot_product_linux_arm64", + "../runtime/bin:gen_snapshot_product_linux_x64", + ] } }