@@ -86,6 +86,7 @@ def _find_resource_compiler(self, state: 'ModuleState') -> T.Tuple[ExternalProgr
8686 raise MesonException ('Could not find Windows resource compiler' )
8787
8888 for (arg , match , rc_type ) in [
89+ # Zig >=0.14.1 is also matched by the regex below.
8990 ('/?' , '^.*Microsoft.*Resource Compiler.*$' , ResourceCompilerType .rc ),
9091 ('/?' , 'LLVM Resource Converter.*$' , ResourceCompilerType .rc ),
9192 ('--version' , '^.*GNU windres.*$' , ResourceCompilerType .windres ),
@@ -98,7 +99,15 @@ def _find_resource_compiler(self, state: 'ModuleState') -> T.Tuple[ExternalProgr
9899 self ._rescomp = (rescomp , rc_type )
99100 break
100101 else :
101- raise MesonException ('Could not determine type of Windows resource compiler' )
102+ # Zig <0.14.1 prints its info to stderr, so we'll handle it separately.
103+ _ , _ , e = mesonlib .Popen_safe (rescomp .get_command () + ['/?' ])
104+ # The string below should be indicative of a resinator rc compiler
105+ # (which includes zig rc).
106+ if re .search ('^Supported Win32 RC Options:$' , e , re .MULTILINE ):
107+ mlog .log ('Windows resource compiler: Zig <0.14.1/restinator Resource Compiler' )
108+ self ._rescomp = (rescomp , ResourceCompilerType .rc )
109+ else :
110+ raise MesonException ('Could not determine type of Windows resource compiler' )
102111
103112 return self ._rescomp
104113
0 commit comments