| # Copyright 2018 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/package.gni") |
| import("//build/test/test_package.gni") |
| import("//garnet/lib/magma/gnbuild/magma.gni") |
| |
| if (have_prebuilt_libvulkan_arm) { |
| libvulkan_gen_path = "$target_gen_dir/libvulkan" |
| } |
| |
| package("magma-arm-mali") { |
| if (build_msd_arm_mali) { |
| deprecated_system_image = true |
| if (magma_enable_developer_build) { |
| testonly = true |
| } |
| |
| if (magma_enable_developer_build) { |
| deps = [ |
| "//garnet/drivers/gpu/msd-arm-mali:msd_arm_test", |
| ] |
| drivers = [ |
| { |
| name = "libmsd_arm_test.so" |
| }, |
| ] |
| } else { |
| deps = [ |
| "//garnet/drivers/gpu/msd-arm-mali:msd_arm", |
| ] |
| drivers = [ |
| { |
| name = "libmsd_arm.so" |
| }, |
| ] |
| } |
| |
| if (have_libvulkan) { |
| icd_list = [] |
| |
| if (build_libvulkan != []) { |
| foreach(entry, build_libvulkan) { |
| dir = get_label_info(entry, "dir") |
| if (dir == "//third_party/arm-mali-midgard/fuchsia" || |
| dir == "//third_party/arm-mali-bifrost/fuchsia") { |
| deps += [ entry ] |
| icd_list += [ |
| { |
| name = get_label_info(entry, "name") |
| }, |
| ] |
| } |
| } |
| } else if (have_prebuilt_libvulkan_arm) { |
| deps += [ ":prebuilt_libvulkan" ] |
| icd_list += [ |
| { |
| name = "libvulkan_arm" |
| library_path = "$libvulkan_gen_path/libvulkan_arm.so" |
| }, |
| ] |
| } |
| |
| foreach(entry, icd_list) { |
| icd_name = entry.name |
| filename = "$target_gen_dir/vulkan/icd.d/$icd_name.json" |
| icd_data = [] |
| icd_data = [ |
| "{", |
| "\"file_format_version\": \"1.0.0\",", |
| "\"ICD\": {", |
| "\"library_path\": \"$icd_name.so\",", |
| "\"api_version\": \"1.0.68\"", |
| "}", |
| "}", |
| ] |
| write_file(filename, icd_data) |
| } |
| |
| resources = [] |
| libraries = [] |
| |
| foreach(entry, icd_list) { |
| icd_name = entry.name |
| resources += [ |
| { |
| path = rebase_path("$target_gen_dir/vulkan/icd.d/$icd_name.json") |
| dest = "vulkan/icd.d/$icd_name.json" |
| }, |
| ] |
| if (defined(entry.library_path)) { |
| libraries += [ |
| { |
| source = entry.library_path |
| name = "$icd_name.so" |
| }, |
| ] |
| } else { |
| libraries += [ |
| { |
| name = "$icd_name.so" |
| }, |
| ] |
| } |
| } |
| } |
| } |
| } |
| |
| if (have_prebuilt_libvulkan_arm) { |
| config("libvulkan_config") { |
| libs = [ "vulkan_arm" ] |
| lib_dirs = [ libvulkan_gen_path ] |
| } |
| copy("prebuilt_libvulkan") { |
| public_configs = [ ":libvulkan_config" ] |
| sources = [ |
| prebuilt_libvulkan_arm_path, |
| ] |
| outputs = [ |
| "$libvulkan_gen_path/libvulkan_arm.so", |
| ] |
| deps = [ |
| "//third_party/zlib", |
| ] |
| } |
| } |
| |
| test_package("msd_arm_mali_nonhardware_tests") { |
| tests = [] |
| if (build_msd_arm_mali) { |
| deps = [ |
| "//garnet/drivers/gpu/msd-arm-mali:tests", |
| ] |
| |
| tests += [ |
| { |
| name = "msd_arm_mali_nonhardware_tests" |
| }, |
| ] |
| } |
| } |
| |
| # Run with autorun or "run_test_component msd_arm_mali_integration_tests" |
| test_package("msd-arm-mali-integration-tests") { |
| tests = [] |
| |
| if (build_msd_arm_mali) { |
| deps = [ |
| "//garnet/drivers/gpu/msd-arm-mali/tests/integration", |
| ] |
| |
| tests += [ |
| { |
| name = "msd_arm_mali_integration_tests" |
| }, |
| ] |
| } |
| } |
| |
| package("autorun") { |
| testonly = true |
| deprecated_system_image = true |
| |
| if (build_msd_arm_mali) { |
| deps = [ |
| ":autorun_mali", |
| ] |
| |
| binaries = [ |
| { |
| name = "autorun_mali" |
| dest = "magma_autorun" |
| }, |
| ] |
| } |
| } |
| |
| copy("autorun_mali") { |
| sources = [ |
| "//garnet/lib/magma/scripts/autorun_mali", |
| ] |
| outputs = [ |
| "$root_out_dir/autorun_mali", |
| ] |
| } |