1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: MIT
project(
'dbus-gmain',
'c',
default_options: [
'warning_level=2',
],
meson_version: '>=0.56',
)
cc = meson.get_compiler('c')
compile_warnings = []
compile_warnings_c = []
if cc.get_id() != 'msvc'
# -fno-common makes the linker more strict: on some systems the linker
# is *always* this strict, so we want to behave like that everywhere.
# We treat this like a warning, since that's basically how we're using it.
compile_warnings += ['-fno-common']
compile_warnings += [
# Intentionally disabled: missing field initializers being implicitly
# default-initialized is a feature, not a bug
'-Wno-missing-field-initializers',
# General warnings for both C and C++, excluding those that are part
# of -Wall or -Wextra
'-Wcast-align',
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wfloat-equal',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat=2',
'-Winit-self',
'-Wlogical-op',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnull-dereference',
'-Wpacked',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wswitch-default',
'-Wswitch-enum',
'-Wundef',
'-Wunused-but-set-variable',
'-Wwrite-strings',
]
compile_warnings_c += [
# Extra warnings just for C
'-Wdeclaration-after-statement',
'-Wjump-misses-init',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wold-style-definition',
'-Wpointer-sign',
'-Wstrict-prototypes',
]
endif
compile_warnings_c = cc.get_supported_arguments(
compile_warnings + compile_warnings_c,
)
add_project_arguments(compile_warnings_c, language: 'c')
if get_option('redefine_function_declaration') != ''
if not get_option('redefine_function_declaration').contains('name')
error('redefine_function_declaration option needs to contain "name"')
endif
if not get_option('redefine_function_declaration').contains('ret')
error('redefine_function_declaration option needs to contain "ret"')
endif
if not get_option('redefine_function_declaration').contains('__VA_ARGS__')
error('redefine_function_declaration option needs to contain "__VA_ARGS__"')
endif
add_project_arguments(
'-DDBUS_GMAIN_FUNCTION(ret, name, ...)=@0@'.format(
get_option('redefine_function_declaration'),
),
language: 'c',
)
endif
if get_option('redefine_function_name') != ''
if not get_option('redefine_function_name').contains('name')
error('redefine_function_name option needs to contain "name"')
endif
add_project_arguments(
'-DDBUS_GMAIN_FUNCTION_NAME(name)=@0@'.format(
get_option('redefine_function_name'),
),
language: 'c',
)
endif
dbus_dep = dependency('dbus-1', version: '>=1.8')
glib_dep = dependency('glib-2.0', version: '>=2.40')
gthread_dep = dependency(
'gthread-2.0',
version: '>=2.40',
required: get_option('tests'),
)
libdbus_gmain = static_library(
'dbus-gmain',
'dbus-gmain.c',
dependencies: [
dbus_dep,
glib_dep,
],
)
dbus_gmain_dep = declare_dependency(
dependencies: [
dbus_dep,
glib_dep,
],
include_directories: include_directories('.'),
link_with: libdbus_gmain,
)
dbus_run_session = find_program(
'dbus-run-session',
required: get_option('tests'),
)
if get_option('tests')
subdir('tests')
endif
|