|  | # 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") | 
|  |  | 
|  | 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" | 
|  |  | 
|  | driver_package("goldfish") { | 
|  | package_name = "goldfish-system" | 
|  |  | 
|  | resources = [] | 
|  | libraries = [ | 
|  | { | 
|  | name = "$icd_name.so" | 
|  | }, | 
|  | ] | 
|  | deps = [ build_libvulkan_goldfish ] | 
|  | } | 
|  |  | 
|  | 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}}" ] | 
|  | } | 
|  | } |