meson.build 2.68 KB
Newer Older
1
2
project(
    'squeekboard',
3
    'c', 'rust',
4
    version: '1.9.3',
5
    license: 'GPLv3',
6
    meson_version: '>=0.51.0',
7
8
9
10
11
    default_options: [
        'warning_level=1',
        'buildtype=debugoptimized',
        'c_std=gnu11'
    ]
12
13
)

14
15
16
17
18
add_project_arguments(
  [
    '-Werror=implicit-function-declaration',
    '-Werror=implicit-fallthrough=3',
    '-Werror=maybe-uninitialized',
19
    '-Werror=missing-field-initializers',
20
    '-Werror=incompatible-pointer-types',
21
    '-Werror=int-conversion',
22
    '-Wformat-nonliteral',
23
    '-Wformat-security',
Guido Gunther's avatar
Guido Gunther committed
24
    '-Winit-self',
25
    '-Wmaybe-uninitialized',
26
    '-Wold-style-definition',
27
    '-Wredundant-decls',
28
    '-Wstrict-prototypes',
29
    '-Wunused',
30
31
32
33
  ],
  language: 'c'
)

David Boddie's avatar
David Boddie committed
34
35
i18n = import('i18n')

Guido Gunther's avatar
Guido Gunther committed
36
37
conf_data = configuration_data()

38
39
40
if get_option('buildtype').startswith('debug')
    add_project_arguments('-DDEBUG=1', language : 'c')
endif
41
42
43
44
45
46
47
48
49
50

if get_option('strict')
    add_project_arguments(
        [
            '-Werror=unused',
        ],
        language: 'c'
    )
endif

51
52
53
if get_option('buildtype') != 'plain'
    add_project_arguments('-fstack-protector-strong', language: 'c')
endif
54
55
56
57
58
if get_option('buildtype') == 'release'
    cargo_build_flags = ['--release'] # for artifacts
else
    cargo_build_flags = []
endif
59

60
prefix = get_option('prefix')
61
bindir = join_paths(prefix, get_option('bindir'))
62
datadir = join_paths(prefix, get_option('datadir'))
63
desktopdir = join_paths(datadir, 'applications')
64
pkgdatadir = join_paths(datadir, meson.project_name())
65
66
67
68
69
70
if get_option('depdatadir') == ''
  depdatadir = datadir
else
  depdatadir = get_option('depdatadir')
endif
dbusdir = join_paths(depdatadir, 'dbus-1/interfaces')
71

Guido Gunther's avatar
Guido Gunther committed
72
73
74
75
76
77
78
79
80
81
summary = [
        '',
        '------------------',
        'squeekboard @0@'.format(meson.project_version()),
        '',
        '------------------',
        ''
]
message('\n'.join(summary))

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
# Rust deps are changing, depending on compile flags. Cargo can't handle it alone.
cargo_toml_in = files('Cargo.toml.in')
path_data = configuration_data()
path_data.set('path', meson.source_root())
cargo_toml_base = configure_file(
    input: 'Cargo.toml.in',
    output: 'Cargo.toml.base',
    configuration: path_data,
)


cargo_deps = files('Cargo.deps')

if get_option('legacy') == true
    cargo_build_flags += ['--features', 'gtk_v0_5,gio_v0_5']
    cargo_deps = files('Cargo.deps.legacy')
endif
    
cat = find_program('cat')
cargo_toml = custom_target(
    'Cargo.toml',
    output: 'Cargo.toml',
    command: [cat, cargo_toml_base, cargo_deps],
    capture: true,
)

108
dep_cargo = find_program('cargo')
109
cargo_script = find_program('cargo.sh')
110
cargo_build = find_program('cargo_build.sh')
111

112
subdir('data')
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
113
subdir('protocols')
114
subdir('src')
115
subdir('tools')
116
subdir('tests')