summaryrefslogtreecommitdiff
path: root/meson.build
blob: fd4949a46fd76fbade30d61d656adfcc617ffeb8 (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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
project('colord-gtk', 'c',
  version : '0.3.1',
  license : 'LGPL-2.1+',
  meson_version : '>=0.46.0',
  default_options : ['c_std=c99']
)

colord_gtk_version = meson.project_version()
varr = colord_gtk_version.split('.')
colord_gtk_major_version = varr[0]
colord_gtk_minor_version = varr[1]
colord_gtk_micro_version = varr[2]

conf = configuration_data()
conf.set('CD_GTK_MAJOR_VERSION', colord_gtk_major_version)
conf.set('CD_GTK_MINOR_VERSION', colord_gtk_minor_version)
conf.set('CD_GTK_MICRO_VERSION', colord_gtk_micro_version)
conf.set_quoted('PACKAGE_VERSION', colord_gtk_version)

# libtool versioning - this applies to libcolord
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
# - If interfaces have been changed or added, but binary compatibility
#   has been preserved, change:
#      CURRENT += 1
#      REVISION = 0
#      AGE += 1
# - If binary compatibility has been broken (eg removed or changed
#   interfaces), change:
#      CURRENT += 1
#      REVISION = 0
#      AGE = 0
# - If the interface is the same as the previous version, but bugs are
#   fixed, change:
#      REVISION += 1
lt_current = '1'
lt_revision = '3'
lt_age = '0'
lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)

# get supported warning flags
test_args = [
  '-fstack-protector-strong',
  '-Waggregate-return',
  '-Wunused',
  '-Warray-bounds',
  '-Wcast-align',
  '-Wclobbered',
  '-Wdeclaration-after-statement',
  '-Wempty-body',
  '-Wextra',
  '-Wformat=2',
  '-Wformat-nonliteral',
  '-Wformat-security',
  '-Wformat-signedness',
  '-Wignored-qualifiers',
  '-Wimplicit-function-declaration',
  '-Winit-self',
  '-Wmissing-declarations',
  '-Wmissing-format-attribute',
  '-Wmissing-include-dirs',
  '-Wmissing-noreturn',
  '-Wmissing-parameter-type',
  '-Wmissing-prototypes',
  '-Wnested-externs',
  '-Wno-discarded-qualifiers',
  '-Wno-missing-field-initializers',
  '-Wno-strict-aliasing',
  '-Wno-suggest-attribute=format',
  '-Wno-unused-parameter',
  '-Wold-style-definition',
  '-Woverride-init',
  '-Wpointer-arith',
  '-Wreturn-type',
  '-Wshadow',
  '-Wsign-compare',
  '-Wstrict-aliasing',
  '-Wstrict-prototypes',
  '-Wswitch-default',
  '-Wtype-limits',
  '-Wundef',
  '-Wuninitialized',
  '-Wunused-but-set-variable',
  '-Wwrite-strings'
]

cc = meson.get_compiler('c')
foreach arg: test_args
  if cc.has_argument(arg)
    add_project_arguments(arg, language : 'c')
  endif
endforeach

glib = dependency('glib-2.0', version : '>= 2.28.0')
gio = dependency('gio-2.0', version : '>= 2.25.9Z')
colord = dependency('colord', version : '>= 0.1.27')

if get_option('gtk2')
  gtk2 = dependency('gtk+-2.0')
  conf.set('HAVE_GTK2', '1')
endif

if get_option('gtk3')
  gtk3 = dependency('gtk+-3.0')
endif

if get_option('gtk4')
  gtk4 = dependency('gtk4', version : '>= 4.4')
endif

gnome = import('gnome')
i18n = import('i18n')

add_project_arguments('-DCD_COMPILATION', language: 'c')

prefix = get_option('prefix')

bindir = join_paths(prefix, get_option('bindir'))
libdir = join_paths(prefix, get_option('libdir'))
datadir = join_paths(prefix, get_option('datadir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
localstatedir = join_paths(prefix, get_option('localstatedir'))
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
mandir = join_paths(prefix, get_option('mandir'))
includedir = join_paths(prefix, get_option('includedir'))

conf.set_quoted('SYSCONFDIR', sysconfdir)
conf.set_quoted('BINDIR', bindir)
conf.set_quoted('LIBDIR', libdir)
conf.set_quoted('DATADIR', datadir)
conf.set_quoted('LIBEXECDIR', libexecdir)
conf.set_quoted('LOCALSTATEDIR', localstatedir)

conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('LOCALEDIR', get_option('localedir'))

configure_file(
  output : 'config.h',
  configuration : conf
)

root_incdir = include_directories('.')

subdir('libcolord-gtk')
subdir('po')

if get_option('gtk3')
  subdir('client')
endif
if get_option('docs')
  subdir('doc')
endif
if get_option('man')
  subdir('man')
endif