summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-11-22 16:23:14 +0000
committerNirbheek Chauhan <nirbheek@centricular.com>2018-03-10 19:05:19 +0530
commitc0be7bcde5a366ab056032cf9f8da287d822d61a (patch)
treebb57bb8d9623f28ee8f9eb727dbbf7761d3c734b /meson.build
parent088d067967b6c728a7ca28c2501c0f10755fa357 (diff)
downloadgobject-introspection-c0be7bcde5a366ab056032cf9f8da287d822d61a.tar.gz
meson: Update symbol visibility rules
Follow the existing best practices. Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build28
1 files changed, 14 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index def3983d..dd1c674a 100644
--- a/meson.build
+++ b/meson.build
@@ -29,11 +29,6 @@ foreach type : ['char', 'short', 'int', 'long']
config.set('SIZEOF_@0@'.format(type.to_upper()), size)
endforeach
-configure_file(
- configuration: config,
- output: 'config.h'
-)
-
add_project_arguments([
'-I' + meson.build_root(),
'-DHAVE_CONFIG_H',
@@ -41,17 +36,22 @@ add_project_arguments([
)
gi_hidden_visibility_cflags = []
-if cc.has_argument('-fvisibility=hidden')
- gi_hidden_visibility_cflags = [
- '-D_GI_EXTERN=__attribute__((visibility("default"))) extern',
- '-fvisibility=hidden',
- ]
-elif cc.get_id() == 'msvc'
- gi_hidden_visibility_cflags = [
- '-D_GI_EXTERN=__declspec (dllexport) extern',
- ]
+if host_machine.system() == 'windows'
+ config.set('DLL_EXPORT', true)
+ config.set('_GI_EXTERN', '__declspec(dllexport) extern')
+ if cc.get_id() != 'msvc'
+ gi_hidden_visibility_cflags += '-fvisibility=hidden'
+ endif
+else
+ config.set('_GI_EXTERN', '__attribute__((visibility("default"))) extern')
+ gi_hidden_visibility_cflags += '-fvisibility=hidden'
endif
+configure_file(
+ configuration: config,
+ output: 'config.h'
+)
+
# Always bumped to match our version
glib_version = '>=2.@0@.@1@'.format(gi_versions[1], gi_versions[2])