6e33c95463
Adds shared libraries for embedding Dart VM and new API (runtime/engine/include/dart_engine.h). TEST=tests/standalone/embedder_samples_test.dart Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-appjit-linux-product-x64-try,vm-appjit-linux-release-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-gcc-linux-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv32-try,vm-linux-debug-simriscv64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-arm64-try,vm-linux-release-ia32-try,vm-linux-release-simarm-try,vm-linux-release-x64-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-msvc-windows-try,vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try,vm-win-release-x64-try Change-Id: Ia4e4d1b871ddef515cfb2f4639bdaa9fe3676936 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402860 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
145 lines
3.2 KiB
Plaintext
145 lines
3.2 KiB
Plaintext
# Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
import("../../utils/aot_snapshot.gni")
|
|
import("../../utils/application_snapshot.gni")
|
|
|
|
# All samples.
|
|
group("all") {
|
|
deps = [
|
|
":aot",
|
|
":kernel",
|
|
]
|
|
}
|
|
|
|
group("aot") {
|
|
deps = [
|
|
":run_main_aot",
|
|
":run_timer_aot",
|
|
":run_timer_async_aot",
|
|
":run_two_programs_aot",
|
|
]
|
|
}
|
|
|
|
group("kernel") {
|
|
deps = [
|
|
":run_main_kernel",
|
|
":run_timer_async_kernel",
|
|
":run_timer_kernel",
|
|
":run_two_programs_kernel",
|
|
]
|
|
}
|
|
|
|
# Generates a pair of executables for kernel and AOT snapshots.
|
|
template("sample") {
|
|
executable("${target_name}_kernel") {
|
|
# Otherwise build with --no-clang fails.
|
|
if (is_linux) {
|
|
ldflags = [ "-Wl,--allow-shlib-undefined" ]
|
|
}
|
|
include_dirs = [
|
|
"../../runtime",
|
|
"../../runtime/engine",
|
|
]
|
|
deps = [ "../../runtime/engine:dart_engine_jit_shared" ]
|
|
if (defined(invoker.deps)) {
|
|
deps += invoker.deps
|
|
}
|
|
data_deps = []
|
|
foreach(snapshot, invoker.snapshots) {
|
|
data_deps += [ "${snapshot}_kernel" ]
|
|
}
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"snapshots",
|
|
"deps",
|
|
"data_deps",
|
|
])
|
|
}
|
|
|
|
executable("${target_name}_aot") {
|
|
# Otherwise build with MSAN fails.
|
|
if (is_linux) {
|
|
ldflags = [ "-Wl,--allow-shlib-undefined" ]
|
|
}
|
|
include_dirs = [
|
|
"../../runtime",
|
|
"../../runtime/engine",
|
|
]
|
|
deps = [ "../../runtime/engine:dart_engine_aot_shared" ]
|
|
if (defined(invoker.deps)) {
|
|
deps += invoker.deps
|
|
}
|
|
data_deps = []
|
|
foreach(snapshot, invoker.snapshots) {
|
|
data_deps += [ "${snapshot}_aot" ]
|
|
}
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"snapshots",
|
|
"deps",
|
|
"data_deps",
|
|
])
|
|
}
|
|
}
|
|
|
|
# For a given main_dart generates Kernel and AOT snapshots
|
|
template("snapshots") {
|
|
# Kernel snapshot
|
|
application_snapshot("${target_name}_kernel") {
|
|
main_dart = invoker.main_dart
|
|
dart_snapshot_kind = "kernel"
|
|
training_args = [] # Not used
|
|
gen_kernel_args = [ "--link-platform" ]
|
|
}
|
|
|
|
# AOT snapshot
|
|
aot_snapshot("${target_name}_aot") {
|
|
main_dart = invoker.main_dart
|
|
}
|
|
}
|
|
|
|
# Sample binary to run given kernel snapshot.
|
|
sample("run_main") {
|
|
sources = [ "run_main.cc" ]
|
|
snapshots = [ ":hello" ]
|
|
}
|
|
|
|
snapshots("hello") {
|
|
main_dart = "hello.dart"
|
|
}
|
|
|
|
# Sample binary to run two snapshots simultaneously.
|
|
sample("run_two_programs") {
|
|
sources = [ "run_two_programs.cc" ]
|
|
snapshots = [
|
|
":program1",
|
|
":program2",
|
|
]
|
|
}
|
|
|
|
snapshots("program1") {
|
|
main_dart = "program1.dart"
|
|
}
|
|
|
|
snapshots("program2") {
|
|
main_dart = "program2.dart"
|
|
}
|
|
|
|
sample("run_timer") {
|
|
sources = [ "run_timer.cc" ]
|
|
snapshots = [ ":timer" ]
|
|
}
|
|
|
|
sample("run_timer_async") {
|
|
sources = [ "run_timer_async.cc" ]
|
|
snapshots = [ ":timer" ]
|
|
}
|
|
|
|
snapshots("timer") {
|
|
main_dart = "timer.dart"
|
|
}
|