blob: a157800270af036e1df9bc9edcc6b84b2fb327e2 [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/config.gni")
import("//build/driver_package.gni")
import("//build/toolchain/variant_shared_library_redirect.gni")
declare_args() {
if (target_cpu == "x64") {
build_libvulkan_goldfish = "//third_party/android/device/generic/goldfish-opengl:libvulkan_goldfish"
} else {
build_libvulkan_goldfish = ""
}
}
have_libvulkan = build_libvulkan_goldfish != ""
group("goldfish-vulkan-system") {
if (have_libvulkan) {
public_deps = [ ":goldfish" ]
}
}
group("goldfish-vulkan-config") {
if (have_libvulkan) {
public_deps = [ ":goldfish-config" ]
}
}
if (have_libvulkan) {
icd_name = "libvulkan_goldfish"
# Path to a package manifest file generated by variant_shared_library_redirect()
# and passed to driver_package() to ensure the variant-built shared library is
# properly installed into the driver package.
#
# This won't be necessary when driver_package() is modified to rely on
# fuchsia_package() instead of the deprecated package() template.
icd_manifest = "$target_out_dir/$icd_name.manifest"
variant_shared_library_redirect("libvulkan_goldfish") {
library = build_libvulkan_goldfish
# NOTE: Remove this line when driver_package() is updated to not use the
# deprecated package() template anymore.
extra_manifest = icd_manifest
# libvolkan_goldfish.so doesn't build with instrumented variants.
exclude_toolchain_tags = [ "instrumented" ]
}
driver_package("goldfish") {
package_name = "goldfish-system"
resources = []
# Note: change these two lines to a simple: dpes = [ ":libvulkan_goldfish" ]
# when driver_package() is updated to use fuchsia_package() instead of package()!
resource_deps = [ ":libvulkan_goldfish" ]
extra_manifests = [ icd_manifest ]
}
config_data("goldfish-config") {
# 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\"",
"}",
"}",
]
filename = "$target_gen_dir/vulkan/icd.d/$icd_name.json"
write_file(filename, icd_data)
sources = [ rebase_path(filename) ]
for_pkg = "vulkan-icd"
outputs = [ "icd.d/{{source_file_part}}" ]
}
}