diff --git a/data/meson.build b/data/meson.build index 76c9d4f0..dca57d3c 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,17 +1,32 @@ subdir('icons') subdir('appdata') +enum_headers = files(join_paths(src_dir, 'gcal-enums.h')) + +enums_xml = gnome.mkenums( + 'org.gnome.calendar.enums.xml', + sources: enum_headers, + comments: '', + fhead: '', + vhead: ' <@type@ id="org.gnome.calendar.@EnumName@">', + vprod: ' ', + vtail: ' ', + ftail: '', + install_header: true, + install_dir: calendar_schemadir +) + # Desktop files # Note: This name is registered in gcal-weather-service.c. desktop = 'org.gnome.Calendar.desktop' i18n.merge_file( - desktop, - type: 'desktop', - input: desktop + '.in', - output: desktop, - po_dir: po_dir, - install: true, + desktop, + type: 'desktop', + input: desktop + '.in', + output: desktop, + po_dir: po_dir, + install: true, install_dir: join_paths(calendar_datadir, 'applications') ) @@ -27,7 +42,7 @@ schema_conf.set('GETTEXT_PACKAGE', meson.project_name()) schema = 'org.gnome.calendar.gschema.xml' -configure_file( +schema_xml = configure_file( input: schema + '.in', output: schema, install: true, @@ -35,6 +50,17 @@ configure_file( configuration: schema_conf ) +output = 'gschemas.compiled' + +# for unit tests - gnome.compile_schemas() only looks in srcdir +compiled_schemas = custom_target( + output, + input: schema_xml, + output: output, + command: [find_program('glib-compile-schemas'), meson.current_build_dir()], + depends: enums_xml +) + # DBus service files service_conf = configuration_data() service_conf.set('bindir', calendar_bindir) @@ -42,10 +68,10 @@ service_conf.set('bindir', calendar_bindir) service = 'org.gnome.Calendar.service' configure_file( - input: service + '.in', - output: service, - install: true, - install_dir: join_paths(calendar_datadir, 'dbus-1', 'services'), + input: service + '.in', + output: service, + install: true, + install_dir: join_paths(calendar_datadir, 'dbus-1', 'services'), configuration: service_conf ) diff --git a/meson.build b/meson.build index 4191c7be..fb1ea683 100644 --- a/meson.build +++ b/meson.build @@ -136,6 +136,7 @@ top_inc = include_directories('.') data_dir = join_paths(meson.source_root(), 'data') po_dir = join_paths(meson.source_root(), 'po') +src_dir = join_paths(meson.source_root(), 'src') ########### diff --git a/src/meson.build b/src/meson.build index 064fc93c..a02a6b83 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,5 @@ src_inc = include_directories('.') -enum_headers = files('gcal-enums.h') - gcal_deps = [ gsettings_desktop_schemas_dep, libedataserverui_dep, @@ -56,19 +54,6 @@ sources = files( 'gcal-timer.c' ) -gnome.mkenums( - 'org.gnome.calendar.enums.xml', - sources: enum_headers, - comments: '', - fhead: '', - vhead: ' <@type@ id="org.gnome.calendar.@EnumName@">', - vprod: ' ', - vtail: ' ', - ftail: '', - install_header: true, - install_dir: calendar_schemadir -) - enum_types = 'gcal-enum-types' sources += gnome.mkenums( diff --git a/tests/meson.build b/tests/meson.build index 6d02aaec..c0ede244 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,19 +1,26 @@ -test_incs = [ - include_directories('.'), - src_inc -] - -tests_deps = gcal_deps + [ libgcal_dep ] +test_deps = gcal_deps + [ libgcal_dep ] ########### # Manager # ########### +test_env = [ + 'G_TEST_SRCDIR=' + meson.current_source_dir(), + 'G_TEST_BUILDDIR=' + meson.current_build_dir(), + 'GSETTINGS_SCHEMA_DIR=' + join_paths(meson.build_root(), 'data'), + 'GSETTINGS_BACKEND=memory', + 'MALLOC_CHECK_=2' +] + +test_cflags = '-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.source_root(), 'data')) + +test_unit = 'test-manager' + test_manager = executable( - 'test-manager', - 'test-manager.c', - dependencies: tests_deps, - include_directories: test_incs + test_unit, + [test_unit + '.c', compiled_schemas], + c_args: test_cflags, + dependencies: test_deps ) -test('test-manager', test_manager) +test(test_unit, test_manager, env: test_env)