meson: make check and tests build on Windows with msvc
authorHåvard Graff <havard.graff@gmail.com>
Wed, 8 Nov 2017 19:05:03 +0000 (20:05 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 11 Jan 2018 09:50:24 +0000 (09:50 +0000)
libs/gst/check/libcheck/check.h.in
libs/gst/check/libcheck/libcompat/libcompat.h
libs/gst/check/libcheck/meson.build
libs/gst/check/meson.build
libs/gst/meson.build
pkgconfig/meson.build
tests/meson.build

index fa7483c..9eb40bc 100644 (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
index a263ad2..b88121b 100644 (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 */
index 176049a..8511064 100644 (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',
index 34896b7..ff82ce7 100644 (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,
index aef3119..38dcec9 100644 (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
index 71f38b9..edb0586 100644 (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'
index e6b1cfd..a53dcf8 100644 (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