Small cleanups and makes use of dictionaries instead of nested lists, where appropriate. http://mesonbuild.com/Reference-manual.html#dictionary-object --- meson.build | 32 +++++++++++++++----------------- server/tests/meson.build | 29 +++++++++++++++++------------ 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index b7b7fee7..fee9c8df 100644 --- a/meson.build +++ b/meson.build @@ -71,15 +71,15 @@ spice_protocol_version='>= 0.12.15' glib_version = '2.38' glib_version_info = '>= @0@'.format(glib_version) -deps = [['spice-protocol', spice_protocol_version], - ['glib-2.0', glib_version_info], - ['gio-2.0', glib_version_info], - ['gobject-2.0', glib_version_info], - ['pixman-1', '>= 0.17.7'], - ['openssl', '>= 1.0.0']] - -foreach dep : deps - spice_server_deps += dependency(dep[0], version : dep[1]) +deps = {'spice-protocol' : spice_protocol_version, + 'glib-2.0' : glib_version_info, + 'gio-2.0' : glib_version_info, + 'gobject-2.0' : glib_version_info, + 'pixman-1' : '>= 0.17.7', + 'openssl' : '>= 1.0.0'} + +foreach dep, version : deps + spice_server_deps += dependency(dep, version : version) endforeach # TODO: specify minimum version for jpeg and zlib? @@ -94,17 +94,15 @@ endforeach # # Non-mandatory/optional dependencies # -optional_deps = [ - ['celt051', '>= 0.5.1.1'], - ['opus', '>= 0.9.14'], - ] -foreach dep : optional_deps - option_value = get_option(dep[0]) +optional_deps = {'celt051' : '>= 0.5.1.1', + 'opus' : '>= 0.9.14'} +foreach dep, version : optional_deps + option_value = get_option(dep) if option_value != 'false' - d = dependency(dep[0], required: (option_value == 'true'), version : dep[1]) + d = dependency(dep, required: (option_value == 'true'), version : version) if d.found() spice_server_deps += d - spice_server_config_data.set('HAVE_@0@'.format(dep[0].underscorify().to_upper()), '1') + spice_server_config_data.set('HAVE_@0@'.format(dep.underscorify().to_upper()), '1') endif endif endforeach diff --git a/server/tests/meson.build b/server/tests/meson.build index 1c68030e..23794cc9 100644 --- a/server/tests/meson.build +++ b/server/tests/meson.build @@ -17,12 +17,15 @@ test_libs += static_library('testlib', test_lib_sources, dependencies : test_lib_deps, install : false) -stat_test_libs = [['1', '0', '0'], ['2', '0', '1'], ['3', '1', '0'], ['4', '1', '1']] -foreach t : stat_test_libs - test_libs += static_library('testlib_stat@0@'.format(t[0]), 'stat-test.c', - c_args : ['-DTEST_NAME=stat_test@0@'.format(t[0]), - '-DTEST_COMPRESS_STAT=@0@'.format(t[1]), - '-DTEST_RED_WORKER_STAT=@0@'.format(t[2])], +stat_test_libs = {'testlib_stat1' : ['1', '0', '0'], + 'testlib_stat2' : ['2', '0', '1'], + 'testlib_stat3' : ['3', '1', '0'], + 'testlib_stat4' : ['4', '1', '1']} +foreach lib, params : stat_test_libs + test_libs += static_library(lib, 'stat-test.c', + c_args : ['-DTEST_NAME=stat_test@0@'.format(params[0]), + '-DTEST_COMPRESS_STAT=@0@'.format(params[1]), + '-DTEST_RED_WORKER_STAT=@0@'.format(params[2])], include_directories : test_lib_include, dependencies : test_lib_deps, install : false) @@ -53,27 +56,29 @@ tests = [ ] if spice_server_has_sasl - tests += [['test-sasl', true],] + tests += [['test-sasl', true]] endif if spice_server_has_gstreamer - tests += [['test-gst', false],] + tests += [['test-gst', false]] if get_option('extra-checks') test('video-encoders', files('video-encoders')) endif endif foreach t : tests - exe = executable(t[0], - sources : '@0@.c'.format(t[0]), + test_name = t[0] + is_test = t[1] + exe = executable(test_name, + sources : '@0@.c'.format(test_name), link_with : test_libs, include_directories : test_lib_include, c_args : ['-DSPICE_TOP_SRCDIR="@0@"'.format(meson.source_root())], dependencies : test_lib_deps, install : false) - if t[1] - test(t[0], exe) + if is_test + test(test_name, exe) endif endforeach -- 2.14.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel