From c49f5aefd81808d5f9eb4fd06edd225ff11a5476 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 10 Apr 2017 15:02:56 -0700 Subject: Allow using generated files to shared_library vs_module_defs. Closes #1605 This detects and allows passing a generated file as a vs_module_def, it also adds a testcase that tests using configure_file to generate the .def file. --- mesonbuild/build.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index df3f37b..5c382a5 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1191,12 +1191,18 @@ class SharedLibrary(BuildTarget): # Visual Studio module-definitions file if 'vs_module_defs' in kwargs: path = kwargs['vs_module_defs'] - if os.path.isabs(path): - self.vs_module_defs = File.from_absolute_file(path) - else: - self.vs_module_defs = File.from_source_file(environment.source_dir, self.subdir, path) - # link_depends can be an absolute path or relative to self.subdir - self.link_depends.append(path) + if isinstance(path, str): + if os.path.isabs(path): + self.vs_module_defs = File.from_absolute_file(path) + else: + self.vs_module_defs = File.from_source_file(environment.source_dir, self.subdir, path) + # link_depends can be an absolute path or relative to self.subdir + self.link_depends.append(path) + elif isinstance(path, File): + # When passing a generated file. + self.vs_module_defs = path + # link_depends can be an absolute path or relative to self.subdir + self.link_depends.append(path.absolute_path(environment.source_dir, environment.build_dir)) def check_unknown_kwargs(self, kwargs): self.check_unknown_kwargs_int(kwargs, known_lib_kwargs) -- cgit v1.1