aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-04-11 22:54:59 +0300
committerGitHub <noreply@github.com>2017-04-11 22:54:59 +0300
commit315a52533c077c898033ee1ab0d5f138d7dec905 (patch)
tree13784d46999cf322ed3764b081257ebab4dab49f /mesonbuild/build.py
parent42d1661bd9d4a29d8780e77127542120624d3729 (diff)
parent6402a8193a1f42a833456d525da8af2946f0c9b8 (diff)
downloadmeson-315a52533c077c898033ee1ab0d5f138d7dec905.zip
meson-315a52533c077c898033ee1ab0d5f138d7dec905.tar.gz
meson-315a52533c077c898033ee1ab0d5f138d7dec905.tar.bz2
Merge pull request #1606 from dcbaker/vs_modules_defs
Allow passing generated files to shared_module vs_module_def. Closes #1605
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index df3f37b..4df7ef5 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1191,12 +1191,22 @@ 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)
+ 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))
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)
+ raise InvalidArguments(
+ 'Shared library vs_module_defs must be either a string, '
+ 'or a file object')
def check_unknown_kwargs(self, kwargs):
self.check_unknown_kwargs_int(kwargs, known_lib_kwargs)