diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-09 00:46:17 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-02-18 23:15:39 +0200 |
commit | 432379cf16396926e075231379a85c7bf103bbda (patch) | |
tree | 2d5e1f1cdfdd91583917d108b12c786d4b19f380 | |
parent | 661c6686600631572f2fa472bdf45fa7fa183bde (diff) | |
download | meson-432379cf16396926e075231379a85c7bf103bbda.zip meson-432379cf16396926e075231379a85c7bf103bbda.tar.gz meson-432379cf16396926e075231379a85c7bf103bbda.tar.bz2 |
Add symbol export file support to MSVC.
-rw-r--r-- | mesonbuild/compilers/c.py | 3 | ||||
-rw-r--r-- | test cases/common/211 version file/bob.sym | 2 | ||||
-rw-r--r-- | test cases/common/211 version file/bob.sym.in | 2 | ||||
-rw-r--r-- | test cases/common/211 version file/meson.build | 31 | ||||
-rw-r--r-- | test cases/common/211 version file/sub/foo.sym | 2 | ||||
-rw-r--r-- | test cases/common/211 version file/sub/meson.build | 5 |
6 files changed, 32 insertions, 13 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index a1a8fb9..3f70d4a 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1497,6 +1497,9 @@ class VisualStudioCCompiler(CCompiler): # so if a module defs file is specified, we use that to export symbols return ['/DEF:' + defsfile] + def get_symbol_export_file_args(self, path): + return ['/DEF:' + path] + def gen_pch_args(self, header, source, pchname): objname = os.path.splitext(pchname)[0] + '.obj' return objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname] diff --git a/test cases/common/211 version file/bob.sym b/test cases/common/211 version file/bob.sym new file mode 100644 index 0000000..5a3f029 --- /dev/null +++ b/test cases/common/211 version file/bob.sym @@ -0,0 +1,2 @@ +EXPORTS + bobMcBob diff --git a/test cases/common/211 version file/bob.sym.in b/test cases/common/211 version file/bob.sym.in new file mode 100644 index 0000000..6aeb511 --- /dev/null +++ b/test cases/common/211 version file/bob.sym.in @@ -0,0 +1,2 @@ +EXPORTS + @in@ diff --git a/test cases/common/211 version file/meson.build b/test cases/common/211 version file/meson.build index 7c0dfbd..7986034 100644 --- a/test cases/common/211 version file/meson.build +++ b/test cases/common/211 version file/meson.build @@ -1,7 +1,15 @@ project('linker script', 'c') +cc = meson.get_compiler('c') + # Static map file -mapfile = 'bob.map' +if cc.get_id() == 'msvc' + suffix = '.sym' +else + suffix = '.map' +endif + +mapfile = 'bob' + suffix l = shared_library('bob', 'bob.c', symbol_export_file: mapfile) e = executable('prog', 'prog.c', link_with : l) @@ -11,8 +19,8 @@ test('core', e) conf = configuration_data() conf.set('in', 'bobMcBob') m = configure_file( - input : 'bob.map.in', - output : 'bob-conf.map', + input : 'bob' + suffix + '.in', + output : 'bob-conf' + suffix, configuration : conf, ) @@ -20,13 +28,16 @@ l = shared_library('bob-conf', 'bob.c', symbol_export_file: m) e = executable('prog-conf', 'prog.c', link_with : l) test('core', e) -# custom_target -python = find_program('python3') +## custom_target +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif m = custom_target( - 'bob-ct.map', + 'bob-ct' + suffix, command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], - input : ['copy.py', 'bob.map'], - output : 'bob-ct.map', + input : ['copy.py', 'bob' + suffix], + output : 'bob-ct' + suffix, ) l = shared_library('bob-ct', ['bob.c', m], symbol_export_file: m) @@ -34,7 +45,7 @@ e = executable('prog-ct', 'prog.c', link_with : l) test('core', e) # File -mapfile = files('bob.map') +mapfile = files('bob' + suffix) l = shared_library('bob-files', 'bob.c', symbol_export_file: mapfile) e = executable('prog-files', 'prog.c', link_with : l) @@ -43,7 +54,7 @@ test('core', e) subdir('sub') # With map file in subdir -mapfile = files('sub/foo.map') +mapfile = files('sub/foo' + suffix) l = shared_library('bar', 'bob.c', symbol_export_file: mapfile) e = executable('prog-bar', 'prog.c', link_with : l) diff --git a/test cases/common/211 version file/sub/foo.sym b/test cases/common/211 version file/sub/foo.sym new file mode 100644 index 0000000..5a3f029 --- /dev/null +++ b/test cases/common/211 version file/sub/foo.sym @@ -0,0 +1,2 @@ +EXPORTS + bobMcBob diff --git a/test cases/common/211 version file/sub/meson.build b/test cases/common/211 version file/sub/meson.build index 93199f3..7ec590a 100644 --- a/test cases/common/211 version file/sub/meson.build +++ b/test cases/common/211 version file/sub/meson.build @@ -1,6 +1,5 @@ -mapfile = 'foo.map' -vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) +mapfile = 'foo' + suffix -l = shared_library('foo', '../bob.c', link_args : vflag, link_depends : mapfile) +l = shared_library('foo', '../bob.c', symbol_export_file: mapfile) e = executable('prog-foo', '../prog.c', link_with : l) test('core', e) |