mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
gstconfig: Decide GST_EXPORT declaration style at build time
We only use GST_EXPORT consistently when building with MSVC by using the visual studio definitions files (win32/common/*.def), so always disable it when building with Autotools and only enable it with Meson when building with MSVC. This allows you to use MinGW to link to a GStreamer built with MSVC and get the correct function prototypes to find functions and variables in DLLs.
This commit is contained in:
parent
c7e8b062e3
commit
22b892b44f
3 changed files with 19 additions and 5 deletions
|
@ -131,6 +131,11 @@ AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
|
||||||
["${srcdir}/gstreamer.doap"],
|
["${srcdir}/gstreamer.doap"],
|
||||||
[$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
|
[$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
|
||||||
|
|
||||||
|
# We only use this when building with MSVC, which is only done with the
|
||||||
|
# alternate Meson build system files
|
||||||
|
GSTCONFIG_USE_MSVC_DECLSPEC=0
|
||||||
|
AC_SUBST(GSTCONFIG_USE_MSVC_DECLSPEC)
|
||||||
|
|
||||||
dnl check for bash completion
|
dnl check for bash completion
|
||||||
AC_ARG_WITH([bash-completion-dir],
|
AC_ARG_WITH([bash-completion-dir],
|
||||||
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
|
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
|
||||||
|
|
|
@ -128,20 +128,21 @@
|
||||||
* On Windows, this exports the plugin definition from the DLL.
|
* On Windows, this exports the plugin definition from the DLL.
|
||||||
* On other platforms, this gets defined as a no-op.
|
* On other platforms, this gets defined as a no-op.
|
||||||
*/
|
*/
|
||||||
/* Macro _WIN32 is defined on 32-bit and 64-bit Windows; by both GCC and MSVC
|
/* Only use __declspec(dllexport/import) when we have been built with MSVC.
|
||||||
|
* With MinGW we still rely on the linker to auto-export/import symbols.
|
||||||
*
|
*
|
||||||
* NOTE: To link to Windows statically on Windows, you must define
|
* NOTE: To link to GStreamer statically on Windows, you must define
|
||||||
* GST_STATIC_COMPILATION or the prototypes will cause the compiler to search
|
* GST_STATIC_COMPILATION or the prototypes will cause the compiler to search
|
||||||
* for the symbol inside a DLL
|
* for the symbol inside a DLL.
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32) && !defined(GST_STATIC_COMPILATION)
|
#if @GSTCONFIG_USE_MSVC_DECLSPEC@ && !defined(GST_STATIC_COMPILATION)
|
||||||
# define GST_PLUGIN_EXPORT __declspec(dllexport)
|
# define GST_PLUGIN_EXPORT __declspec(dllexport)
|
||||||
# ifdef GST_EXPORTS
|
# ifdef GST_EXPORTS
|
||||||
# define GST_EXPORT __declspec(dllexport)
|
# define GST_EXPORT __declspec(dllexport)
|
||||||
# else
|
# else
|
||||||
# define GST_EXPORT __declspec(dllimport) extern
|
# define GST_EXPORT __declspec(dllimport) extern
|
||||||
# endif
|
# endif
|
||||||
#else /* !_WIN32 */
|
#else
|
||||||
# define GST_PLUGIN_EXPORT
|
# define GST_PLUGIN_EXPORT
|
||||||
# if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
|
# if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
|
||||||
# define GST_EXPORT extern __attribute__ ((visibility ("default")))
|
# define GST_EXPORT extern __attribute__ ((visibility ("default")))
|
||||||
|
|
|
@ -221,6 +221,14 @@ if cc.has_function('strsignal', prefix : '#include <string.h>')
|
||||||
cdata.set('HAVE_DECL_STRSIGNAL', 1)
|
cdata.set('HAVE_DECL_STRSIGNAL', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# We only want to use the __declspec(dllexport/import) dance in GST_EXPORT when
|
||||||
|
# building with MSVC
|
||||||
|
if cc.get_id() == 'msvc'
|
||||||
|
cdata.set('GSTCONFIG_USE_MSVC_DECLSPEC', 1)
|
||||||
|
else
|
||||||
|
cdata.set('GSTCONFIG_USE_MSVC_DECLSPEC', 0)
|
||||||
|
endif
|
||||||
|
|
||||||
configure_file(input : 'config.h.meson',
|
configure_file(input : 'config.h.meson',
|
||||||
output : 'config.h',
|
output : 'config.h',
|
||||||
configuration : cdata)
|
configuration : cdata)
|
||||||
|
|
Loading…
Reference in a new issue