From 68877059b1f3a79159cc192382ee2d6d2ca406e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 Nov 2021 13:36:32 +0100 Subject: [PATCH] build: Cross-compile Vulkan Loader with Vulkan and SPIRV Headers. --- build/makefile_base.mak | 25 ++++++++++++++++++++----- make/rules-cmake.mk | 8 ++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 69bb1dd7..993299ce 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -575,8 +575,8 @@ $(eval $(call rules-cmake,jxrlib,64)) ## $(eval $(call rules-source,vulkan-headers,$(SRCDIR)/Vulkan-Headers)) -$(eval $(call rules-cmake,vulkan-headers,32)) -$(eval $(call rules-cmake,vulkan-headers,64)) +$(eval $(call rules-cmake,vulkan-headers,32,CROSS)) +$(eval $(call rules-cmake,vulkan-headers,64,CROSS)) ## @@ -584,8 +584,23 @@ $(eval $(call rules-cmake,vulkan-headers,64)) ## $(eval $(call rules-source,spirv-headers,$(SRCDIR)/SPIRV-Headers)) -$(eval $(call rules-cmake,spirv-headers,32)) -$(eval $(call rules-cmake,spirv-headers,64)) +$(eval $(call rules-cmake,spirv-headers,32,CROSS)) +$(eval $(call rules-cmake,spirv-headers,64,CROSS)) + + +## +## Vulkan-Loader +## + +VULKAN_LOADER_CMAKE_ARGS = -DUSE_MASM=OFF +VULKAN_LOADER_CMAKE_ARGS64 = -DVULKAN_HEADERS_INSTALL_DIR=$(VULKAN_HEADERS_DST64) +VULKAN_LOADER_CMAKE_ARGS32 = -DVULKAN_HEADERS_INSTALL_DIR=$(VULKAN_HEADERS_DST32) +VULKAN_LOADER_CFLAGS = -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 # 0x0A00 is _WIN32_WINNT_WIN10 +VULKAN_LOADER_DEPENDS = vulkan-headers spirv-headers + +$(eval $(call rules-source,vulkan-loader,$(SRCDIR)/Vulkan-Loader)) +$(eval $(call rules-cmake,vulkan-loader,32,CROSS)) +$(eval $(call rules-cmake,vulkan-loader,64,CROSS)) ## @@ -805,7 +820,7 @@ VKD3D_LDFLAGS = -static-libgcc $(CROSSLDFLAGS) VKD3D_LDFLAGS32 = -L$(WINE_OBJ32)/dlls/vulkan-1/ VKD3D_LDFLAGS64 = -L$(WINE_OBJ64)/dlls/vulkan-1/ -VKD3D_DEPENDS = wine vulkan-headers spirv-headers +VKD3D_DEPENDS = wine vulkan-loader vulkan-headers spirv-headers $(eval $(call rules-source,vkd3d,$(SRCDIR)/vkd3d)) $(eval $(call rules-autoconf,vkd3d,32,CROSS)) diff --git a/make/rules-cmake.mk b/make/rules-cmake.mk index 4c61951f..0e18df97 100644 --- a/make/rules-cmake.mk +++ b/make/rules-cmake.mk @@ -2,9 +2,10 @@ # $(1): lowercase package name # $(2): uppercase package name # $(3): 32/64, build type +# $(4): CROSS/, cross compile # define create-rules-cmake -$(call create-rules-common,$(1),$(2),$(3)) +$(call create-rules-common,$(1),$(2),$(3),$(4)) ifeq ($(CONTAINER),1) $$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/CMakeLists.txt @@ -16,6 +17,9 @@ $$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/CMakeLists.txt -DCMAKE_INSTALL_PREFIX="$$($(2)_DST$(3))" \ -DCMAKE_INSTALL_LIBDIR="lib$(subst 32,,$(3))" \ -DCMAKE_BUILD_TYPE=plain \ + -DCMAKE_SYSTEM_NAME=$(if $(4),Windows,Linux) \ + -DCMAKE_SHARED_LIBRARY_PREFIX_C=$(if $(4),,lib) \ + -DCMAKE_IMPORT_LIBRARY_PREFIX_C=$(if $(4),,lib) \ $$($(2)_CMAKE_ARGS) \ $$($(2)_CMAKE_ARGS$(3)) @@ -31,4 +35,4 @@ $$(OBJ)/.$(1)-build$(3): endif endef -rules-cmake = $(call create-rules-cmake,$(1),$(call toupper,$(1)),$(2)) +rules-cmake = $(call create-rules-cmake,$(1),$(call toupper,$(1)),$(2),$(3))