summaryrefslogtreecommitdiff
path: root/meson.build
blob: 08295fad15546ff676faeae0b7ac3c3fe0c0e808 (plain)
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
project('desktop-file-utils',
  'c',
  version: '0.27',
  meson_version: '>=0.49.0',
  default_options: [
    'c_std=gnu11',
  ],
)

###############################################################################
# Project configuration

cc = meson.get_compiler('c')

config = configuration_data()

config.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
config.set_quoted('VERSION', meson.project_version())


###############################################################################
# Compiler options

custom_cflags = [
  '-Wchar-subscripts',
  '-Wmissing-declarations',
  '-Wmissing-prototypes',
  '-Wnested-externs',
  '-Wpointer-arith',
  '-Wcast-align',
  '-Wsign-compare',

  '-Wno-unused-parameter',
]

if get_option('ansi')
  custom_cflags += [
    '-ansi',
    '-pedantic',
  ]
endif

if get_option('gcov')
  coverage_cflags = [
    '-fprofile-arcs',
    '-ftest-coverage',
  ]
  if cc.get_supported_arguments(coverage_cflags) != coverage_cflags
    error('Coverage is not supported by this compiler')
  endif
  custom_cflags += coverage_cflags
endif

add_project_arguments(cc.get_supported_arguments(custom_cflags),
  language: [ 'c', ],
)

check_functions = [
  { 'f': 'pledge', 'm': 'HAVE_PLEDGE' },
]
foreach check : check_functions
  config.set(check.get('m'), cc.has_function(check.get('f')))
endforeach


###############################################################################
# Dependencies

glib = dependency('glib-2.0', version: '>=2.8.0')


###############################################################################

subdir('man')
subdir('misc')
subdir('src')

# This script installs a symlink desktop-file-edit -> desktop-file-install
meson.add_install_script('install.py')

# This script writes git log to Changelog.
run_target('changelog', command: 'changelog.py')

meson.add_dist_script('changelog.py')