aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2021-07-02 12:59:07 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2021-07-07 18:54:45 +0300
commit62702005ebbf95699050ee5db26ee154bd874cb6 (patch)
treedde32837b92b3d6d58f1245c5f15584dd4786a0d /mesonbuild
parent81d9acab8744d5fbd067cfad0723975b694101f0 (diff)
downloadmeson-62702005ebbf95699050ee5db26ee154bd874cb6.zip
meson-62702005ebbf95699050ee5db26ee154bd874cb6.tar.gz
meson-62702005ebbf95699050ee5db26ee154bd874cb6.tar.bz2
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
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/windows.py7
1 files changed, 6 insertions, 1 deletions
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 = []