summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2021-08-11 15:37:27 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2021-08-11 16:45:30 +0800
commit309f8809937109ae9d06a617eab741123348a6a1 (patch)
treeb789bd35f581ee9097b3e1c4bc97d4d91ba463a5
parentd4120b9ced42140e5284aee299cdc901d2d9a4d8 (diff)
downloadlibgd-309f8809937109ae9d06a617eab741123348a6a1.tar.gz
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).
-rw-r--r--libgd/meson.build4
-rw-r--r--meson_options.txt6
2 files changed, 9 insertions, 1 deletions
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')