[babl/wip/msvc: 15/20] build: Generate .def file



commit 621b65eccec0f9cdcd2666dff7feea7060f9ee1a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jan 22 15:54:50 2020 +0800

    build: Generate .def file
    
    Generate .def file from $(srcroot)/export-symbols, as we do for GCC and CLang,
    so that we do not need many other steps to export from the built babl DLL.

 babl/meson.build | 3 ++-
 gen_babl_map.py  | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/babl/meson.build b/babl/meson.build
index c86fbacc5..e2bfd2858 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -5,6 +5,7 @@ python = import('python').find_installation()
 
 version_script = 'babl.map'
 version_script_clang = 'babl.map.clang'
+msvc_def = 'babl.map.def'
 
 babl_gnu_sym_path = join_paths(meson.current_source_dir(), 'test-gnu.map')
 babl_clang_sym_path = join_paths(meson.current_source_dir(), 'test-clang.map')
@@ -51,7 +52,7 @@ if cc.get_id() != 'msvc'
     babl_link_args += '-Wl,--no-undefined'
   endif
 else
-  babl_link_args= []
+  babl_link_args = [ '-def:@0@'.format(msvc_def) ]
 endif
 
 
diff --git a/gen_babl_map.py b/gen_babl_map.py
index 80a2d3ea3..c7fee8f40 100644
--- a/gen_babl_map.py
+++ b/gen_babl_map.py
@@ -3,6 +3,7 @@ import sys
 export_symbols=sys.argv[1]
 version_file=sys.argv[2]
 version_file_clang=sys.argv[2] + ".clang"
+def_file_msvc=sys.argv[2] + ".def"
 
 with open(export_symbols, 'r') as syms, \
      open(version_file, 'w') as version:
@@ -15,3 +16,9 @@ with open(export_symbols, 'r') as syms, \
      open(version_file_clang, 'w') as version:
      for sym in syms:
         version.write("_{}\n".format(sym.strip()))
+
+with open(export_symbols, 'r') as syms, \
+     open(def_file_msvc, 'w') as def_file:
+     def_file.write('EXPORTS\n')
+     for sym in syms:
+        def_file.write("{}\n".format(sym.strip()))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]