aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-04-10 15:02:56 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-04-10 15:43:17 -0700
commitc49f5aefd81808d5f9eb4fd06edd225ff11a5476 (patch)
tree53c2a349b004403cbca5604022007b7b87cd10c0 /mesonbuild/build.py
parent7d5e4012fe7d5984d1039d8647a7cb80fe484e9e (diff)
downloadmeson-c49f5aefd81808d5f9eb4fd06edd225ff11a5476.zip
meson-c49f5aefd81808d5f9eb4fd06edd225ff11a5476.tar.gz
meson-c49f5aefd81808d5f9eb4fd06edd225ff11a5476.tar.bz2
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.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py18
1 files changed, 12 insertions, 6 deletions
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)