build: Better support meson cross compilation.
This commit is contained in:
parent
5b8a6c72f9
commit
587f86fb9d
3 changed files with 55 additions and 30 deletions
|
@ -739,16 +739,12 @@ $(OBJ)/.vrclient-post-source:
|
|||
## dxvk
|
||||
##
|
||||
|
||||
DXVK_MESON_ARGS32 = \
|
||||
--bindir=$(DXVK_DST32)/lib/wine/dxvk \
|
||||
--cross-file=$(DXVK_OBJ32)/build-win32.txt
|
||||
DXVK_MESON_ARGS64 = \
|
||||
--bindir=$(DXVK_DST64)/lib64/wine/dxvk \
|
||||
--cross-file=$(DXVK_OBJ64)/build-win64.txt
|
||||
DXVK_MESON_ARGS32 = --bindir=$(DXVK_DST32)/lib/wine/dxvk
|
||||
DXVK_MESON_ARGS64 = --bindir=$(DXVK_DST64)/lib64/wine/dxvk
|
||||
|
||||
$(eval $(call rules-source,dxvk,$(SRCDIR)/dxvk))
|
||||
$(eval $(call rules-meson,dxvk,32))
|
||||
$(eval $(call rules-meson,dxvk,64))
|
||||
$(eval $(call rules-meson,dxvk,32,CROSS))
|
||||
$(eval $(call rules-meson,dxvk,64,CROSS))
|
||||
|
||||
$(OBJ)/.dxvk-post-build64:
|
||||
mkdir -p "$(DST_DIR)"/lib64/wine/dxvk
|
||||
|
@ -765,16 +761,12 @@ $(OBJ)/.dxvk-post-build32:
|
|||
## dxvk-nvapi
|
||||
##
|
||||
|
||||
DXVK_NVAPI_MESON_ARGS32 = \
|
||||
--bindir=$(DXVK_NVAPI_DST32)/lib/wine/nvapi \
|
||||
--cross-file=$(DXVK_NVAPI_OBJ32)/build-win32.txt
|
||||
DXVK_NVAPI_MESON_ARGS64 = \
|
||||
--bindir=$(DXVK_NVAPI_DST64)/lib64/wine/nvapi \
|
||||
--cross-file=$(DXVK_NVAPI_OBJ64)/build-win64.txt
|
||||
DXVK_NVAPI_MESON_ARGS32 = --bindir=$(DXVK_NVAPI_DST32)/lib/wine/nvapi
|
||||
DXVK_NVAPI_MESON_ARGS64 = --bindir=$(DXVK_NVAPI_DST64)/lib64/wine/nvapi
|
||||
|
||||
$(eval $(call rules-source,dxvk-nvapi,$(SRCDIR)/dxvk-nvapi))
|
||||
$(eval $(call rules-meson,dxvk-nvapi,32))
|
||||
$(eval $(call rules-meson,dxvk-nvapi,64))
|
||||
$(eval $(call rules-meson,dxvk-nvapi,32,CROSS))
|
||||
$(eval $(call rules-meson,dxvk-nvapi,64,CROSS))
|
||||
|
||||
$(OBJ)/.dxvk-nvapi-post-build64:
|
||||
mkdir -p "$(DST_DIR)"/lib64/wine/nvapi
|
||||
|
@ -850,16 +842,12 @@ VKD3D_PROTON_SOURCE_ARGS = \
|
|||
--exclude vkd3d_version.h.in \
|
||||
|
||||
VKD3D_PROTON_MESON_ARGS = -Denable_standalone_d3d12=true
|
||||
VKD3D_PROTON_MESON_ARGS32 = \
|
||||
--bindir=$(VKD3D_PROTON_DST32)/lib/wine/vkd3d-proton \
|
||||
--cross-file=$(VKD3D_PROTON_OBJ32)/build-win32.txt
|
||||
VKD3D_PROTON_MESON_ARGS64 = \
|
||||
--bindir=$(VKD3D_PROTON_DST64)/lib64/wine/vkd3d-proton \
|
||||
--cross-file=$(VKD3D_PROTON_OBJ64)/build-win64.txt
|
||||
VKD3D_PROTON_MESON_ARGS32 = --bindir=$(VKD3D_PROTON_DST32)/lib/wine/vkd3d-proton
|
||||
VKD3D_PROTON_MESON_ARGS64 = --bindir=$(VKD3D_PROTON_DST64)/lib64/wine/vkd3d-proton
|
||||
|
||||
$(eval $(call rules-source,vkd3d-proton,$(SRCDIR)/vkd3d-proton))
|
||||
$(eval $(call rules-meson,vkd3d-proton,32))
|
||||
$(eval $(call rules-meson,vkd3d-proton,64))
|
||||
$(eval $(call rules-meson,vkd3d-proton,32,CROSS))
|
||||
$(eval $(call rules-meson,vkd3d-proton,64,CROSS))
|
||||
|
||||
$(OBJ)/.vkd3d-proton-post-source:
|
||||
sed -re 's#@VCS_TAG@#$(shell git -C $(SRCDIR)/vkd3d-proton describe --always --exclude=* --abbrev=15 --dirty=0)#' \
|
||||
|
|
|
@ -114,6 +114,9 @@ $(2)_LIBFLAGS$(3) = $$(foreach d,$$($(2)_DEPS$(3)),-L$$($$(d)_LIBDIR$(3))) \
|
|||
# PKG_CONFIG is intentionally never using CROSS target, as it's missing
|
||||
# wrapper scripts in the toolchain, we use PKG_CONFIG_LIBDIR directly
|
||||
# instead.
|
||||
#
|
||||
# RC and WIDL are intentionally always using CROSS target, as their
|
||||
# native version doesn't exist.
|
||||
|
||||
$(2)_ENV$(3) = \
|
||||
CARGO_HOME=$$(OBJ)/.cargo \
|
||||
|
@ -125,6 +128,8 @@ $(2)_ENV$(3) = \
|
|||
CC="$$(TARGET_$(4)$(3))-gcc" \
|
||||
CXX="$$(TARGET_$(4)$(3))-g++" \
|
||||
LD="$$(TARGET_$(4)$(3))-ld" \
|
||||
RC="$$(TARGET_CROSS$(3))-windres" \
|
||||
WIDL="$$(TARGET_CROSS$(3))-widl" \
|
||||
PKG_CONFIG="$$(TARGET_$(3))-pkg-config" \
|
||||
PATH="$$(call list-join,:,$$(foreach d,$$($(2)_DEPS$(3)),$$($$(d)_BINDIR$(3))),,:):$$(SRC)/glslang/bin:$$$$PATH" \
|
||||
LD_LIBRARY_PATH="$$(call list-join,:,$$(foreach d,$$($(2)_DEPS$(3)),$$($$(d)_LIBDIR$(3))),,:)$$$$LD_LIBRARY_PATH" \
|
||||
|
|
|
@ -2,26 +2,55 @@
|
|||
# $(1): lowercase package name
|
||||
# $(2): uppercase package name
|
||||
# $(3): 32/64, build type
|
||||
# $(4): CROSS/<empty>, cross compile
|
||||
#
|
||||
define create-rules-meson
|
||||
# Don't pass CROSS here, we need a native environment and we'll handle
|
||||
# cross compilation below with the CROSS-prefixed variables.
|
||||
$(call create-rules-common,$(1),$(2),$(3))
|
||||
|
||||
define $(2)_MESON_CROSS$(3)
|
||||
cat <<EOF
|
||||
[binaries]
|
||||
ar = '$$$$CROSSAR'
|
||||
c = '$$$$CROSSCC'
|
||||
cpp = '$$$$CROSSCXX'
|
||||
ld = '$$$$CROSSLD'
|
||||
windres = '$$$$RC'
|
||||
strip = '$$$$STRIP'
|
||||
widl = '$$$$WIDL'
|
||||
pkgconfig = '$$$$PKG_CONFIG'
|
||||
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
c_args = [$$(call list-quote,$$($(2)_INCFLAGS$(3)) $$($(2)_CPPFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3)))]
|
||||
cpp_args = [$$(call list-quote,$$($(2)_INCFLAGS$(3)) $$($(2)_CPPFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3)) -std=c++17)]
|
||||
link_args = [$$(call list-quote,$$($(2)_LIBFLAGS$(3)) $$($(2)_LDFLAGS$(3)) $$($(2)_LDFLAGS) $$(CROSSLDFLAGS))]
|
||||
pkg_config_libdir = '$$$$CROSSPKG_CONFIG_LIBDIR'
|
||||
|
||||
[host_machine]
|
||||
system = 'windows'
|
||||
cpu_family = '$$(MESON_CPU$(3))'
|
||||
cpu = '$$(MESON_CPU$(3))'
|
||||
endian = 'little'
|
||||
EOF
|
||||
endef
|
||||
|
||||
export $(2)_MESON_CROSS$(3)
|
||||
|
||||
ifeq ($(CONTAINER),1)
|
||||
$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/meson.build
|
||||
@echo ":: configuring $(3)bit $(1)..." >&2
|
||||
rm -rf "$$($(2)_OBJ$(3))/meson-private/coredata.dat"
|
||||
|
||||
grep -s -v -e c_args -e cpp_args -e link_args "$$($(2)_SRC)/build-win$(3).txt" | \
|
||||
sed -e "s:\[properties\]:[properties]\nc_args = [$$(call list-quote,$$(COMMON_FLAGS))]:" \
|
||||
-e "s:\[properties\]:[properties]\ncpp_args = [$$(call list-quote,$$(COMMON_FLAGS))]:" \
|
||||
-e "s:\[properties\]:[properties]\nlink_args = [$$(call list-quote,$$(CROSSLDFLAGS))]:" \
|
||||
> "$$($(2)_OBJ$(3))/build-win$(3).txt"
|
||||
echo "$$$$$(2)_MESON_CROSS$(3)" | env $$($(2)_ENV$(3)) sh >"$$($(2)_OBJ$(3))/cross-$(3).txt"
|
||||
|
||||
env $$($(2)_ENV$(3)) \
|
||||
meson "$$($(2)_OBJ$(3))" "$$($(2)_SRC)" \
|
||||
--prefix="$$($(2)_DST$(3))" \
|
||||
--libdir="lib$(subst 32,,$(3))" \
|
||||
--buildtype=plain \
|
||||
$(if $(4),--cross-file="$$($(2)_OBJ$(3))/cross-$(3).txt",) \
|
||||
$$($(2)_MESON_ARGS) \
|
||||
$$($(2)_MESON_ARGS$(3)) \
|
||||
$$(MESON_STRIP_ARG)
|
||||
|
@ -36,4 +65,7 @@ $$(OBJ)/.$(1)-build$(3):
|
|||
endif
|
||||
endef
|
||||
|
||||
rules-meson = $(call create-rules-meson,$(1),$(call toupper,$(1)),$(2))
|
||||
MESON_CPU32 = x86
|
||||
MESON_CPU64 = x86_64
|
||||
|
||||
rules-meson = $(call create-rules-meson,$(1),$(call toupper,$(1)),$(2),$(3))
|
||||
|
|
Loading…
Reference in a new issue