From 4e0ef7655de3692e10d17f56224310ccb3f6cf9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 23 Feb 2017 00:40:45 +0000 Subject: [PATCH] meson: gio/tests: add more gresource tests --- gio/meson.build | 2 +- gio/tests/meson.build | 72 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/gio/meson.build b/gio/meson.build index c889900c6..1ac759782 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -779,7 +779,7 @@ executable('glib-compile-schemas', link_args : noseh_link_args, dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) -executable('glib-compile-resources', +glib_compile_resources = executable('glib-compile-resources', [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'], install : true, c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args, diff --git a/gio/tests/meson.build b/gio/tests/meson.build index 3bc644a3c..1f9da53d2 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -182,7 +182,77 @@ foreach extra_program : uninstalled_test_extra_programs + test_extra_programs dependencies : [libglib_dep, libgmodule_dep, libgio_dep] + extra_deps) endforeach -# FIXME: Add resources test +if not meson.is_cross_build() or meson.has_exe_wrapper() + + plugin_resources_c = custom_target('plugin-resources.c', + input : 'test4.gresource.xml', + output : 'plugin-resources.c', + command : [glib_compile_resources, + '--target=@OUTPUT@', + '--sourcedir=' + meson.current_source_dir(), + '--generate-source', + '--c-name', '_g_plugin', + '@INPUT@']) + + # -module -export-dynamic + on win32_platform -no-undefined + shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c, + link_args : ['-export-dynamic'], + dependencies : [libglib_dep, libgmodule_dep, libgio_dep]) + + test_gresource = custom_target('test.gresource', + input : 'test.gresource.xml', + output : 'test.gresource', + command : [glib_compile_resources, + '--target=@OUTPUT@', + '--sourcedir=' + meson.current_source_dir(), + '--sourcedir=' + meson.current_build_dir(), + '@INPUT@']) + + test_resources2_c = custom_target('test_resources2.c', + input : 'test3.gresource.xml', + output : 'test_resources2.c', + command : [glib_compile_resources, + '--target=@OUTPUT@', + '--sourcedir=' + meson.current_source_dir(), + '--generate', + '--c-name', '_g_test2', + '--manual-register', + '@INPUT@']) + + test_resources2_h = custom_target('test_resources2.h', + input : 'test3.gresource.xml', + output : 'test_resources2.h', + command : [glib_compile_resources, + '--target=@OUTPUT@', + '--sourcedir=' + meson.current_source_dir(), + '--generate', + '--c-name', '_g_test2', + '--manual-register', + '@INPUT@']) + + test_resources_c = custom_target('test_resources.c', + input : 'test2.gresource.xml', + output : 'test_resources.c', + command : [glib_compile_resources, + '--target=@OUTPUT@', + '--sourcedir=' + meson.current_source_dir(), + '--generate-source', + '--c-name', '_g_test1', + '@INPUT@']) + + # referenced by test.gresource.xml + test_generated_txt = configure_file(input : 'test1.txt', + output : 'test-generated.txt', + configuration : configuration_data(), + install : false) + + exe = executable('resources', 'resources.c', test_gresource, + test_resources_c, test_resources2_c, test_resources2_h, + install : false, + c_args : test_c_args, + dependencies : [libglib_dep, libgmodule_dep, libgio_dep]) + test('resources', exe, env : test_env) +endif foo = ''' c_args_atomic = [ ]