diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2018-09-24 09:36:21 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2018-09-24 09:36:21 +0100 |
commit | 62d4c0b179555fa0189d2c8a8e2d81da04a5bc3d (patch) | |
tree | 264e4ef4bb02ca271f2d13804b31e76b939784c9 | |
parent | ff51e9a68d0b140a03de5b0d9c72283006e7b215 (diff) |
libs: fix API export/import and 'inconsistent linkage' on MSVC
Export rtsp-server library API in headers when we're building the
library itself, otherwise import the API from the headers.
This fixes linker warnings on Windows when building with MSVC.
Fix up some missing config.h includes when building the lib which
is needed to get the export api define from config.h
https://bugzilla.gnome.org/show_bug.cgi?id=797185
24 files changed, 84 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 9d6790b..214da35 100644 --- a/configure.ac +++ b/configure.ac @@ -258,7 +258,13 @@ fi AC_SUBST(DEPRECATED_CFLAGS) VISIBILITY_CFLAGS="" -AS_COMPILER_FLAG([-fvisibility=hidden], [VISIBILITY_CFLAGS="-fvisibility=hidden"]) +AS_COMPILER_FLAG([-fvisibility=hidden], [ + VISIBILITY_CFLAGS="-fvisibility=hidden" + AC_DEFINE(GST_API_EXPORT, [extern __attribute__ ((visibility ("default")))], [public symbol export define]) +], [ + VISIBILITY_CFLAGS="" + AC_DEFINE(GST_API_EXPORT, [extern], [public symbol export define]) +]) AC_SUBST(VISIBILITY_CFLAGS) dnl disable strict aliasing diff --git a/gst/rtsp-server/Makefile.am b/gst/rtsp-server/Makefile.am index e2fff13..d08de4e 100644 --- a/gst/rtsp-server/Makefile.am +++ b/gst/rtsp-server/Makefile.am @@ -59,7 +59,7 @@ libgstrtspserver_@GST_API_VERSION@_la_SOURCES = \ libgstrtspserver_@GST_API_VERSION@_la_CFLAGS = \ $(GST_PLUGINS_BASE_CFLAGS) $(GST_NET_CFLAGS) \ - $(GST_BASE_CFLAGS) $(GST_CFLAGS) + $(GST_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_RTSP_SERVER libgstrtspserver_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) libgstrtspserver_@GST_API_VERSION@_la_LIBADD = \ $(GST_PLUGINS_BASE_LIBS) $(GST_NET_LIBS) $(GST_BASE_LIBS) \ diff --git a/gst/rtsp-server/meson.build b/gst/rtsp-server/meson.build index d0fbde1..b798b88 100644 --- a/gst/rtsp-server/meson.build +++ b/gst/rtsp-server/meson.build @@ -48,7 +48,7 @@ gst_rtsp_server_deps = [gstrtsp_dep, gstrtp_dep, gstsdp_dep, gstnet_dep, gstapp_ gst_rtsp_server = library('gstrtspserver-@0@'.format(api_version), rtsp_server_sources, include_directories : rtspserver_incs, - c_args: rtspserver_args, + c_args: rtspserver_args + ['-DBUILDING_GST_RTSP_SERVER'], version : libversion, soversion : soversion, darwin_versions : osxversion, diff --git a/gst/rtsp-server/rtsp-address-pool.c b/gst/rtsp-server/rtsp-address-pool.c index 5b032bf..da3e82b 100644 --- a/gst/rtsp-server/rtsp-address-pool.c +++ b/gst/rtsp-server/rtsp-address-pool.c @@ -36,6 +36,9 @@ * * Last reviewed on 2013-07-16 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> #include <gio/gio.h> diff --git a/gst/rtsp-server/rtsp-auth.c b/gst/rtsp-server/rtsp-auth.c index c0bcdb1..e691196 100644 --- a/gst/rtsp-server/rtsp-auth.c +++ b/gst/rtsp-server/rtsp-auth.c @@ -45,6 +45,9 @@ * * Last reviewed on 2013-07-16 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 2e124f8..a55aae4 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -40,6 +40,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <stdio.h> #include <string.h> diff --git a/gst/rtsp-server/rtsp-context.c b/gst/rtsp-server/rtsp-context.c index def64f2..4f08407 100644 --- a/gst/rtsp-server/rtsp-context.c +++ b/gst/rtsp-server/rtsp-context.c @@ -23,6 +23,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "rtsp-context.h" diff --git a/gst/rtsp-server/rtsp-media-factory-uri.c b/gst/rtsp-server/rtsp-media-factory-uri.c index 7100b16..93ed9d7 100644 --- a/gst/rtsp-server/rtsp-media-factory-uri.c +++ b/gst/rtsp-server/rtsp-media-factory-uri.c @@ -29,6 +29,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-media-factory.c b/gst/rtsp-server/rtsp-media-factory.c index 57ced46..904124d 100644 --- a/gst/rtsp-server/rtsp-media-factory.c +++ b/gst/rtsp-server/rtsp-media-factory.c @@ -37,6 +37,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "rtsp-media-factory.h" diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index 1073b89..b39fc93 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -62,6 +62,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <stdio.h> #include <string.h> diff --git a/gst/rtsp-server/rtsp-mount-points.c b/gst/rtsp-server/rtsp-mount-points.c index 15685ba..7679485 100644 --- a/gst/rtsp-server/rtsp-mount-points.c +++ b/gst/rtsp-server/rtsp-mount-points.c @@ -34,6 +34,10 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <string.h> #include "rtsp-mount-points.h" diff --git a/gst/rtsp-server/rtsp-params.c b/gst/rtsp-server/rtsp-params.c index 6025722..5fa27af 100644 --- a/gst/rtsp-server/rtsp-params.c +++ b/gst/rtsp-server/rtsp-params.c @@ -23,6 +23,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-permissions.c b/gst/rtsp-server/rtsp-permissions.c index 1667db7..eb12548 100644 --- a/gst/rtsp-server/rtsp-permissions.c +++ b/gst/rtsp-server/rtsp-permissions.c @@ -36,6 +36,9 @@ * * Last reviewed on 2013-07-15 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-sdp.c b/gst/rtsp-server/rtsp-sdp.c index 04329dd..6d552f2 100644 --- a/gst/rtsp-server/rtsp-sdp.c +++ b/gst/rtsp-server/rtsp-sdp.c @@ -26,6 +26,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-server-prelude.h b/gst/rtsp-server/rtsp-server-prelude.h index 4f0dca8..ac4ad2c 100644 --- a/gst/rtsp-server/rtsp-server-prelude.h +++ b/gst/rtsp-server/rtsp-server-prelude.h @@ -25,7 +25,11 @@ #include <gst/gst.h> #ifndef GST_RTSP_SERVER_API -#define GST_RTSP_SERVER_API GST_EXPORT +# ifdef BUILDING_GST_RTSP_SERVER +# define GST_RTSP_SERVER_API GST_API_EXPORT /* from config.h */ +# else +# define GST_RTSP_SERVER_API GST_API_IMPORT +# endif #endif #endif /* __GST_RTSP_SERVER_PRELUDE_H__ */ diff --git a/gst/rtsp-server/rtsp-server.c b/gst/rtsp-server/rtsp-server.c index 0a0b912..de409e0 100644 --- a/gst/rtsp-server/rtsp-server.c +++ b/gst/rtsp-server/rtsp-server.c @@ -52,6 +52,10 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> diff --git a/gst/rtsp-server/rtsp-session-media.c b/gst/rtsp-server/rtsp-session-media.c index c3bac97..26b7143 100644 --- a/gst/rtsp-server/rtsp-session-media.c +++ b/gst/rtsp-server/rtsp-session-media.c @@ -34,6 +34,9 @@ * * Last reviewed on 2013-07-16 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-session-pool.c b/gst/rtsp-server/rtsp-session-pool.c index 8f45e28..b09db93 100644 --- a/gst/rtsp-server/rtsp-session-pool.c +++ b/gst/rtsp-server/rtsp-session-pool.c @@ -39,6 +39,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "rtsp-session-pool.h" diff --git a/gst/rtsp-server/rtsp-session.c b/gst/rtsp-server/rtsp-session.c index 37945f8..e399349 100644 --- a/gst/rtsp-server/rtsp-session.c +++ b/gst/rtsp-server/rtsp-session.c @@ -42,6 +42,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-stream-transport.c b/gst/rtsp-server/rtsp-stream-transport.c index 99af1ae..a258025 100644 --- a/gst/rtsp-server/rtsp-stream-transport.c +++ b/gst/rtsp-server/rtsp-stream-transport.c @@ -40,6 +40,9 @@ * * Last reviewed on 2013-07-16 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> #include <stdlib.h> diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 65f0f5d..81054e0 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -45,6 +45,9 @@ * * Last reviewed on 2013-07-16 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <stdlib.h> #include <stdio.h> diff --git a/gst/rtsp-server/rtsp-thread-pool.c b/gst/rtsp-server/rtsp-thread-pool.c index 4e14447..6c53a01 100644 --- a/gst/rtsp-server/rtsp-thread-pool.c +++ b/gst/rtsp-server/rtsp-thread-pool.c @@ -46,6 +46,9 @@ * * Last reviewed on 2013-07-11 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/gst/rtsp-server/rtsp-token.c b/gst/rtsp-server/rtsp-token.c index 733546f..4062d30 100644 --- a/gst/rtsp-server/rtsp-token.c +++ b/gst/rtsp-server/rtsp-token.c @@ -35,6 +35,9 @@ * * Last reviewed on 2013-07-15 (1.0.0) */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> diff --git a/meson.build b/meson.build index 88b0ec7..6b748c3 100644 --- a/meson.build +++ b/meson.build @@ -30,15 +30,25 @@ plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir')) cc = meson.get_compiler('c') +cdata = configuration_data() + if cc.has_link_argument('-Wl,-Bsymbolic-functions') add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c') endif # Symbol visibility -if cc.has_argument('-fvisibility=hidden') +if cc.get_id() == 'msvc' + export_define = '__declspec(dllexport) extern' +elif cc.has_argument('-fvisibility=hidden') add_project_arguments('-fvisibility=hidden', language: 'c') + export_define = 'extern __attribute__ ((visibility ("default")))' +else + export_define = 'extern' endif +# Passing this through the command line would be too messy +cdata.set('GST_API_EXPORT', export_define) + # Disable strict aliasing if cc.has_argument('-fno-strict-aliasing') add_project_arguments('-fno-strict-aliasing', language: 'c') @@ -68,7 +78,6 @@ if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev) add_project_arguments('-DG_DISABLE_CHECKS', language: 'c') endif -cdata = configuration_data() cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0') cdata.set_quoted('PACKAGE', 'gst-rtsp-server') cdata.set_quoted('VERSION', gst_version) |