meson: make check and tests build on Windows with msvc

This commit is contained in:
Håvard Graff 2017-11-08 20:05:03 +01:00 committed by Tim-Philipp Müller
parent 9d335a80d0
commit fbbe6c646e
7 changed files with 26 additions and 13 deletions

View file

@ -54,19 +54,26 @@ CK_CPPSTART
#define CK_ATTRIBUTE_NORETURN
#endif /* GCC 2.5 */
#include <sys/types.h>
/*
* Used to create the linker script for hiding lib-local symbols. Shall
* be put directly in front of the exported symbol.
*/
#define CK_EXPORT
/*
* Used for MSVC to create the export attribute
* CK_DLL_EXP is defined during the compilation of the library
* on the command line.
*/
#ifndef CK_DLL_EXP
#define CK_DLL_EXP extern
# if defined(_MSC_VER)
# define CK_DLL_EXP __declspec(dllimport)
# else
# define CK_DLL_EXP extern
# endif
#endif
/* check version numbers */
#define CHECK_MAJOR_VERSION (@CHECK_MAJOR_VERSION@)
#define CHECK_MINOR_VERSION (@CHECK_MINOR_VERSION@)
@ -79,6 +86,10 @@ CK_DLL_EXP /*extern*/ int CK_EXPORT check_micro_version;
#define NULL ((void*)0)
#endif
#if defined(_MSC_VER)
#define pid_t int
#endif
/**
* Type for a test case
*
@ -1296,7 +1307,9 @@ CK_DLL_EXP void CK_EXPORT srunner_set_fork_status (SRunner * sr,
*
* @since 0.9.3
*/
#if !defined(_MSC_VER)
CK_DLL_EXP pid_t CK_EXPORT check_fork (void);
#endif
/**
* Wait for the pid and exit.
@ -1313,9 +1326,11 @@ CK_DLL_EXP pid_t CK_EXPORT check_fork (void);
*
* @since 0.9.3
*/
#if !defined(_MSC_VER)
CK_DLL_EXP void CK_EXPORT
check_waitpid_and_exit (pid_t pid)
CK_ATTRIBUTE_NORETURN;
#endif
#ifdef __cplusplus
CK_CPPEND

View file

@ -58,6 +58,8 @@
#include <WinSock2.h> /* struct timeval, API used in gettimeofday implementation */
#include <io.h> /* read, write */
#include <process.h> /* getpid */
#include <BaseTsd.h> /* for ssize_t */
typedef SSIZE_T ssize_t;
#endif /* _MSC_VER */
/* defines size_t */

View file

@ -58,7 +58,11 @@ internal_check_h_inc = include_directories('..')
if have_visibility_hidden
libcheck_visibility_args = ['-DCK_DLL_EXP=extern __attribute__ ((visibility ("default")))']
else
libcheck_visibility_args = ['-DCK_DLL_EXP=extern']
if host_system == 'windows'
libcheck_visibility_args = ['-DCK_DLL_EXP=__declspec(dllexport)']
else
libcheck_visibility_args = ['-DCK_DLL_EXP=extern']
endif
endif
libcheck = static_library('check',

View file

@ -38,7 +38,7 @@ configure_file(input : 'libcheck/check.h.in',
gst_check = shared_library('gstcheck-@0@'.format(apiversion),
gst_check_sources,
c_args : gst_c_args,
c_args : gst_c_args + ['-DGST_EXPORTS'],
version : libversion,
soversion : soversion,
install : true,

View file

@ -2,7 +2,4 @@ subdir('base')
subdir('controller')
subdir('net')
subdir('helpers')
# FIXME: make check work on windows
if host_machine.system() != 'windows'
subdir('check')
endif

View file

@ -24,14 +24,12 @@ pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
pkg_files = ['gstreamer-base',
'gstreamer-controller',
'gstreamer-check',
'gstreamer-net',
'gstreamer'
]
if host_machine.system() != 'windows'
pkgconf.set('checklibdir', join_paths(meson.build_root(), gst_check.outdir()))
pkg_files += ['gstreamer-check']
endif
pkgconf.set('checklibdir', join_paths(meson.build_root(), gst_check.outdir()))
foreach p : pkg_files
infile = p + '.pc.in'

View file

@ -1,8 +1,5 @@
subdir('benchmarks')
# FIXME: make check work on windows
if host_machine.system() != 'windows'
subdir('check')
endif
if not get_option('disable_examples')
subdir('examples')
endif