Commit 62d4c0b1 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

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
parent ff51e9a6
......@@ -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
......
......@@ -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) \
......
......@@ -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,
......
......@@ -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>
......
......@@ -45,6 +45,9 @@
*
* Last reviewed on 2013-07-16 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -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>
......
......@@ -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"
......
......@@ -29,6 +29,9 @@
*
* Last reviewed on 2013-07-11 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -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"
......
......@@ -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>
......
......@@ -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"
......
......@@ -23,6 +23,9 @@
*
* Last reviewed on 2013-07-11 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -36,6 +36,9 @@
*
* Last reviewed on 2013-07-15 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -26,6 +26,9 @@
*
* Last reviewed on 2013-07-11 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.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__ */
......@@ -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>
......
......@@ -34,6 +34,9 @@
*
* Last reviewed on 2013-07-16 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -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"
......
......@@ -42,6 +42,9 @@
*
* Last reviewed on 2013-07-11 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -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>
......
......@@ -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>
......
......@@ -46,6 +46,9 @@
*
* Last reviewed on 2013-07-11 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -35,6 +35,9 @@
*
* Last reviewed on 2013-07-15 (1.0.0)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment