blob: a371a0811c0346067dc01592e0b4f447a1e8bd6b [file] [log] [blame]
# Copyright 2019 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/components.gni")
import("//build/config.gni")
import("//build/dist/packaged_shared_library.gni")
assert(target_cpu == "x64", "goldfish is only for x64")
declare_args() {
build_libvulkan_goldfish =
"//third_party/android/device/generic/goldfish-opengl:libvulkan_goldfish"
}
# Loading ICDs from packages doesn't work on bootfs_only builds, so disable the
# goldfish driver there. Bringup builds are intended to be minimal, so having a
# bringup driver there doesn't make sense anyway.
group("goldfish-vulkan") {
public_deps = [ ":goldfish" ]
}
group("goldfish-vulkan-config") {
public_deps = [ ":goldfish-config" ]
}
icd_name = "libvulkan_goldfish"
packaged_shared_library("libvulkan_goldfish") {
library = build_libvulkan_goldfish
# libvulkan_goldfish.so doesn't build with instrumented variants.
exclude_toolchain_tags = [ "instrumented" ]
}
resource("vulkan_metadata") {
sources = [ "metadata.json" ]
outputs = [ "data/metadata.json" ]
}
manifest_filename = "$target_gen_dir/vulkan/icd.d/$icd_name.json"
# api_version must be present but is unused
icd_data = [
"{",
"\"file_format_version\": \"1.0.0\",",
"\"ICD\": {",
"\"library_path\": \"$icd_name.so\",",
"\"api_version\": \"1.1.0\"",
"}",
"}",
]
write_file(manifest_filename, icd_data)
resource("vulkan_manifest_json") {
sources = [ manifest_filename ]
outputs = [ "data/icd.d/$icd_name.json" ]
}
fuchsia_package_with_single_component("goldfish") {
package_name = "libvulkan_goldfish"
component_name = "vulkan"
deps = [
":libvulkan_goldfish",
":vulkan_manifest_json",
":vulkan_metadata",
]
manifest = "meta/vulkan.cml"
}
config_data("goldfish-config") {
sources = [ rebase_path(manifest_filename) ]
for_pkg = "vulkan-icd"
outputs = [ "icd.d/{{source_file_part}}" ]
}