| # 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/toolchain/variant_shared_library_redirect.gni") |
| import("//src/sys/build/components.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" |
| |
| variant_shared_library_redirect("libvulkan_goldfish") { |
| library = build_libvulkan_goldfish |
| |
| # libvolkan_goldfish.so doesn't build with instrumented variants. |
| exclude_toolchain_tags = [ "instrumented" ] |
| } |
| |
| fuchsia_system_package("goldfish") { |
| package_name = "goldfish-system" |
| deps = [ ":libvulkan_goldfish" ] |
| allowed_in_extra_deps = true |
| } |
| |
| 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}}" ] |
| } |
| } |