[vlc-devel] [PATCH 2/4] contrib: add vulkan-loader 1.1.127 rules

Alexandre Janniaux ajanni at videolabs.io
Tue May 5 12:20:16 CEST 2020


Add contrib for building vulkan module for Windows with patches from the
msys2 project.
---
 contrib/src/vulkan-loader/001-build-fix.patch |  43 ++
 .../002-proper-def-files-for-32bit.patch      | 401 ++++++++++++++++++
 .../003-generate-pkgconfig-files.patch        |  18 +
 contrib/src/vulkan-loader/SHA512SUMS          |   1 +
 contrib/src/vulkan-loader/rules.mak           |  53 +++
 5 files changed, 516 insertions(+)
 create mode 100644 contrib/src/vulkan-loader/001-build-fix.patch
 create mode 100644 contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch
 create mode 100644 contrib/src/vulkan-loader/003-generate-pkgconfig-files.patch
 create mode 100644 contrib/src/vulkan-loader/SHA512SUMS
 create mode 100644 contrib/src/vulkan-loader/rules.mak

diff --git a/contrib/src/vulkan-loader/001-build-fix.patch b/contrib/src/vulkan-loader/001-build-fix.patch
new file mode 100644
index 00000000000..944e7500cbc
--- /dev/null
+++ b/contrib/src/vulkan-loader/001-build-fix.patch
@@ -0,0 +1,43 @@
+--- a/loader/CMakeLists.txt	2018-05-16 14:05:33.046991100 +0300
++++ b/loader/CMakeLists.txt	2018-05-16 14:07:39.464013100 +0300
+@@ -86,7 +86,7 @@
+ set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} extensions will suffer from a corrupted stack.")
+ if(WIN32)
+     enable_language(ASM_MASM)
+-    if(CMAKE_ASM_MASM_COMPILER_WORKS)
++    if (MSVC AND CMAKE_ASM_MASM_COMPILER_WORKS)
+         if(NOT CMAKE_CL_64)
+             set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} /safeseh)
+         endif()
+--- a/loader/loader.c	2018-05-16 14:03:52.750814700 +0300
++++ b/loader/loader.c	2018-05-16 14:04:08.631642600 +0300
+@@ -672,6 +672,10 @@
+ //
+ // *reg_data contains a string list of filenames as pointer.
+ // When done using the returned string list, the caller should free the pointer.
++#ifdef __MINGW32__
++#define CM_GETIDLIST_FILTER_PRESENT            0x00000100
++#define CM_GETIDLIST_FILTER_CLASS              0x00000200
++#endif
+ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char **reg_data, PDWORD reg_data_size,
+                                       LPCSTR value_name) {
+     static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}";
+--- a/loader/loader.rc
++++ b/loader/loader.rc
+@@ -43,8 +43,6 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-#include "winres.h"
+-
+ #define VER_FILE_VERSION            VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_BUILDNO
+ 
+ #define STRINGIZE2(s) #s
+@@ -77,7 +75,6 @@
+ #endif
+ 
+  FILEOS 0x00000L
+- FILETYPE VFT_DLL
+  FILESUBTYPE 0x0L
+ BEGIN
+     BLOCK "StringFileInfo"
diff --git a/contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch b/contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch
new file mode 100644
index 00000000000..1f722974f45
--- /dev/null
+++ b/contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch
@@ -0,0 +1,401 @@
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/CMakeLists.txt Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/CMakeLists.txt
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/CMakeLists.txt	2017-04-05 00:36:39.000000000 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/CMakeLists.txt	2017-06-29 08:34:52.393725000 +0300
+@@ -153,6 +153,16 @@
+     endif()
+ endif()
+ 
++if (WIN32)
++  if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
++    set(DEFFILE_SUFFIX "")
++    set(WINBITS Win64)
++  else()
++    set(DEFFILE_SUFFIX "-x86")
++    set(WINBITS Win32)
++  endif()
++endif()
++
+ if(MSVC)
+     # /WX: Treat warnings as errors
+     # /GR-: Disable RTTI
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/CMakeLists.txt Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/CMakeLists.txt
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/CMakeLists.txt	2017-06-29 08:19:36.448133100 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/CMakeLists.txt	2017-06-29 08:42:41.322355600 +0300
+@@ -137,6 +137,7 @@
+ set_target_properties(loader_gen_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER})
+ 
+ if(WIN32)
++    if(MSVC)
+     # Use static MSVCRT libraries
+     foreach(configuration
+             in
+@@ -156,6 +157,7 @@
+                            "${${configuration}}")
+         endif()
+     endforeach()
++    endif()
+ 
+     if(ENABLE_WIN10_ONECORE)
+         # Note: When linking your app or driver to OneCore.lib, be sure to remove any links to non-umbrella libs (such as
+@@ -190,24 +192,32 @@
+                     $<TARGET_OBJECTS:loader-opt>
+                     $<TARGET_OBJECTS:loader-norm>
+                     $<TARGET_OBJECTS:loader-unknown-chain>
+-                    ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def
++                    ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1${DEFFILE_SUFFIX}.def
+                     ${CMAKE_CURRENT_SOURCE_DIR}/loader.rc)
++        if(MSVC)
+         set_target_properties(vulkan
+                               PROPERTIES LINK_FLAGS_DEBUG
+                                          "/ignore:4098"
+                                          OUTPUT_NAME
+                                          vulkan-1)
++        else()
++        set_target_properties(vulkan
++                              PROPERTIES
++                              LIBRARY_OUTPUT_NAME vulkan
++                              RUNTIME_OUTPUT_NAME vulkan-1
++                              ARCHIVE_OUTPUT_NAME vulkan)
++        endif()
+         target_link_libraries(vulkan Vulkan::Headers)
+     else()
+         add_library(vulkan
+                     STATIC
+                     $<TARGET_OBJECTS:loader-opt>
+                     $<TARGET_OBJECTS:loader-norm>
+                     $<TARGET_OBJECTS:loader-unknown-chain>)
+         set_target_properties(vulkan PROPERTIES OUTPUT_NAME VKstatic.1)
+     endif()
+ 
+-    if(ENABLE_WIN10_ONECORE)
++    if(ENABLE_WIN10_ONECORE AND MSVC)
+         target_link_libraries(vulkan OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB)
+         set_target_properties(vulkan PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
+     else()
+--- Vulkan-LoaderAndValidationLayers-sdk-1.1.73.0/loader/vulkan-1.def.orig	2018-05-16 11:55:36.673944400 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.1.73.0/loader/vulkan-1.def	2018-05-16 11:55:41.307152500 +0300
+@@ -21,7 +21,7 @@
+ ;
+ ;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ 
+-LIBRARY vulkan-1.dll
++LIBRARY libvulkan-1.dll
+ EXPORTS
+    vkCreateInstance
+    vkDestroyInstance
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/vulkan-1-x86.def Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/vulkan-1-x86.def
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/vulkan-1-x86.def	1970-01-01 03:00:00.000000000 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/vulkan-1-x86.def	2017-04-05 00:36:39.000000000 +0300
+@@ -0,0 +1,221 @@
++
++;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++;
++; Copyright (c) 2015-2017 The Khronos Group Inc.
++; Copyright (c) 2015-2017 Valve Corporation
++; Copyright (c) 2015-2017 LunarG, Inc.
++;
++; Licensed under the Apache License, Version 2.0 (the "License");
++; you may not use this file except in compliance with the License.
++; You may obtain a copy of the License at
++;
++;     http://www.apache.org/licenses/LICENSE-2.0
++;
++; Unless required by applicable law or agreed to in writing, software
++; distributed under the License is distributed on an "AS IS" BASIS,
++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++; See the License for the specific language governing permissions and
++; limitations under the License.
++;
++;  Author: Courtney Goeltzenleuchter <courtney at LunarG.com>
++;
++;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
++LIBRARY libvulkan-1.dll
++EXPORTS
++   vkCreateInstance at 12
++   vkDestroyInstance at 8
++   vkEnumeratePhysicalDevices at 12
++   vkGetPhysicalDeviceFeatures at 8
++   vkGetPhysicalDeviceFormatProperties at 12
++   vkGetPhysicalDeviceImageFormatProperties at 28
++   vkGetPhysicalDeviceProperties at 8
++   vkGetPhysicalDeviceQueueFamilyProperties at 12
++   vkGetPhysicalDeviceMemoryProperties at 8
++   vkGetInstanceProcAddr at 8
++   vkGetDeviceProcAddr at 8
++   vkCreateDevice at 16
++   vkDestroyDevice at 8
++   vkEnumerateInstanceExtensionProperties at 12
++   vkEnumerateDeviceExtensionProperties at 16
++   vkEnumerateInstanceLayerProperties at 8
++   vkEnumerateDeviceLayerProperties at 12
++   vkGetDeviceQueue at 16
++   vkQueueSubmit at 20
++   vkQueueWaitIdle at 4
++   vkDeviceWaitIdle at 4
++   vkAllocateMemory at 16
++   vkFreeMemory at 16
++   vkMapMemory at 36
++   vkUnmapMemory at 12
++   vkFlushMappedMemoryRanges at 12
++   vkInvalidateMappedMemoryRanges at 12
++   vkGetDeviceMemoryCommitment at 16
++   vkBindBufferMemory at 28
++   vkBindImageMemory at 28
++   vkGetBufferMemoryRequirements at 16
++   vkGetImageMemoryRequirements at 16
++   vkGetImageSparseMemoryRequirements at 20
++   vkGetPhysicalDeviceSparseImageFormatProperties at 32
++   vkQueueBindSparse at 20
++   vkCreateFence at 16
++   vkDestroyFence at 16
++   vkResetFences at 12
++   vkGetFenceStatus at 12
++   vkWaitForFences at 24
++   vkCreateSemaphore at 16
++   vkDestroySemaphore at 16
++   vkCreateEvent at 16
++   vkDestroyEvent at 16
++   vkGetEventStatus at 12
++   vkSetEvent at 12
++   vkResetEvent at 12
++   vkCreateQueryPool at 16
++   vkDestroyQueryPool at 16
++   vkGetQueryPoolResults at 40
++   vkCreateBuffer at 16
++   vkDestroyBuffer at 16
++   vkCreateBufferView at 16
++   vkDestroyBufferView at 16
++   vkCreateImage at 16
++   vkDestroyImage at 16
++   vkGetImageSubresourceLayout at 20
++   vkCreateImageView at 16
++   vkDestroyImageView at 16
++   vkCreateShaderModule at 16
++   vkDestroyShaderModule at 16
++   vkCreatePipelineCache at 16
++   vkDestroyPipelineCache at 16
++   vkGetPipelineCacheData at 20
++   vkMergePipelineCaches at 20
++   vkCreateGraphicsPipelines at 28
++   vkCreateComputePipelines at 28
++   vkDestroyPipeline at 16
++   vkCreatePipelineLayout at 16
++   vkDestroyPipelineLayout at 16
++   vkCreateSampler at 16
++   vkDestroySampler at 16
++   vkCreateDescriptorSetLayout at 16
++   vkDestroyDescriptorSetLayout at 16
++   vkCreateDescriptorPool at 16
++   vkDestroyDescriptorPool at 16
++   vkResetDescriptorPool at 16
++   vkAllocateDescriptorSets at 12
++   vkFreeDescriptorSets at 20
++   vkUpdateDescriptorSets at 20
++   vkCreateFramebuffer at 16
++   vkDestroyFramebuffer at 16
++   vkCreateRenderPass at 16
++   vkDestroyRenderPass at 16
++   vkGetRenderAreaGranularity at 16
++   vkCreateCommandPool at 16
++   vkDestroyCommandPool at 16
++   vkResetCommandPool at 16
++   vkAllocateCommandBuffers at 12
++   vkFreeCommandBuffers at 20
++   vkBeginCommandBuffer at 8
++   vkEndCommandBuffer at 4
++   vkResetCommandBuffer at 8
++   vkCmdBindPipeline at 16
++   vkCmdSetViewport at 16
++   vkCmdSetScissor at 16
++   vkCmdSetLineWidth at 8
++   vkCmdSetDepthBias at 16
++   vkCmdSetBlendConstants at 8
++   vkCmdSetDepthBounds at 12
++   vkCmdSetStencilCompareMask at 12
++   vkCmdSetStencilWriteMask at 12
++   vkCmdSetStencilReference at 12
++   vkCmdBindDescriptorSets at 36
++   vkCmdBindIndexBuffer at 24
++   vkCmdBindVertexBuffers at 20
++   vkCmdDraw at 20
++   vkCmdDrawIndexed at 24
++   vkCmdDrawIndirect at 28
++   vkCmdDrawIndexedIndirect at 28
++   vkCmdDispatch at 16
++   vkCmdDispatchIndirect at 20
++   vkCmdCopyBuffer at 28
++   vkCmdCopyImage at 36
++   vkCmdBlitImage at 40
++   vkCmdCopyBufferToImage at 32
++   vkCmdCopyImageToBuffer at 32
++   vkCmdUpdateBuffer at 32
++   vkCmdFillBuffer at 32
++   vkCmdClearColorImage at 28
++   vkCmdClearDepthStencilImage at 28
++   vkCmdClearAttachments at 20
++   vkCmdResolveImage at 36
++   vkCmdSetEvent at 16
++   vkCmdResetEvent at 16
++   vkCmdWaitEvents at 44
++   vkCmdPipelineBarrier at 40
++   vkCmdBeginQuery at 20
++   vkCmdEndQuery at 16
++   vkCmdResetQueryPool at 20
++   vkCmdWriteTimestamp at 20
++   vkCmdCopyQueryPoolResults at 48
++   vkCmdPushConstants at 28
++   vkCmdBeginRenderPass at 12
++   vkCmdNextSubpass at 8
++   vkCmdEndRenderPass at 4
++   vkCmdExecuteCommands at 12
++   vkDestroySurfaceKHR at 16
++   vkGetPhysicalDeviceSurfaceSupportKHR at 20
++   vkGetPhysicalDeviceSurfaceCapabilitiesKHR at 16
++   vkGetPhysicalDeviceSurfaceFormatsKHR at 20
++   vkGetPhysicalDeviceSurfacePresentModesKHR at 20
++   vkCreateSwapchainKHR at 16
++   vkDestroySwapchainKHR at 16
++   vkGetSwapchainImagesKHR at 20
++   vkAcquireNextImageKHR at 40
++   vkQueuePresentKHR at 8
++   vkGetPhysicalDeviceDisplayPropertiesKHR at 12
++   vkGetPhysicalDeviceDisplayPlanePropertiesKHR at 12
++   vkGetDisplayPlaneSupportedDisplaysKHR at 16
++   vkGetDisplayModePropertiesKHR at 20
++   vkCreateDisplayModeKHR at 24
++   vkGetDisplayPlaneCapabilitiesKHR at 20
++   vkCreateDisplayPlaneSurfaceKHR at 16
++   vkCreateSharedSwapchainsKHR at 20
++   vkCreateWin32SurfaceKHR at 16
++   vkGetPhysicalDeviceWin32PresentationSupportKHR at 8
++
++   vkEnumerateInstanceVersion at 4
++   vkEnumeratePhysicalDeviceGroups at 12
++   vkGetPhysicalDeviceFeatures2 at 8
++   vkGetPhysicalDeviceProperties2 at 8
++   vkGetPhysicalDeviceFormatProperties2 at 12
++   vkGetPhysicalDeviceQueueFamilyProperties2 at 12
++   vkGetPhysicalDeviceMemoryProperties2 at 8
++   vkGetPhysicalDeviceSparseImageFormatProperties2 at 16
++   vkGetPhysicalDeviceExternalBufferProperties at 12
++   vkGetPhysicalDeviceExternalSemaphoreProperties at 12
++   vkGetPhysicalDeviceExternalFenceProperties at 12
++   vkBindBufferMemory2 at 12
++   vkBindImageMemory2 at 12
++   vkGetDeviceGroupPeerMemoryFeatures at 20
++   vkCmdSetDeviceMask at 8
++   vkCmdDispatchBase at 28
++   vkGetImageMemoryRequirements2 at 12
++   vkGetBufferMemoryRequirements2 at 12
++   vkTrimCommandPool at 16
++   vkGetDeviceQueue2 at 12
++   vkCreateSamplerYcbcrConversion at 16
++   vkDestroySamplerYcbcrConversion at 16
++   vkGetDescriptorSetLayoutSupport at 12
++   vkGetDeviceGroupPresentCapabilitiesKHR at 8
++   vkGetDeviceGroupSurfacePresentModesKHR at 16
++   vkGetPhysicalDevicePresentRectanglesKHR at 20
++   vkAcquireNextImage2KHR at 12
++   vkCreateDescriptorUpdateTemplate at 16
++   vkDestroyDescriptorUpdateTemplate at 16
++   vkUpdateDescriptorSetWithTemplate at 24
++
++   vkGetPhysicalDeviceDisplayProperties2KHR at 12
++   vkGetPhysicalDeviceDisplayPlaneProperties2KHR at 12
++   vkGetDisplayModeProperties2KHR at 20
++   vkGetDisplayPlaneCapabilities2KHR at 12
++
++   vkGetImageSparseMemoryRequirements2 at 16
++   vkGetPhysicalDeviceImageFormatProperties2 at 12
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/tests/layers/CMakeLists.txt Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/tests/layers/CMakeLists.txt
+--- Vulkan-LoaderAndValidationLayers-sdk-1.1.73.0-orig/tests/layers/CMakeLists.txt	2017-04-05 00:36:39.000000000 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.1.73.0/tests/layers/CMakeLists.txt	2017-06-29 08:39:07.115088000 +0300
+@@ -19,12 +19,12 @@
+ 
+ if(WIN32)
+     macro(AddVkLayer target)
+-        file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/VkLayer_${target}.def DEF_FILE)
++        file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/VkLayer_${target}${DEFFILE_SUFFIX}.def DEF_FILE)
+         add_custom_target(copy-${target}-def-file ALL
+-                          COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkLayer_${target}.def
++                          COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} VkLayer_${target}${DEFFILE_SUFFIX}.def
+                           VERBATIM)
+         set_target_properties(copy-${target}-def-file PROPERTIES FOLDER ${LOADER_HELPER_FOLDER})
+-        add_library(VkLayer_${target} SHARED ${ARGN} VkLayer_${target}.def)
++        add_library(VkLayer_${target} SHARED ${ARGN} VkLayer_${target}${DEFFILE_SUFFIX}.def)
+         target_compile_options(VkLayer_${target} PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
+         add_dependencies(VkLayer_${target} generate_helper_files)
+     endmacro()
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/tests/layers/VkLayer_test-x86.def Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/tests/layers/VkLayer_test-x86.def
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/tests/layers/VkLayer_test-x86.def	1970-01-01 03:00:00.000000000 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/tests/layers/VkLayer_test-x86.def	2017-04-05 00:36:39.000000000 +0300
+@@ -0,0 +1,32 @@
++; THIS FILE IS GENERATED.  DO NOT EDIT.
++
++;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++; Vulkan
++;
++; Copyright (c) 2015-2016 The Khronos Group Inc.
++; Copyright (c) 2015-2016 Valve Corporation
++; Copyright (c) 2015-2016 LunarG, Inc.
++;
++; Licensed under the Apache License, Version 2.0 (the "License");
++; you may not use this file except in compliance with the License.
++; You may obtain a copy of the License at
++;
++;     http://www.apache.org/licenses/LICENSE-2.0
++;
++; Unless required by applicable law or agreed to in writing, software
++; distributed under the License is distributed on an "AS IS" BASIS,
++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++; See the License for the specific language governing permissions and
++; limitations under the License.
++;
++;  Author: Courtney Goeltzenleuchter <courtney at LunarG.com>
++;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
++; The following is required on Windows, for exporting symbols from the DLL
++
++LIBRARY VkLayer_test
++EXPORTS
++vkGetInstanceProcAddr at 8
++vkGetDeviceProcAddr at 8
++vkEnumerateInstanceLayerProperties at 8
++vkEnumerateInstanceExtensionProperties at 12
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/tests/layers/VkLayer_wrap_objects-x86.def Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/tests/layers/VkLayer_wrap_objects-x86.def
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/tests/layers/VkLayer_wrap_objects-x86.def	1970-01-01 03:00:00.000000000 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/tests/layers/VkLayer_wrap_objects-x86.def	2017-04-05 00:36:39.000000000 +0300
+@@ -0,0 +1,32 @@
++; THIS FILE IS GENERATED.  DO NOT EDIT.
++
++;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++; Vulkan
++;
++; Copyright (c) 2015-2016 The Khronos Group Inc.
++; Copyright (c) 2015-2016 Valve Corporation
++; Copyright (c) 2015-2016 LunarG, Inc.
++;
++; Licensed under the Apache License, Version 2.0 (the "License");
++; you may not use this file except in compliance with the License.
++; You may obtain a copy of the License at
++;
++;     http://www.apache.org/licenses/LICENSE-2.0
++;
++; Unless required by applicable law or agreed to in writing, software
++; distributed under the License is distributed on an "AS IS" BASIS,
++; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++; See the License for the specific language governing permissions and
++; limitations under the License.
++;
++;  Author: Courtney Goeltzenleuchter <courtney at LunarG.com>
++;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
++; The following is required on Windows, for exporting symbols from the DLL
++
++LIBRARY VkLayer_wrap_objects
++EXPORTS
++vkGetInstanceProcAddr at 8
++vkGetDeviceProcAddr at 8
++vkEnumerateInstanceLayerProperties at 8
++vkEnumerateInstanceExtensionProperties at 12
diff --git a/contrib/src/vulkan-loader/003-generate-pkgconfig-files.patch b/contrib/src/vulkan-loader/003-generate-pkgconfig-files.patch
new file mode 100644
index 00000000000..770079b3de1
--- /dev/null
+++ b/contrib/src/vulkan-loader/003-generate-pkgconfig-files.patch
@@ -0,0 +1,18 @@
+diff -Naur Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/CMakeLists.txt Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/CMakeLists.txt
+--- Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0-orig/loader/CMakeLists.txt	2017-06-29 08:19:36.448133100 +0300
++++ Vulkan-LoaderAndValidationLayers-sdk-1.0.46.0/loader/CMakeLists.txt	2017-06-29 08:42:41.322355600 +0300
+@@ -286,6 +286,7 @@
+     if(INSTALL_LVL_FILES)
+         install(TARGETS ${API_LOWERCASE} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+     endif()
++endif()
+ 
+     if(NOT APPLE)
+         # Generate pkg-config file.
+@@ -302,6 +302,5 @@
+             endif()
+         endif()
+     endif()
+-endif()
+ 
+ 
diff --git a/contrib/src/vulkan-loader/SHA512SUMS b/contrib/src/vulkan-loader/SHA512SUMS
new file mode 100644
index 00000000000..7fd4dbbba8c
--- /dev/null
+++ b/contrib/src/vulkan-loader/SHA512SUMS
@@ -0,0 +1 @@
+59afc74b83050bd21186dc7a58f7d39350796ddd4cfdf9975dcf7c5d525f1e318acd204dc2a796b6286d24c2b928c3ccaa76563ce2bfedcbcfeaf68e70a88116  Vulkan-Loader-1.1.127.tar.gz
diff --git a/contrib/src/vulkan-loader/rules.mak b/contrib/src/vulkan-loader/rules.mak
new file mode 100644
index 00000000000..1930ad563be
--- /dev/null
+++ b/contrib/src/vulkan-loader/rules.mak
@@ -0,0 +1,53 @@
+VULKAN_LOADER_VERSION := 1.1.127
+VULKAN_LOADER_URL := https://github.com/KhronosGroup/Vulkan-Loader/archive/v$(VULKAN_LOADER_VERSION).tar.gz
+VULKAN_LOADER_ARCHIVE := Vulkan-Loader-$(VULKAN_LOADER_VERSION).tar.gz
+
+DEPS_vulkan-loader = vulkan-headers $(DEPS_vulkan-headers)
+
+# On WIN32 platform, we don't know where to find the loader
+# so always build it for the Vulkan module.
+ifdef HAVE_WIN32
+PKGS += vulkan-loader
+ifeq ($(call need_pkg,"vulkan"),)
+PKGS_FOUND += vulkan-loader
+endif
+endif
+
+VULKAN_LOADER_CONF := \
+	-DENABLE_STATIC_LOADER=ON \
+	-DBUILD_SHARED_LIBS=OFF \
+	-DBUILD_TESTS=OFF \
+	-DBUILD_LOADER=ON
+
+$(TARBALLS)/$(VULKAN_LOADER_ARCHIVE):
+	$(call download_pkg,$(VULKAN_LOADER_URL),vulkan-loader)
+
+.sum-vulkan-loader: $(VULKAN_LOADER_ARCHIVE)
+
+vulkan-loader: $(VULKAN_LOADER_ARCHIVE) .sum-vulkan-loader
+	$(UNPACK)
+	# Patches are from msys2 package system
+	# https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-loader
+	cd $(UNPACK_DIR) && patch -p1 -i ../$(SRC)/vulkan-loader/001-build-fix.patch
+	cd $(UNPACK_DIR) && patch -p1 -i ../$(SRC)/vulkan-loader/002-proper-def-files-for-32bit.patch
+	cd $(UNPACK_DIR) && patch -p1 -i ../$(SRC)/vulkan-loader/003-generate-pkgconfig-files.patch
+	$(MOVE)
+
+# Needed for the loader's cmake script to find the registry files
+VULKAN_LOADER_ENV_CONF = \
+	VULKAN_HEADERS_INSTALL_DIR="$(PREFIX)"
+
+.vulkan-loader: vulkan-loader toolchain.cmake
+ifndef HAVE_WIN32
+	$(error vulkan-loader contrib can only be used on WIN32 targets)
+endif
+	cd $< && rm -rf ./build && mkdir -p build
+	cd $</build && $(VULKAN_LOADER_ENV_CONF) $(HOSTVARS) \
+		$(CMAKE) $(VULKAN_LOADER_CONF) ..
+	cd $</build && $(MAKE)
+	# CMake will generate a .pc file with -lvulkan even if the static library
+	# generated is libVKstatic.1.a. It also forget to link with libcfgmgr32.
+	cd $< && sed -i.orig -e "s,-lvulkan,-lVKstatic.1 -lcfgmgr32," build/loader/vulkan.pc
+	$(call pkg_static,"build/loader/vulkan.pc")
+	cd $</build && $(MAKE) install
+	touch $@
-- 
2.26.2



More information about the vlc-devel mailing list