diff options
-rw-r--r-- | data/meson.build | 9 | ||||
-rw-r--r-- | doc/meson.build | 33 | ||||
-rw-r--r-- | libgupnp-av/meson.build | 82 | ||||
-rw-r--r-- | meson.build | 90 | ||||
-rw-r--r-- | meson_options.txt | 3 | ||||
-rw-r--r-- | tests/gtest/meson.build | 29 | ||||
-rw-r--r-- | tests/meson.build | 35 | ||||
-rw-r--r-- | vala/meson.build | 10 |
8 files changed, 291 insertions, 0 deletions
diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..d14bf7b --- /dev/null +++ b/data/meson.build @@ -0,0 +1,9 @@ +install_data( + [ + 'av.xsd', + 'didl-lite-v2.xsd', + 'simpledc20021212.xsd', + 'upnp.xsd', + 'xml.xsd' + ] +) diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 0000000..50942f3 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,33 @@ +conf = configuration_data() +conf.set('VERSION', meson.project_version()) + +version_xml = configure_file( + input : 'version.xml.in', + output : 'version.xml', + configuration: conf +) + +gnome.gtkdoc( + 'gupnp-av', + src_dir : [ + join_paths(meson.source_root(), 'libgupnp-av'), + join_paths(meson.build_root(), 'libgupnp-av'), + ], + main_sgml : 'gupnp-av-docs.sgml', + content_files : version_xml, + scan_args : ['--deprecated-guards=GUPNP_DISABLE_DEPRECATED'], + mkdb_args : ['--sgml-mode', '--output-format=xml'], + dependencies : gupnp_av, + ignore_headers : [ + 'xml-util.h', + 'xsd-data.h', + 'fragment-util.h', + 'gvalue-util.h', + 'gupnp-av-marshal.h', + 'gunpp-didl-lite-contributor-private.h', + 'gupnp-didl-lite-descriptior-private.h', + 'gupnp-didl-lite-object-private.h', + 'gupnp-didl-lite-resource-private.h' + ], + install : true +) diff --git a/libgupnp-av/meson.build b/libgupnp-av/meson.build new file mode 100644 index 0000000..eee66a4 --- /dev/null +++ b/libgupnp-av/meson.build @@ -0,0 +1,82 @@ +marshall_sources = gnome.genmarshal('gupnp-av-marshal', prefix : 'gupnp_av_marshal', sources : 'gupnp-av-marshal.list') + +introspection_sources = [ + 'gupnp-av-error.c', + 'gupnp-cds-last-change-parser.c', + 'gupnp-didl-lite-container.c', + 'gupnp-didl-lite-contributor.c', + 'gupnp-didl-lite-createclass.c', + 'gupnp-didl-lite-descriptor.c', + 'gupnp-didl-lite-item.c', + 'gupnp-didl-lite-object.c', + 'gupnp-didl-lite-parser.c', + 'gupnp-didl-lite-resource.c', + 'gupnp-didl-lite-writer.c', + 'gupnp-dlna.c', + 'gupnp-feature.c', + 'gupnp-feature-list-parser.c', + 'gupnp-last-change-parser.c', + 'gupnp-media-collection.c', + 'gupnp-protocol-info.c', + 'gupnp-search-criteria-parser.c' +] + + +gupnp_av_lib = library('gupnp-av-1.0', + [ + introspection_sources, + 'fragment-util.c', + 'gvalue-util.c', + 'time-utils.c', + 'xml-util.c', + 'xsd-data.c', + marshall_sources + ], + install: true, + version : '2.0.0', + c_args : common_cflags + ['-DDATADIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'gupnp-av'))], + dependencies : [gobject, libxml] +) +gupnp_av = declare_dependency(link_with : gupnp_av_lib, include_directories : include_directories('..')) + +public_headers = [ + 'gupnp-av-enums.h', + 'gupnp-av-error.h', + 'gupnp-av.h', + 'gupnp-cds-last-change-parser.h', + 'gupnp-didl-lite-container.h', + 'gupnp-didl-lite-contributor.h', + 'gupnp-didl-lite-createclass.h', + 'gupnp-didl-lite-descriptor.h', + 'gupnp-didl-lite-item.h', + 'gupnp-didl-lite-object.h', + 'gupnp-didl-lite-parser.h', + 'gupnp-didl-lite-resource.h', + 'gupnp-didl-lite-writer.h', + 'gupnp-dlna.h', + 'gupnp-feature.h', + 'gupnp-feature-list-parser.h', + 'gupnp-last-change-parser.h', + 'gupnp-media-collection.h', + 'gupnp-protocol-info.h', + 'gupnp-search-criteria-parser.h', +] + +install_headers( + public_headers, + subdir : 'gupnp-av-1.0/libgupnp-av' +) + +if get_option('introspection') + gupnp_av_gir = gnome.generate_gir( + gupnp_av_lib, + sources : [public_headers, introspection_sources], + namespace : 'GUPnPAV', + nsversion : '1.0', + identifier_prefix : 'GUPnP', + symbol_prefix : 'gupnp', + export_packages : 'gupnp-av-1.0', + includes : ['GObject-2.0', 'libxml2-2.0'], + install : true + ) +endif diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..fdd3641 --- /dev/null +++ b/meson.build @@ -0,0 +1,90 @@ +project('gupnp-av', 'c', version : '0.12.11') + +gnome = import('gnome') + +gobject = dependency('gobject-2.0', version : '>= 2.38') +libxml = dependency('libxml-2.0') + +cc = meson.get_compiler('c') + +# Compiler flags, taken from the Xorg macros +if cc.get_id() == 'msvc' + # Compiler options taken from msvc_recommended_pragmas.h + # in GLib, based on _Win32_Programming_ by Rector and Newcomer + test_cflags = [ + '-we4002', # too many actual parameters for macro + '-we4003', # not enough actual parameters for macro + '-w14010', # single-line comment contains line-continuation character + '-we4013', # 'function' undefined; assuming extern returning int + '-w14016', # no function return type; using int as default + '-we4020', # too many actual parameters + '-we4021', # too few actual parameters + '-we4027', # function declared without formal parameter list + '-we4029', # declared formal parameter list different from definition + '-we4033', # 'function' must return a value + '-we4035', # 'function' : no return value + '-we4045', # array bounds overflow + '-we4047', # different levels of indirection + '-we4049', # terminating line number emission + '-we4053', # an expression of type void was used as an operand + '-we4071', # no function prototype given + '-we4819', # the file contains a character that cannot be represented in the current code page + ] +elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' + test_cflags = [ + '-Wpointer-arith', + '-Wmissing-declarations', + '-Wformat=2', + '-Wstrict-prototypes', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wbad-function-cast', + '-Wold-style-definition', + '-Wdeclaration-after-statement', + '-Wunused', + '-Wuninitialized', + '-Wshadow', + '-Wmissing-noreturn', + '-Wmissing-format-attribute', + '-Wredundant-decls', + '-Wlogical-op', + '-Werror=implicit', + '-Werror=nonnull', + '-Werror=init-self', + '-Werror=main', + '-Werror=missing-braces', + '-Werror=sequence-point', + '-Werror=return-type', + '-Werror=trigraphs', + '-Werror=array-bounds', + '-Werror=write-strings', + '-Werror=address', + '-Werror=int-to-pointer-cast', + '-Werror=pointer-to-int-cast', + '-fno-strict-aliasing', + '-Wno-int-conversion', + ] +else + test_cflags = [] +endif + +common_cflags = cc.get_supported_arguments(test_cflags) + +subdir('libgupnp-av') +subdir('tests') +subdir('data') + +pkg = import('pkgconfig') +pkg.generate( + gupnp_av_lib, + subdirs : 'gupnp-av-1.0', + description : 'GObject-based AV specific UPnP library' +) + +if get_option('gtk_doc') + subdir('doc') +endif + +if get_option('introspection') and get_option('vapi') + subdir('vala') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..a15d128 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('introspection', type : 'boolean', value : 'true', description : 'Build GObject-Introspection files') +option('vapi', type : 'boolean', value : 'true', description : 'Build VALA API files (needs introspection=true)') +option('gtk_doc', type : 'boolean', value : 'true', description : 'Generate the API documentation') diff --git a/tests/gtest/meson.build b/tests/gtest/meson.build new file mode 100644 index 0000000..57b776f --- /dev/null +++ b/tests/gtest/meson.build @@ -0,0 +1,29 @@ +test_env = [ + 'GUPNP_AV_DATADIR="@0@"'.format(join_paths(meson.source_root(), 'data')), + 'MALLOC_PERTURB_=170', + 'MALLOC_CHECK_=2' +] + +tests = [ + 'regression', + 'didl-lite-object', + 'media-collection', + 'last-change-parser', + 'cds-last-change-parser' +] + +foreach subtest : tests + test_name = 'test-' + subtest + test_source = test_name + '.c' + test( + test_name, + executable( + test_name, + test_source, + dependencies : [gupnp_av, gobject, libxml], + c_args: [common_cflags, '-DDATA_PATH="@0@"'.format(meson.current_source_dir())] + ), + env : test_env + ) +endforeach + diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..e506a05 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,35 @@ +executable( + 'test-search-criteria-parser', + [ + 'test-search-criteria-parser.c' + ], + c_args : common_cflags, + dependencies : [gobject, libxml, gupnp_av] +) + +check_search = executable( + 'check-search', + 'check-search.c', + c_args : common_cflags, + dependencies : [gobject, libxml, gupnp_av] +) + +check_feature_list_parser = executable( + 'check-feature-list-parser', + 'check-feature-list-parser.c', + c_args : common_cflags, + dependencies : [gobject, libxml, gupnp_av] +) + +fragments = executable( + 'fragments', + 'fragments.c', + c_args : [common_cflags, '-DABS_TOP_SRCDIR="@0@"'.format(meson.source_root())], + dependencies : [gobject, libxml, gupnp_av] +) + +test('check-search', check_search) +test('check-feature-list-parser', check_feature_list_parser) +test('fragments', fragments) + +subdir('gtest') diff --git a/vala/meson.build b/vala/meson.build new file mode 100644 index 0000000..8e178cd --- /dev/null +++ b/vala/meson.build @@ -0,0 +1,10 @@ +gnome.generate_vapi( + 'gupnp-av-1.0', + metadata_dirs : meson.current_source_dir(), + sources : [ + gupnp_av_gir.get(0), + 'gupnp-av-1.0-custom.vala' + ], + packages : ['gobject-2.0', 'libxml-2.0'], + install : true +) |