[pangomm/use-dllexport-2-42] meson.build: Check for API decorations in headers in release tarballs



commit f1a40506338a6734bfa64d293b343e50277a9b99
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Mar 19 15:56:32 2020 +0800

    meson.build: Check for API decorations in headers in release tarballs
    
    gmmproc was updated in glibmm-2.64.0 to support adding API decorations that is
    needed to support Visual Studio builds using __declspec(dllexport)
    (i.e. without using gendef.exe).  This checks one of such headers in the
    release tarballs to see in the first comment line to see what version of
    gmmproc is being used.  If it is on or after 2.64.0, enable builds without
    using gendef.exe.

 meson.build | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/meson.build b/meson.build
index 6ce23eb..a7418a6 100644
--- a/meson.build
+++ b/meson.build
@@ -193,6 +193,29 @@ else
   ])
 endif
 
+if is_msvc and not maintainer_mode
+  # Check for the first line in a file generated with gmmproc,
+  # to see which gmmproc version was used
+  check_gmmproc_ver_cmd = '''
+import os
+import sys
+
+f = open(os.path.join('@0@', 'untracked', 'pango', 'pangomm', 'attributes.h'))
+tokens = f.readline().split()
+gmmproc_ver = tokens[tokens.index('gmmproc') + 1]
+gmmproc_ver_split = gmmproc_ver.split('.')
+if int(gmmproc_ver_split[0]) > 2 or \
+   (int(gmmproc_ver_split[0]) == 2 and int(gmmproc_ver_split[1]) >= 64):
+    sys.exit(0)
+else:
+    sys.exit(1)
+  '''.format('/'.join(project_source_root.split('\\')))
+
+  # Enable __declspec(dllexport) if the pangomm headers generated from the .hg files
+  # were generated using gmmproc from glibmm-2.64.0 or later
+  use_dll_export = run_command(python3, '-c', check_gmmproc_ver_cmd).returncode() == 0
+endif
+
 # Some dependencies are required only in maintainer mode and/or if
 # reference documentation shall be built.
 mm_common_get = find_program('mm-common-get', required: maintainer_mode)


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