| # Copyright 2021 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("//build/sdk/sdk_noop_atom.gni") | |
| import("//src/developer/ffx/build/ffx_plugin.gni") | |
| import("//src/developer/ffx/build/ffx_tool.gni") | |
| import("emu_companion.gni") | |
| if (is_host) { | |
| ffx_plugin("ffx_emulator") { | |
| sdk_category = "not-yet-specified" | |
| version = "0.1.0" | |
| edition = "2024" | |
| args_sources = [ "src/args.rs" ] | |
| args_deps = [ | |
| "//src/developer/ffx/core:lib", | |
| "//third_party/rust_crates:argh", | |
| ] | |
| config_data = [ "data/config.json" ] | |
| plugin_deps = [ | |
| "commands/console:ffx_emulator_console", | |
| "commands/input:ffx_emulator_input", | |
| "commands/list:ffx_emulator_list", | |
| "commands/screenshot:ffx_emulator_screenshot", | |
| "commands/show:ffx_emulator_show", | |
| "commands/snapshot:ffx_emulator_snapshot", | |
| "commands/start:ffx_emulator_start", | |
| "commands/stop:ffx_emulator_stop", | |
| ] | |
| } | |
| # AEMU is supported on linux-arm64 and linux-x64 | |
| if (is_linux && (arm_sdk_tools || current_cpu == host_cpu)) { | |
| emu_companion("aemu_internal") { | |
| default_binary = "//prebuilt/third_party/android/aemu/release-gfxstream/${current_os}-${current_cpu}/emulator" | |
| prebuilt_path = "//prebuilt/third_party/android/aemu/release-gfxstream/${current_os}-${current_cpu}" | |
| sdk_dest_path = "tools/${current_cpu}/aemu_internal" | |
| } | |
| } else { | |
| sdk_noop_atom("aemu_internal") { | |
| id = "sdk://tools/$current_cpu/aemu_internal" | |
| category = "partner" | |
| } | |
| } | |
| # QEMU is currently the host_cpu. | |
| # TODO(https://fxbug.dev/42057937) once arm64 is available for mac, provide it as well. | |
| if (current_cpu == host_cpu) { | |
| emu_companion("qemu_internal") { | |
| default_binary = "//prebuilt/third_party/qemu/${current_os}-${current_cpu}/bin/qemu-system-x86_64" | |
| prebuilt_path = "//prebuilt/third_party/qemu/${current_os}-${current_cpu}" | |
| sdk_dest_path = "tools/${current_cpu}/qemu_internal" | |
| } | |
| emu_companion("uefi_internal_x64") { | |
| prebuilt_path = "//prebuilt/third_party/edk2/qemu-x64" | |
| sdk_dest_path = "tools/qemu_uefi_internal/x64" | |
| default_binary = "//prebuilt/third_party/edk2/qemu-x64/OVMF_CODE.fd" | |
| prebuilt_files = [ | |
| "//prebuilt/third_party/edk2/qemu-x64/OVMF_CODE.fd", | |
| "//prebuilt/third_party/edk2/qemu-x64/OVMF_VARS.fd", | |
| ] | |
| } | |
| emu_companion("uefi_internal_arm64") { | |
| prebuilt_path = "//prebuilt/third_party/edk2/qemu-arm64" | |
| sdk_dest_path = "tools/qemu_uefi_internal/arm64" | |
| default_binary = "//prebuilt/third_party/edk2/qemu-arm64/QEMU_EFI.fd" | |
| prebuilt_files = [ | |
| "//prebuilt/third_party/edk2/qemu-arm64/QEMU_EFI.fd", | |
| "//prebuilt/third_party/edk2/qemu-arm64/QEMU_VARS.fd", | |
| ] | |
| } | |
| } else { | |
| sdk_noop_atom("qemu_internal") { | |
| id = "sdk://tools/$current_cpu/qemu_internal" | |
| category = "partner" | |
| } | |
| sdk_noop_atom("uefi_internal_x64") { | |
| id = "sdk://tools/qemu_uefi_internal/x64" | |
| category = "partner" | |
| } | |
| sdk_noop_atom("uefi_internal_arm64") { | |
| id = "sdk://tools/qemu_uefi_internal/arm64" | |
| category = "partner" | |
| } | |
| } | |
| # crosvm is supported on linux and both arm64 and x64, but not macos | |
| if (host_os == "linux" && (arm_sdk_tools || current_cpu == host_cpu)) { | |
| emu_companion("crosvm_internal") { | |
| default_binary = | |
| "//prebuilt/third_party/crosvm/${current_os}-${current_cpu}/crosvm" | |
| prebuilt_path = | |
| "//prebuilt/third_party/crosvm/${current_os}-${current_cpu}" | |
| sdk_dest_path = "tools/${current_cpu}/crosvm_internal" | |
| } | |
| } else { | |
| sdk_noop_atom("crosvm_internal") { | |
| id = "sdk://tools/$current_cpu/crosvm_internal" | |
| category = "partner" | |
| } | |
| } | |
| ffx_tool("ffx_emulator_tool") { | |
| edition = "2024" | |
| output_name = "ffx-emu" | |
| deps = [ | |
| ":ffx_emulator_suite", | |
| "//src/lib/fuchsia-async", | |
| ] | |
| sources = [ "src/main.rs" ] | |
| sdk_target_name = "sdk" | |
| sdk_category = "partner" | |
| } | |
| group("emulator") { | |
| public_deps = [ | |
| ":ffx_emulator_tool", | |
| ":ffx_emulator_tool_host_tool", | |
| ] | |
| } | |
| group("bin") { | |
| public_deps = [ ":ffx_emulator_tool_versioned" ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":ffx_emulator_tests($host_toolchain)", | |
| "commands/list:tests", | |
| "configuration:tests", | |
| "engines:tests", | |
| ] | |
| } | |
| group("host_tests") { | |
| testonly = true | |
| deps = [ "tests:host_tests" ] | |
| } | |
| } |