@@ -68,21 +68,36 @@ def _find_resource_compiler(self, state: 'ModuleState') -> T.Tuple[ExternalProgr
68
68
# Take a parameter instead of the hardcoded definition below
69
69
for_machine = MachineChoice .HOST
70
70
71
+ import pdb
72
+ pdb .set_trace ()
73
+
71
74
if self ._rescomp :
72
75
return self ._rescomp
73
76
74
77
# Will try cross / native file and then env var
75
78
rescomp = ExternalProgram .from_bin_list (state .environment , for_machine , 'windres' )
76
79
77
80
if not rescomp or not rescomp .found ():
81
+ def search_programs (names ) -> T .Optional [ExternalProgram ]:
82
+ for name in names :
83
+ program = ExternalProgram (name , silent = True )
84
+ if program .found ():
85
+ return program
86
+ return None
87
+
88
+ def find_rc_like_compiler () -> T .Optional [ExternalProgram ]:
89
+ return search_programs (['rc' , 'llvm-rc' ])
90
+
91
+ def find_windres_like_compiler () -> T .Optional [ExternalProgram ]:
92
+ return search_programs (['windres' , 'llvm-windres' ])
93
+
78
94
comp = self .detect_compiler (state .environment .coredata .compilers [for_machine ])
79
95
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 )
96
+ rescomp = find_rc_like_compiler () or find_windres_like_compiler ()
82
97
else :
83
- rescomp = ExternalProgram ( 'windres' , silent = True )
98
+ rescomp = find_windres_like_compiler () or find_rc_like_compiler ( )
84
99
85
- if not rescomp . found () :
100
+ if not rescomp :
86
101
raise MesonException ('Could not find Windows resource compiler' )
87
102
88
103
for (arg , match , rc_type ) in [
0 commit comments