mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
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.
This commit is contained in:
parent
f5f5b70355
commit
8af16c5d44
33
configure.ac
33
configure.ac
@ -1673,6 +1673,39 @@ else
|
||||
AC_MSG_RESULT([no])
|
||||
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
|
||||
##################################################
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user