[gnome-builder] build: setup visibility flags without applying them
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] build: setup visibility flags without applying them
- Date: Thu, 22 Mar 2018 10:24:45 +0000 (UTC)
commit 5a9bd4c0917188cc573f1ce3a6185750c6f28a46
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 22 03:23:23 2018 -0700
build: setup visibility flags without applying them
This adds the bits we need to do visibility flags, but does not
yet apply the default visibility.
meson.build | 23 +++++++++++++++++++----
src/libide/meson.build | 3 +++
2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 738359f5f..15f7ec7fc 100644
--- a/meson.build
+++ b/meson.build
@@ -149,10 +149,25 @@ foreach arg: test_c_args
global_c_args += arg
endif
endforeach
-add_project_arguments(
- global_c_args,
- language: 'c'
-)
+
+# Detect and set symbol visibility
+hidden_visibility_args = []
+if get_option('default_library') != 'static'
+ if host_machine.system() == 'windows'
+ config_h.set('DLL_EXPORT', true)
+ if cc.get_id() == 'msvc'
+ config_h.set('_IDE_EXTERN', '__declspec(dllexport) extern')
+ elif cc.has_argument('-fvisibility=hidden')
+ config_h.set('_IDE_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
+ hidden_visibility_args = ['-fvisibility=hidden']
+ endif
+ elif cc.has_argument('-fvisibility=hidden')
+ config_h.set('_IDE_EXTERN', '__attribute__((visibility("default"))) extern')
+ hidden_visibility_args = ['-fvisibility=hidden']
+ endif
+endif
+
+add_project_arguments(global_c_args, language: 'c')
global_link_args = []
test_link_args = [
diff --git a/src/libide/meson.build b/src/libide/meson.build
index 055801b9b..4d5349094 100644
--- a/src/libide/meson.build
+++ b/src/libide/meson.build
@@ -217,6 +217,9 @@ if get_option('with_editorconfig')
libide_deps += libeditorconfig_dep
endif
+# Limit visibility to public API
+# libide_args += hidden_visibility_args
+
libide = shared_library('ide-' + libide_api_version,
libide_resources + libide_icons_resources + libide_sources,
dependencies: libide_deps,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]