[libgd/gd.msvc: 2/4] meson: Add option to export symbols on MSVC-style builds




commit 72a387d54201bb7670263609a05c644598de37a2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Aug 11 15:37:27 2021 +0800

    meson: Add option to export symbols on MSVC-style builds
    
    This adds an option that is enabled by default so that we can make Visual
    Studio-style builds (which also includes clang-cl) export symbols from the
    libgd copy that we incorporate into various things that we build or when
    libgd is built standalone as a shared library.  Items such as gedit relies on
    items in its included libgd parts to be exported in order to function
    correctly.
    
    This commit is the first part that adds a compiler macro which will activate
    parts of the code so that symbols will be built with the needed symbols marked
    for export, which will be in the subsequent commit(s).

 libgd/meson.build | 4 ++++
 meson_options.txt | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/libgd/meson.build b/libgd/meson.build
index 6ba7871..705e8fb 100644
--- a/libgd/meson.build
+++ b/libgd/meson.build
@@ -130,6 +130,10 @@ endif
 
 # --------- Building -----------
 
+if (cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl') and get_option('msvc-export-symbols')
+  c_args += '-DMSVC_EXPORT_DLL'
+endif
+
 static = get_option('static')
 install_introspection = get_option('with-introspection')
 with_vapi = get_option('with-vapi')
diff --git a/meson_options.txt b/meson_options.txt
index fcab3a0..f699176 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,4 +22,8 @@ option('with-margin-container', type: 'boolean', value: false)
 option('with-tagged-entry', type: 'boolean', value: false)
 option('with-notification', type: 'boolean', value: false)
 option('with-main-box', type: 'boolean', value: false)
-option('with-main-icon-box', type: 'boolean', value: false)
\ No newline at end of file
+option('with-main-icon-box', type: 'boolean', value: false)
+
+# Export options (for MSVC-style compilers only)
+option('msvc-export-symbols', type: 'boolean', value: true,
+  description: 'Export symbols for Visual Studio-style builds, ignored on GCC and non-clang-cl builds')


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