1# Copyright 2019 Google LLC. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5assert(is_fuchsia) 6 7import("${skia_root_dir}/build/fuchsia/sdk.gni") 8 9pkg_dir = target_gen_dir 10pkg_name = "skqp_pkg" 11 12fuchsia_package(pkg_name) { 13 testonly = true 14 name = pkg_name 15 version = 0 16 deps = [ 17 "${skia_root_dir}/:skqp", 18 "${skia_root_dir}/build/fuchsia", 19 ] 20 pkg_manifest = "${pkg_dir}/${target_name}.manifest" 21} 22 23fuchsia_repo("skqp_repo") { 24 testonly = true 25 deps = [ 26 ":append_assets_to_manifest", 27 ":base_manifest", 28 ":skqp_pkg", 29 ] 30 31 # Put repo directory in out dir (not gen dir). 32 repo = "$target_out_dir/skqp_repo" 33 archives = [ "$root_out_dir/far/skqp_pkg.far" ] 34} 35 36# 37# Base manifest entries (w/o assets) for SKQP. 38# 39# TODO(rosasco): Convert this group() to generated_file() when a 40# sufficiently modern version of gn rolls in. 41group("base_manifest") { 42 base_pkg_manifest = "${pkg_dir}/base_${pkg_name}.manifest" 43 44 skqp_exec = rebase_path("${root_out_dir}/skqp") 45 skqp_path = rebase_path("${target_gen_dir}") 46 47 sdk_dist_path = rebase_path("${fuchsia_sdk_path}/arch/${target_cpu}/dist") 48 sdk_sysroot_dist_path = 49 rebase_path("${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/dist/lib") 50 layer_path = rebase_path("${fuchsia_sdk_path}/pkg/vulkan_layers") 51 52 skqp_component_manifest = rebase_path("${skia_root_dir}/build/fuchsia/skqp/skqp.cmx") 53 54 if (target_cpu == "x64" || target_cpu == "x86_64") { 55 clang_path = 56 rebase_path("${fuchsia_toolchain_path}/lib/x86_64-unknown-fuchsia/c++") 57 } else if (target_cpu == "arm64") { 58 clang_path = 59 rebase_path("${fuchsia_toolchain_path}/lib/aarch64-unknown-fuchsia/c++") 60 } else { 61 assert(false, "Unknown target cpu for Fuchsia target.") 62 } 63 64 manifest_entries = [ 65 # Binary 66 "bin/skqp=${skqp_exec}", 67 68 # Meta Data 69 "meta/package=${skqp_path}/meta/package", 70 "meta/skqp.cmx=${skqp_component_manifest}", 71 72 # Shared Libs (clang c++) 73 "lib/libc++.so.2=${clang_path}/libc++.so.2", 74 "lib/libc++abi.so.1=${clang_path}/libc++abi.so.1", 75 "lib/libunwind.so.1=${clang_path}/libunwind.so.1", 76 77 # Shared Libs (sdk dist) 78 "lib/libasync-default.so=${sdk_dist_path}/libasync-default.so", 79 "lib/libfdio.so=${sdk_dist_path}/libfdio.so", 80 "lib/libtrace-engine.so=${sdk_dist_path}/libtrace-engine.so", 81 82 # Loader 83 "lib/ld.so.1=${sdk_sysroot_dist_path}/ld.so.1", 84 85 # Vulkan ICD / Validation / Loader 86 "lib/libvulkan.so=${sdk_dist_path}/libvulkan.so", 87 "lib/VkLayer_khronos_validation.so=${sdk_dist_path}/VkLayer_khronos_validation.so", 88 89 "data/vulkan/explicit_layer.d/VkLayer_khronos_validation.json=${layer_path}/data/vulkan/explicit_layer.d/VkLayer_khronos_validation.json", 90 ] 91 92 # TODO(rosasco): Add 2 lines when generated_file() switch is implemented 93 # and remove the 'write_file' below. 94 # contents = manifest_entries 95 # outputs = [ base_pkg_manifest ] 96 97 write_file(base_pkg_manifest, manifest_entries) 98} 99 100# 101# Asset manifest entries for SKQP. 102# 103action("append_assets_to_manifest") { 104 script = "append_assets_to_manifest" 105 106 base_pkg_manifest = "${pkg_dir}/base_${pkg_name}.manifest" 107 pkg_manifest = "${pkg_dir}/${pkg_name}.manifest" 108 assets_path = "${skia_root_dir}/platform_tools/android/apps/skqp/src/main/assets" 109 110 inputs = [ assets_path ] 111 112 outputs = [ pkg_manifest ] 113 114 manifest_deps = "$target_out_dir/skqp_manifest.d" 115 116 args = [ 117 "--root_dir", 118 rebase_path(assets_path), 119 "--base_manifest", 120 rebase_path(base_pkg_manifest), 121 "--manifest", 122 rebase_path(pkg_manifest), 123 "--deps", 124 rebase_path(manifest_deps), 125 "--root_build_dir", 126 rebase_path(root_out_dir), 127 ] 128 129 deps = [ ":base_manifest" ] 130 depfile = manifest_deps 131} 132