meson: gio/tests: add more gresource tests

This commit is contained in:
Tim-Philipp Müller 2017-02-23 00:40:45 +00:00 committed by Matthias Clasen
parent 2f29ee1735
commit 4e0ef7655d
2 changed files with 72 additions and 2 deletions

View File

@ -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,

View File

@ -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 = [ ]