1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package { 18 // See: http://go/android-license-faq 19 default_applicable_licenses: ["hardware_google_gfxstream_license"], 20} 21 22genrule { 23 name: "gfxstream_vk_entrypoints_header", 24 srcs: [":libmesa_vulkan_xml_gfxstream"], 25 out: ["gfxstream_vk_entrypoints.h"], 26 tools: ["vk_entrypoints_gen_gfxstream"], 27 cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " + 28 "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " + 29 "$(location gfxstream_vk_entrypoints.h) --out-c " + 30 "$(genDir)/placeholder.c --prefix gfxstream_vk --beta false", 31} 32 33genrule { 34 name: "gfxstream_vk_entrypoints_impl", 35 srcs: [":libmesa_vulkan_xml_gfxstream"], 36 out: ["gfxstream_vk_entrypoints.c"], 37 tools: ["vk_entrypoints_gen_gfxstream"], 38 cmd: "python3 $(location vk_entrypoints_gen_gfxstream) --xml " + 39 "$(location :libmesa_vulkan_xml_gfxstream) --proto --weak --out-h " + 40 "$(genDir)/gfxstream_vk_entrypoints.h --out-c " + 41 "$(location gfxstream_vk_entrypoints.c) --prefix gfxstream_vk " + 42 "--beta false", 43} 44 45cc_library_static { 46 name: "libgfxstream_guest_vulkan_entrypoints", 47 host_supported: true, 48 vendor: true, 49 defaults: [ 50 "mesa_common_defaults_gfxstream", 51 ], 52 header_libs: [ 53 "mesa_common_headers_gfxstream", 54 ], 55 static_libs: [ 56 "libmesa_vulkan_util_gfxstream", 57 ], 58 shared_libs: [ 59 "libcutils", 60 ], 61 generated_headers: [ 62 "gfxstream_vk_entrypoints_header", 63 ], 64 generated_sources: [ 65 "gfxstream_vk_entrypoints_impl", 66 ], 67 ldflags: [ 68 "-Wl,-Bsymbolic", 69 "-Wl,--gc-sections", 70 ], 71 export_generated_headers: [ 72 "gfxstream_vk_entrypoints_header", 73 ], 74} 75 76cc_library_headers { 77 name: "vulkan_enc_headers", 78 export_include_dirs: ["."], 79 host_supported: true, 80 vendor_available: true, 81} 82 83filegroup { 84 name: "vulkan_enc_impl", 85 srcs: [ 86 "AndroidHardwareBuffer.cpp", 87 "CommandBufferStagingStream.cpp", 88 "DescriptorSetVirtualization.cpp", 89 "func_table.cpp", 90 "goldfish_vk_counting_guest.cpp", 91 "goldfish_vk_deepcopy_guest.cpp", 92 "goldfish_vk_extension_structs_guest.cpp", 93 "goldfish_vk_marshaling_guest.cpp", 94 "goldfish_vk_reserved_marshaling_guest.cpp", 95 "goldfish_vk_transform_guest.cpp", 96 "HostVisibleMemoryVirtualization.cpp", 97 "Resources.cpp", 98 "ResourceTracker.cpp", 99 "Validation.cpp", 100 "VkEncoder.cpp", 101 "VulkanHandleMapping.cpp", 102 "VulkanStreamGuest.cpp", 103 "gfxstream_vk_private.cpp", 104 ], 105} 106 107cc_defaults { 108 name: "libgfxstream_guest_vulkan_encoder_defaults", 109 host_supported: true, 110 vendor: true, 111 defaults: [ 112 "libgfxstream_guest_cc_defaults", 113 ], 114 header_libs: [ 115 "libgfxstream_vulkan_headers", 116 "libOpenglSystemCommonHeaders", 117 "libgfxstream_guest_iostream", 118 "libnativewindow_headers", 119 "mesa_common_headers_gfxstream", 120 ], 121 generated_headers: [ 122 "vk_cmd_queue_header_gfxstream", 123 "vk_physical_device_features_header_gfxstream", 124 "vk_physical_device_properties_header_gfxstream", 125 "u_format_pack_header_gfxstream", 126 ], 127 shared_libs: [ 128 "libcutils", 129 "liblog", 130 "libOpenglCodecCommon", 131 ], 132 static_libs: [ 133 "libarect", 134 "libdrm", 135 "libgfxstream_androidemu_static", 136 "libGoldfishAddressSpace", 137 "libmesa_vulkan_util_gfxstream", 138 "libmesa_vulkan_runtime_gfxstream", 139 "libgfxstream_guest_android", 140 "libgfxstream_guest_vulkan_entrypoints", 141 "libmesa_util_gfxstream", 142 "libmesa_util_format_gfxstream", 143 "libmesa_util_c11_gfxstream", 144 ], 145 cflags: [ 146 "-DLOG_TAG=\"goldfish_vulkan\"", 147 "-DVK_ANDROID_native_buffer", 148 "-DVK_EXT_device_memory_report", 149 "-DVK_GOOGLE_gfxstream", 150 "-DVK_NO_PROTOTYPES", 151 "-DVK_USE_PLATFORM_ANDROID_KHR", 152 "-fstrict-aliasing", 153 "-Werror", 154 "-Wno-missing-field-initializers", 155 "-Wno-unused-parameter", 156 "-DHAVE_PTHREAD=1", 157 "-DHAVE_TIMESPEC_GET", 158 "-DHAVE_STRUCT_TIMESPEC", 159 ], 160 srcs: [ 161 ":vulkan_enc_impl", 162 ], 163 export_include_dirs: [ 164 ".", 165 ], 166 ldflags: [ 167 // Mesa always adds Bsymbolic when available (see 'ld_args_bsymbolic' in Meson build). Duplicate that 168 // behavior here. '--gc-sections' has stronger justification: this lets drivers drop 169 // shared code unused by that specific driver (particularly relevant for Vulkan drivers). 170 "-Wl,-Bsymbolic", 171 "-Wl,--gc-sections", 172 ], 173 target: { 174 android: { 175 shared_libs: [ 176 "libnativewindow", 177 ], 178 header_libs: [ 179 "hwvulkan_headers", 180 ], 181 }, 182 }, 183} 184 185cc_library_static { 186 name: "libvulkan_enc", 187 defaults: [ 188 "libgfxstream_guest_vulkan_encoder_defaults", 189 ], 190 static_libs: [ 191 "libplatform", 192 ], 193} 194 195cc_library_static { 196 name: "libgfxstream_guest_vulkan_encoder_with_host", 197 defaults: [ 198 "libgfxstream_guest_vulkan_encoder_defaults", 199 ], 200 static_libs: [ 201 "libgfxstream_platform_rutabaga", 202 ], 203 export_static_lib_headers: [ 204 "libgfxstream_platform_rutabaga", 205 ], 206 target: { 207 host: { 208 compile_multilib: "64", 209 }, 210 android: { 211 compile_multilib: "64", 212 }, 213 }, 214} 215