From 62702005ebbf95699050ee5db26ee154bd874cb6 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 2 Jul 2021 12:59:07 +0200 Subject: windows: Support wrc resource compiler It has a similar interface to windres, but it produces ELF instead of COFF binaries. It uses its own preprocessor which doesn't support creating depfiles, but we can convince it to use the system preprocessor instead and pass those arguments using the --preprocessor option. Together with some hacks to override the shared library/executable suffix and some wine patches [1] this is enough to compile dxvk when ripping out the hand-rolled rc support. [1] https://www.winehq.org/pipermail/wine-devel/2021-July/190100.html https://www.winehq.org/pipermail/wine-devel/2021-July/190098.html https://www.winehq.org/pipermail/wine-devel/2021-July/190099.html https://www.winehq.org/pipermail/wine-devel/2021-July/190101.html --- mesonbuild/modules/windows.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mesonbuild/modules/windows.py') diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index d322833..7f627cf 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -27,6 +27,7 @@ from ..programs import ExternalProgram class ResourceCompilerType(enum.Enum): windres = 1 rc = 2 + wrc = 3 class WindowsModule(ExtensionModule): def __init__(self, interpreter): @@ -66,6 +67,7 @@ class WindowsModule(ExtensionModule): for (arg, match, rc_type) in [ ('/?', '^.*Microsoft.*Resource Compiler.*$', ResourceCompilerType.rc), ('--version', '^.*GNU windres.*$', ResourceCompilerType.windres), + ('--version', '^.*Wine Resource Compiler.*$', ResourceCompilerType.wrc), ]: p, o, e = mesonlib.Popen_safe(rescomp.get_command() + [arg]) m = re.search(match, o, re.MULTILINE) @@ -102,7 +104,7 @@ class WindowsModule(ExtensionModule): # CVTRES internally to convert this to a COFF object) suffix = 'res' res_args = extra_args + ['/nologo', '/fo@OUTPUT@', '@INPUT@'] - else: + elif rescomp_type == ResourceCompilerType.windres: # ld only supports object files, so windres is used to generate a # COFF object suffix = 'o' @@ -113,6 +115,9 @@ class WindowsModule(ExtensionModule): for arg in extra_args: if ' ' in arg: mlog.warning(m.format(arg), fatal=False) + else: + suffix = 'o' + res_args = extra_args + ['@INPUT@', '-o', '@OUTPUT@'] res_targets = [] -- cgit v1.1