project( 'cellbroadcastd', 'c', version: '0.0.3', license: 'GPLv3+', meson_version: '>= 1.2.0', default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'], ) app_id = 'org.freedesktop.cbd' gio = dependency('gio-2.0', version: '>=2.76.0') gio_unix = dependency('gio-unix-2.0', version: '>=2.76.0') glib = dependency('glib-2.0', version: '>=2.76.0') gmobile = dependency( 'gmobile', version: '>= 0.4.0', fallback: ['gmobile', 'gmobile_dep'], default_options: [ 'examples=false', 'introspection=false', 'gtk_doc=false', 'tests=false', 'vapi=false', 'hwdb=false', ], ) mbpi = dependency('mobile-broadband-provider-info') mm_glib = dependency('mm-glib', version: '>=1.24.0') # Import the gvdb sources as a subproject to avoid having the copylib in-tree subproject('gvdb', default_options: {'tests': false}) gvdb = dependency('gvdb') prefix = get_option('prefix') bindir = prefix / get_option('bindir') datadir = prefix / get_option('datadir') libdir = prefix / get_option('libdir') girdir = prefix / datadir / 'gir-1.0' ifacedir = prefix / datadir / 'dbus-1' / 'interfaces' servicedir = prefix / datadir / 'dbus-1' / 'services' libexecdir = prefix / get_option('libexecdir') typelibdir = prefix / libdir / 'girepository-1.0' vapidir = prefix / datadir / 'vala' / 'vapi' desktopdir = prefix / datadir / 'applications' systemd_user_unit_dir = get_option('systemd_user_unit_dir') systemd_dep = dependency('systemd', required: false) if systemd_user_unit_dir == '' if systemd_dep.found() systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir') else systemd_user_unit_dir = prefix / libdir / 'systemd' / 'user' endif endif run_data = configuration_data() run_data.set('ABS_BUILDDIR', meson.current_build_dir()) run_data.set('ABS_SRCDIR', meson.current_source_dir()) configure_file(input: 'run.in', output: 'run', configuration: run_data) i18n = import('i18n') gnome = import('gnome') cc = meson.get_compiler('c') test_c_args = [ '-Wcast-align', '-Wdate-time', ['-Werror=format-security', '-Werror=format=2'], '-Wendif-labels', '-Werror=incompatible-pointer-types', '-Werror=missing-declarations', '-Werror=overflow', '-Werror=return-type', '-Werror=shift-count-overflow', '-Werror=shift-overflow=2', '-Werror=implicit-fallthrough=3', '-Wformat-nonliteral', '-Wformat-security', '-Winit-self', '-Wmaybe-uninitialized', '-Wmissing-field-initializers', '-Wmissing-include-dirs', '-Wmissing-noreturn', '-Wnested-externs', '-Wno-missing-field-initializers', '-Wno-sign-compare', '-Wno-strict-aliasing', '-Wno-unused-parameter', '-Wold-style-definition', '-Wpointer-arith', '-Wredundant-decls', '-Wstrict-prototypes', '-Wtype-limits', '-Wundef', '-Wunused-function', ] if get_option('buildtype') != 'plain' test_c_args += '-fstack-protector-strong' endif global_c_args = [ '-DGMOBILE_USE_UNSTABLE_API', '-DLIBCELLBROADCAST_COMPILATION', '-DCBD_VERSION="@0@"'.format(meson.project_version()), ] add_project_arguments(global_c_args + cc.get_supported_arguments(test_c_args), language: 'c') apiversion = '0.0' libname = 'libcellbroadcast-' + apiversion introspection_feature = get_option('introspection') introspection = introspection_feature.enabled() or introspection_feature.auto() have_mm_cbs_set_channels = false if cc.has_function('mm_gdbus_modem_cell_broadcast_call_set_channels_sync', dependencies: mm_glib) have_mm_cbs_set_channels = true endif config_h = configuration_data() config_h.set_quoted('CBD_SERVICE_PROVIDER_DATABASE', mbpi.get_variable('database')) config_h.set('CBD_MM_HAS_SET_CHANNELS', have_mm_cbs_set_channels) config_h.set_quoted('CBD_APP_ID', app_id) config_h.set_quoted('CBD_VERSION', meson.project_version()) configure_file(output: 'cbd-config.h', configuration: config_h) cbd_root_inc = include_directories('.') subdir('po') subdir('data') subdir('libcellbroadcast') subdir('src') subdir('cli') subdir('tests') summary( { 'Daemon': get_option('daemon'), 'Systemd user unit directory': systemd_user_unit_dir, 'Tests': get_option('tests'), 'MM SetChannel support': have_mm_cbs_set_channels, 'GObject introspection': introspection, }, bool_yn: true, section: 'Build', ) gnome.post_install(glib_compile_schemas: true)