Skip to content

Commit 0fad600

Browse files
committed
modules/windows: Also search for llvm-rc and llvm-windres
Fixes #15011
1 parent e0ea239 commit 0fad600

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

mesonbuild/modules/windows.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,26 @@ def _find_resource_compiler(self, state: 'ModuleState') -> T.Tuple[ExternalProgr
7575
rescomp = ExternalProgram.from_bin_list(state.environment, for_machine, 'windres')
7676

7777
if not rescomp or not rescomp.found():
78+
def search_programs(names: T.List[str]) -> T.Optional[ExternalProgram]:
79+
for name in names:
80+
program = ExternalProgram(name, silent=True)
81+
if program.found():
82+
return program
83+
return None
84+
85+
def find_rc_like_compiler() -> T.Optional[ExternalProgram]:
86+
return search_programs(['rc', 'llvm-rc'])
87+
88+
def find_windres_like_compiler() -> T.Optional[ExternalProgram]:
89+
return search_programs(['windres', 'llvm-windres'])
90+
7891
comp = self.detect_compiler(state.environment.coredata.compilers[for_machine])
7992
if comp.id in {'msvc', 'clang-cl', 'intel-cl'} or (comp.linker and comp.linker.id in {'link', 'lld-link'}):
80-
# Microsoft compilers uses rc irrespective of the frontend
81-
rescomp = ExternalProgram('rc', silent=True)
93+
rescomp = find_rc_like_compiler() or find_windres_like_compiler()
8294
else:
83-
rescomp = ExternalProgram('windres', silent=True)
95+
rescomp = find_windres_like_compiler() or find_rc_like_compiler()
8496

85-
if not rescomp.found():
97+
if not rescomp:
8698
raise MesonException('Could not find Windows resource compiler')
8799

88100
for (arg, match, rc_type) in [

0 commit comments

Comments
 (0)