Enable GIO tests on Windows

1) Remove the non-Windows-only condition for subdir('tests').
2) Add libiphlpapi, libws2_32 and libsecur32 deps, needed for W32 tests.
3) Remove the -no-undefined argument (gcc doesn't understand it,
   it *does* understand -Wl,-no-undefined; either way, the test
   compiles without this argument just fine; maybe meson adds it
   by itself - you can hardly build shared modules without it).
4) Add or fix a number of includes
5) Disable gdbus-objectmanager tests when building with MSVC
   (right now these tests don't work on Windows anyway, so the fact
    that MSVC can't even build them properly is irrelevant;
    most likely gdbus-codegen needs changes to put _GLIB_EXTERN
    before each function)
This commit is contained in:
Руслан Ижбулатов 2018-09-09 12:46:33 +00:00
parent cf4ea5ef75
commit ad3694b82a
8 changed files with 39 additions and 26 deletions

View File

@ -979,7 +979,4 @@ if enable_systemtap
endif endif
subdir('fam') subdir('fam')
if host_system != 'windows'
subdir('tests') subdir('tests')
endif

View File

@ -29,8 +29,9 @@
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
#include <stdio.h> #include <stdio.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <Windows.h> #include <windows.h>
#include <Shlobj.h> #include <shlobj.h>
#include <io.h> /* for _get_osfhandle */
#endif #endif
#define TEST_NAME "Prilis zlutoucky kun" #define TEST_NAME "Prilis zlutoucky kun"

View File

@ -22,7 +22,9 @@
#include <gio/gio.h> #include <gio/gio.h>
#include <string.h> #include <string.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include <dbus/dbus.h> #include <dbus/dbus.h>
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -19,7 +19,9 @@
*/ */
#include <gio/gio.h> #include <gio/gio.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include "gdbus-tests.h" #include "gdbus-tests.h"

View File

@ -5,6 +5,10 @@ common_gio_tests_deps = [
libgio_dep, libgio_dep,
] ]
if host_machine.system() == 'windows'
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
endif
subdir('gdbus-object-manager-example') subdir('gdbus-object-manager-example')
gengiotypefuncs_prog = find_program('gengiotypefuncs.py') gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
@ -321,6 +325,10 @@ test_extra_programs += [{
'extra_sources' : ['gtlsconsoleinteraction.c'], 'extra_sources' : ['gtlsconsoleinteraction.c'],
'install' : false, 'install' : false,
}, },
}]
if cc.get_id() != 'msvc'
test_extra_programs += [{
# These three are manual-run tests because they need a session bus but don't bring one up themselves # These three are manual-run tests because they need a session bus but don't bring one up themselves
# FIXME: these build but don't seem to work! # FIXME: these build but don't seem to work!
'gdbus-example-objectmanager-client' : { 'gdbus-example-objectmanager-client' : {
@ -336,6 +344,7 @@ test_extra_programs += [{
'install' : false, 'install' : false,
}, },
}] }]
endif
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
test_extra_programs += [{ test_extra_programs += [{
@ -357,13 +366,8 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--c-name', '_g_plugin', '--c-name', '_g_plugin',
'@INPUT@']) '@INPUT@'])
if host_system == 'windows'
resource_plugin_platform_link_args = ['-no-undefined']
else
resource_plugin_platform_link_args = []
endif
shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c, shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
link_args : export_dynamic_ldflags + resource_plugin_platform_link_args, link_args : export_dynamic_ldflags,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps)
test_gresource = custom_target('test.gresource', test_gresource = custom_target('test.gresource',

View File

@ -20,6 +20,8 @@
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
*/ */
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h> #include <gio/gio.h>
#include "symbol-visibility.h" #include "symbol-visibility.h"

View File

@ -20,6 +20,8 @@
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
*/ */
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h> #include <gio/gio.h>
#include "symbol-visibility.h" #include "symbol-visibility.h"

View File

@ -6,6 +6,9 @@
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef G_OS_WIN32
#include <io.h> /* for close() */
#endif
static const char *original_data = "This is some test data that we can put in a file..."; static const char *original_data = "This is some test data that we can put in a file...";
static const char *new_data = "new data.."; static const char *new_data = "new data..";