summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-04-18 14:28:46 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2017-05-03 15:10:56 +0100
commitc97ef81a10a67fbc52bcbf496e64d30d1ae3d196 (patch)
treed9bc1a24256bf9ff8200665016bae013a71538bd /meson.build
parent68039b610b9622beb34ee865825eebe721a7c162 (diff)
downloadgtk+-c97ef81a10a67fbc52bcbf496e64d30d1ae3d196.tar.gz
build: Add missing symbol visibility flags
GTK symbols are not visible by default, and only the ones annotated with _GDK_EXTERN (and wrapper macros) are exported. We need to define _GDK_EXTERN during the configuration, depending on the platform and compiler we use.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build16
1 files changed, 16 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 54ce3c7afb..36b8001fa7 100644
--- a/meson.build
+++ b/meson.build
@@ -255,6 +255,22 @@ foreach cflag: test_cflags
endif
endforeach
+# Symbol visibility
+if get_option('default_library') != 'static'
+ if host_machine.system() == 'windows'
+ cdata.set('DLL_EXPORT', true)
+ if cc.get_id() == 'msvc'
+ cdata.set('_GDK_EXTERN', '__declspec(dllexport) extern')
+ else
+ cdata.set('_GDK_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
+ common_cflags += ['-fvisibility=hidden']
+ endif
+ else
+ cdata.set('_GDK_EXTERN', '__attribute__((visibility("default"))) extern')
+ common_cflags += ['-fvisibility=hidden']
+ endif
+endif
+
confinc = include_directories('.')
gdkinc = include_directories('gdk')
gtkinc = include_directories('gtk')