2222 from . import ModuleState
2323 from ..compilers import Compiler
2424 from ..interpreter import Interpreter
25- from ..interpreter .interpreter import SourceOutputs
2625
2726 from typing_extensions import TypedDict
2827
2928 class CompileResources (TypedDict ):
29+
3030 depend_files : T .List [mesonlib .FileOrString ]
31- depends : T .List [T .Union [build .BuildTarget , build .CustomTarget , build . CustomTargetIndex ]]
31+ depends : T .List [T .Union [build .BuildTarget , build .CustomTarget ]]
3232 include_directories : T .List [T .Union [str , build .IncludeDirs ]]
3333 args : T .List [str ]
3434
@@ -108,33 +108,6 @@ def search_programs(names: T.List[str]) -> T.Optional[ExternalProgram]:
108108
109109 return self ._rescomp
110110
111- def get_preprocessor_target (self ,
112- name_formatted : str ,
113- src : T .Union [str , mesonlib .File , build .CustomTarget , build .CustomTargetIndex ],
114- include_directories : T .List [build .IncludeDirs ],
115- state : ModuleState ) -> build .CustomTargetIndex :
116- compiler = self .detect_compiler (state .environment .coredata .compilers [MachineChoice .HOST ])
117- _sources : T .List [T .Union [mesonlib .File , build .CustomTarget , build .CustomTargetIndex , build .GeneratedList ]] = self .interpreter .source_strings_to_files ([src ])
118- sources = T .cast ('T.List[SourceOutputs]' , _sources )
119-
120- tg = build .CompileTarget (
121- name_formatted ,
122- state .subdir ,
123- state .subproject ,
124- state .environment ,
125- sources ,
126- 127- compiler .get_preprocessor (),
128- state .backend ,
129- ['-DRC_INVOKED' ],
130- include_directories ,
131- [],
132- [])
133- self .interpreter .add_target (tg .name , tg )
134-
135- private_dir = os .path .relpath (state .backend .get_target_private_dir (tg ), state .subdir )
136- return build .CustomTargetIndex (tg , os .path .join (private_dir , tg .outputs [0 ]))
137-
138111 @typed_pos_args ('windows.compile_resources' , varargs = (str , mesonlib .File , build .CustomTarget , build .CustomTargetIndex ), min_varargs = 1 )
139112 @typed_kwargs (
140113 'windows.compile_resources' ,
@@ -154,8 +127,7 @@ def compile_resources(self, state: 'ModuleState',
154127 extra_args += state .get_include_args ([
155128 build .IncludeDirs ('' , [], False , [os .path .join ('@BUILD_ROOT@' , self .interpreter .backend .get_target_dir (d ))])
156129 ])
157- include_directories = self .interpreter .extract_incdirs (kwargs )
158- extra_args += state .get_include_args (include_directories )
130+ extra_args += state .get_include_args (kwargs ['include_directories' ])
159131
160132 rescomp , rescomp_type = self ._find_resource_compiler (state )
161133 if rescomp_type == ResourceCompilerType .rc :
@@ -212,20 +184,12 @@ def get_names() -> T.Iterable[T.Tuple[str, str, T.Union[str, mesonlib.File, buil
212184 command .append (rescomp )
213185 command .extend (res_args )
214186 depfile : T .Optional [str ] = None
215- extra_depends = wrc_depends . copy ()
187+ # instruct binutils windres to generate a preprocessor depfile
216188 if rescomp_type == ResourceCompilerType .windres :
217- # instruct binutils windres to generate a preprocessor depfile
218189 depfile = f'{ output } .d'
219190 command .extend (['--preprocessor-arg=-MD' ,
220191 '--preprocessor-arg=-MQ@OUTPUT@' ,
221192 '--preprocessor-arg=-MF@DEPFILE@' ])
222- elif rescomp_type == ResourceCompilerType .rc :
223- # use preprocessor to detect header dependencies
224- extra_depends .append (self .get_preprocessor_target (
225- name_formatted + '_i' ,
226- src ,
227- include_directories ,
228- state ))
229193
230194 res_targets .append (build .CustomTarget (
231195 name_formatted ,
@@ -237,7 +201,7 @@ def get_names() -> T.Iterable[T.Tuple[str, str, T.Union[str, mesonlib.File, buil
237201 [output ],
238202 depfile = depfile ,
239203 depend_files = wrc_depend_files ,
240- extra_depends = extra_depends ,
204+ extra_depends = wrc_depends ,
241205 description = 'Compiling Windows resource {}' ,
242206 ))
243207
0 commit comments