From fbbe6c646e50de5d6ad78a4964c01e5f13fe3fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Graff?= Date: Wed, 8 Nov 2017 20:05:03 +0100 Subject: [PATCH] meson: make check and tests build on Windows with msvc --- libs/gst/check/libcheck/check.h.in | 17 ++++++++++++++++- libs/gst/check/libcheck/libcompat/libcompat.h | 2 ++ libs/gst/check/libcheck/meson.build | 6 +++++- libs/gst/check/meson.build | 2 +- libs/gst/meson.build | 3 --- pkgconfig/meson.build | 6 ++---- tests/meson.build | 3 --- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/libs/gst/check/libcheck/check.h.in b/libs/gst/check/libcheck/check.h.in index fa7483c457..9eb40bcd1e 100644 --- a/libs/gst/check/libcheck/check.h.in +++ b/libs/gst/check/libcheck/check.h.in @@ -54,19 +54,26 @@ CK_CPPSTART #define CK_ATTRIBUTE_NORETURN #endif /* GCC 2.5 */ #include + /* * 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 diff --git a/libs/gst/check/libcheck/libcompat/libcompat.h b/libs/gst/check/libcheck/libcompat/libcompat.h index a263ad2d37..b88121bcf2 100644 --- a/libs/gst/check/libcheck/libcompat/libcompat.h +++ b/libs/gst/check/libcheck/libcompat/libcompat.h @@ -58,6 +58,8 @@ #include /* struct timeval, API used in gettimeofday implementation */ #include /* read, write */ #include /* getpid */ +#include /* for ssize_t */ +typedef SSIZE_T ssize_t; #endif /* _MSC_VER */ /* defines size_t */ diff --git a/libs/gst/check/libcheck/meson.build b/libs/gst/check/libcheck/meson.build index 176049a85a..8511064699 100644 --- a/libs/gst/check/libcheck/meson.build +++ b/libs/gst/check/libcheck/meson.build @@ -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', diff --git a/libs/gst/check/meson.build b/libs/gst/check/meson.build index 34896b71c1..ff82ce783e 100644 --- a/libs/gst/check/meson.build +++ b/libs/gst/check/meson.build @@ -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, diff --git a/libs/gst/meson.build b/libs/gst/meson.build index aef3119880..38dcec9354 100644 --- a/libs/gst/meson.build +++ b/libs/gst/meson.build @@ -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 diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build index 71f38b9536..edb0586c2d 100644 --- a/pkgconfig/meson.build +++ b/pkgconfig/meson.build @@ -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' diff --git a/tests/meson.build b/tests/meson.build index e6b1cfd264..a53dcf8b87 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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