[gtk+] New visibility handling in gdk
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] New visibility handling in gdk
- Date: Sun, 5 May 2013 19:39:23 +0000 (UTC)
commit 8af16c5d4481a517cc7c400b97d469ee550ffd79
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 15 06:35:30 2013 -0400
New visibility handling in gdk
Change the visibility handling to be the same way we do it in
GLib now. We pass -fvisibility=hidden to gcc and decorate public
functions with __attribute__((visibility("default"))).
This commit just does this for GDK, GTK+ will follow later.
configure.ac | 33 +++++++++++++++++++++++++++++++++
gdk/Makefile.am | 5 +++--
gdk/broadway/Makefile.am | 15 ++++++++-------
gdk/quartz/Makefile.am | 1 +
gdk/wayland/Makefile.am | 1 +
gdk/win32/Makefile.am | 17 +++++++++--------
gdk/x11/Makefile.am | 15 ++++++++-------
7 files changed, 63 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d15fdbd..cb52261 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1674,6 +1674,39 @@ else
fi
##################################################
+# Visibility handling
+##################################################
+
+GDK_HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+ *-*-mingw*)
+ dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
+ AC_DEFINE([_GDK_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
+ [defines how to decorate public symbols while building])
+ CFLAGS="${CFLAGS} -fvisibility=hidden"
+ ;;
+ *)
+ dnl on other compilers, check if we can do -fvisibility=hidden
+ SAVED_CFLAGS="${CFLAGS}"
+ CFLAGS="-fvisibility=hidden"
+ AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+ AC_TRY_COMPILE([], [int main (void) { return 0; }],
+ AC_MSG_RESULT(yes)
+ enable_fvisibility_hidden=yes,
+ AC_MSG_RESULT(no)
+ enable_fvisibility_hidden=no)
+ CFLAGS="${SAVED_CFLAGS}"
+
+ AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
+ AC_DEFINE([_GDK_EXTERN], [__attribute__((visibility("default"))) extern],
+ [defines how to decorate public symbols while building])
+ GDK_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+ ])
+ ;;
+esac
+AC_SUBST(GDK_HIDDEN_VISIBILITY_CFLAGS)
+
+##################################################
# Output commands
##################################################
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 0b81376..161996f 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -144,11 +144,11 @@ gdk_c_sources = \
gdkwindowimpl.c
gdk_built_sources = \
+ gdkenumtypes.h \
gdkenumtypes.c \
gdkmarshalers.h \
gdkmarshalers.c \
- gdkversionmacros.h \
- gdkenumtypes.h
+ gdkversionmacros.h
#
# setup GDK sources and their dependencies
@@ -166,6 +166,7 @@ common_sources = \
gdkmarshalers.h
libgdk_3_la_SOURCES = $(common_sources)
+libgdk_3_la_CFLAGS = $(AM_CFLAGS) $(GDK_HIDDEN_VISIBILITY_CFLAGS)
libgdk_3_la_LIBADD = $(GDK_DEP_LIBS)
libgdk_3_la_LDFLAGS = $(LDADD)
diff --git a/gdk/broadway/Makefile.am b/gdk/broadway/Makefile.am
index 661fb7e..1bbde7c 100644
--- a/gdk/broadway/Makefile.am
+++ b/gdk/broadway/Makefile.am
@@ -4,13 +4,14 @@ include $(top_srcdir)/Makefile.decl
libgdkincludedir = $(includedir)/gtk-3.0/gdk
libgdkbroadwayincludedir = $(includedir)/gtk-3.0/gdk/broadway
-AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"Gdk\" \
- -DGDK_COMPILATION \
- -I$(top_srcdir) \
- -I$(top_srcdir)/gdk \
- -I$(top_builddir)/gdk \
- $(GTK_DEBUG_FLAGS) \
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Gdk\" \
+ -DGDK_COMPILATION \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/gdk \
+ -I$(top_builddir)/gdk \
+ $(GDK_HIDDEN_VISIBILITY_CFLAGS) \
+ $(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
LDADDS = $(GDK_DEP_LIBS)
diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am
index a8be38e..2c8fb90 100644
--- a/gdk/quartz/Makefile.am
+++ b/gdk/quartz/Makefile.am
@@ -9,6 +9,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
+ $(GDK_HIDDEN_VISIBILITY_CFLAGS) \
$(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS) \
"-xobjective-c"
diff --git a/gdk/wayland/Makefile.am b/gdk/wayland/Makefile.am
index 5b66090..eed33ad 100644
--- a/gdk/wayland/Makefile.am
+++ b/gdk/wayland/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
+ $(GDK_HIDDEN_VISIBILITY_CFLAGS) \
$(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am
index 492e1c5..ef5f6e8 100644
--- a/gdk/win32/Makefile.am
+++ b/gdk/win32/Makefile.am
@@ -5,14 +5,15 @@ libgdkincludedir = $(includedir)/gtk-3.0/gdk
libgdkwin32includedir = $(includedir)/gtk-3.0/gdk/win32
AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"Gdk\" \
- -DINSIDE_GDK_WIN32 \
- -I$(top_srcdir) \
- -I$(top_srcdir)/gdk \
- -I$(top_builddir)/gdk \
- $(GTK_DEBUG_FLAGS) \
- $(GDK_DEP_CFLAGS) \
- $(GDK_WIN32_EXTRA_CFLAGS)\
+ -DG_LOG_DOMAIN=\"Gdk\" \
+ -DINSIDE_GDK_WIN32 \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/gdk \
+ -I$(top_builddir)/gdk \
+ $(GDK_HIDDEN_VISIBILITY_CFLAGS) \
+ $(GTK_DEBUG_FLAGS) \
+ $(GDK_DEP_CFLAGS) \
+ $(GDK_WIN32_EXTRA_CFLAGS) \
-DGDK_COMPILATION
LDADDS = $(GDK_DEP_LIBS)
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index a00118e..5930f7e 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -4,13 +4,14 @@ include $(top_srcdir)/Makefile.decl
libgdkincludedir = $(includedir)/gtk-3.0/gdk
libgdkx11includedir = $(includedir)/gtk-3.0/gdk/x11
-AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"Gdk\" \
- -DGDK_COMPILATION \
- -I$(top_srcdir) \
- -I$(top_srcdir)/gdk \
- -I$(top_builddir)/gdk \
- $(GTK_DEBUG_FLAGS) \
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Gdk\" \
+ -DGDK_COMPILATION \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/gdk \
+ -I$(top_builddir)/gdk \
+ $(GDK_HIDDEN_VISIBILITY_CFLAGS) \
+ $(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
LDADDS = $(GDK_DEP_LIBS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]