From 1713fa02970ca2a045b1635186fef718620bf1b3 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 15 Feb 2016 09:05:10 +0530 Subject: Add shared_library argument for a Visual Studio module definitions file On MSVC, shared libraries only export symbols that have been explicitly exported either as part of the symbol prototype or via a module definitions file. On compilers other than MSVC, all symbols are exported in the shared library by default and the format for the list of symbols to export is different, so this is only used with the VisualStudio compiler. The module defs file path can either be relative to the current source directory or an absolute path using meson.source_root() + '/some/path' --- mesonbuild/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index ab9d0d5..8732987 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -47,7 +47,7 @@ known_shlib_kwargs.update({'version' : True, 'soversion' : True, 'name_prefix' : True, 'name_suffix' : True, - }) + 'vs_module_defs' : True}) backslash_explanation = \ '''Compiler arguments have a backslash "\\" character. This is unfortunately not @@ -703,6 +703,7 @@ class SharedLibrary(BuildTarget): def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): self.version = None self.soversion = None + self.vs_module_defs = None super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs); if len(self.sources) > 0 and self.sources[0].endswith('.cs'): prefix = 'lib' @@ -726,6 +727,12 @@ class SharedLibrary(BuildTarget): self.set_version(kwargs['version']) if 'soversion' in kwargs: self.set_soversion(kwargs['soversion']) + 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) def check_unknown_kwargs(self, kwargs): self.check_unknown_kwargs_int(kwargs, known_shlib_kwargs) -- cgit v1.1