| 1 |
# There are two tests here, because the 2nd one depends on a version of |
| 2 |
# GLib (2.51.1) that is very recent at the time of writing. |
| 3 |
|
| 4 |
simple_gresource = configure_file( |
| 5 |
input : 'simple.gresource.xml', |
| 6 |
output : 'simple-gen.gresource.xml', |
| 7 |
command : [copyfile, '@INPUT@', '@OUTPUT@']) |
| 8 |
|
| 9 |
simple_resources = gnome.compile_resources('simple-resources', |
| 10 |
simple_gresource, |
| 11 |
install_header : true, |
| 12 |
export : true, |
| 13 |
source_dir : '../resources-data', |
| 14 |
c_name : 'simple_resources') |
| 15 |
|
| 16 |
simple_res_exe = executable('simple-resources-test', |
| 17 |
'simple-main.c', simple_resources, |
| 18 |
dependencies: gio) |
| 19 |
test('simple resource test', simple_res_exe) |
| 20 |
|
| 21 |
gnome.compile_resources('simple-resources', |
| 22 |
'simple.gresource.xml', |
| 23 |
gresource_bundle: true, |
| 24 |
install: true, |
| 25 |
install_dir: get_option('datadir'), |
| 26 |
source_dir : '../resources-data', |
| 27 |
) |
| 28 |
test('simple resource test (gresource)', find_program('resources.py')) |
| 29 |
|
| 30 |
if not pretend_glib_old and glib.version() >= '2.52.0' |
| 31 |
# This test cannot pass if GLib version is too old. Generated resource |
| 32 |
# dependencies do not work correctly and Meson will raise an error if the |
| 33 |
# user tries to use either the 'dependencies' kwarg or a gresource file that |
| 34 |
# is itself generated. |
| 35 |
generated_resources = gnome.compile_resources('generated-resources', |
| 36 |
'generated.gresource.xml', |
| 37 |
source_dir : '../resources-data', |
| 38 |
c_name : 'generated_resources', |
| 39 |
dependencies : [res3_txt, res4_txt]) |
| 40 |
|
| 41 |
generated_res_exe = executable('generated-resources-test', |
| 42 |
'generated-main.c', generated_resources, |
| 43 |
dependencies: gio) |
| 44 |
test('generated resource test', generated_res_exe) |
| 45 |
|
| 46 |
# Test with a CustomTarget |
| 47 |
subdir('generated') |
| 48 |
|
| 49 |
ct_resources = gnome.compile_resources( |
| 50 |
'ct-resources', |
| 51 |
ct_simple_gresource, |
| 52 |
install_header : true, |
| 53 |
export : true, |
| 54 |
source_dir : '../resources-data', |
| 55 |
c_name : 'simple_resources') |
| 56 |
|
| 57 |
cti_resources = gnome.compile_resources( |
| 58 |
'cti-resources', |
| 59 |
ct_simple_gresource[0], |
| 60 |
install_header : true, |
| 61 |
export : true, |
| 62 |
source_dir : '../resources-data', |
| 63 |
c_name : 'simple_resources') |
| 64 |
endif |
| 65 |
|
| 66 |
# Test build_by_default |
| 67 |
gnome.compile_resources('build-resources', |
| 68 |
'simple.gresource.xml', |
| 69 |
gresource_bundle : true, |
| 70 |
build_by_default : true, |
| 71 |
source_dir : '../resources-data', |
| 72 |
) |