meson.build 5.99 KB
Newer Older
1
project(
Debarshi Ray's avatar
Debarshi Ray committed
2
3
  'gnome-photos',
  'c',
Debarshi Ray's avatar
Debarshi Ray committed
4
  version: '41.alpha',
5
6
  license: 'GPL3+',
  default_options: 'buildtype=debugoptimized',
7
  meson_version: '>= 0.50.0',
8
9
10
11
12
13
14
)

photos_prefix = get_option('prefix')
photos_bindir = join_paths(photos_prefix, get_option('bindir'))
photos_datadir = join_paths(photos_prefix, get_option('datadir'))
photos_libexecdir = join_paths(photos_prefix, get_option('libexecdir'))
photos_localedir = join_paths(photos_prefix, get_option('localedir'))
Debarshi Ray's avatar
Debarshi Ray committed
15
photos_mandir = join_paths(photos_prefix, get_option('mandir'))
16
17

photos_docdir = join_paths(photos_datadir, 'doc', meson.project_name())
18
photos_libdir = join_paths(photos_prefix, get_option('libdir'), meson.project_name())
19
20
21
22
23
24
25

photos_installed_test_metadir = join_paths(photos_datadir, 'installed-tests', meson.project_name())
photos_installed_test_execdir = join_paths(photos_libexecdir, 'installed-tests', meson.project_name())

photos_namespace = 'org.gnome.Photos'

photos_buildtype = get_option('buildtype')
26
photos_flatpak_enabled = get_option('flatpak')
27
photos_installed_tests_enabled = get_option('installed_tests')
Debarshi Ray's avatar
Debarshi Ray committed
28
photos_manuals_enabled = get_option('manuals')
29

30
31
photos_installed_tests_template_tap = files('template-tap.test.in')

32
33
34
35
36
37
gnome = import('gnome')
i18n = import('i18n')

source_root = meson.current_source_dir()
po_dir = join_paths(source_root, 'po')

38
src_inc = include_directories('src')
39
40
top_inc = include_directories('.')

41
photos_commit_id = ''
42
if not photos_buildtype.contains('plain')
43
44
  git = find_program('git')

45
  run_command(git, '-C', source_root, 'submodule', 'sync', '--recursive')
46
  run_command(git, '-C', source_root, 'submodule', 'update', '--init', '--recursive')
47
48
49
50
51

  res = run_command(git, '-C', source_root, 'describe')
  if res.returncode() == 0
    photos_commit_id = res.stdout().strip()
  endif
52
53
endif

54
55
56
57
58
59
60
61
cc = meson.get_compiler('c')

config_h = configuration_data()

config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Photos')
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())

62
63
if photos_commit_id != ''
  config_h.set_quoted('PACKAGE_COMMIT_ID', photos_commit_id)
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
endif

config_h.set_quoted('G_LOG_DOMAIN', meson.project_name())
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())

config_h.set('PHOTOS_EPSILON', '1e-5')

langinfo_measurement_src = '''
  #include <langinfo.h>
  int main() {
    char c;
    c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
  };
'''
config_h.set(
  'HAVE__NL_MEASUREMENT_MEASUREMENT',
  cc.compiles(langinfo_measurement_src, name: '_NL_MEASUREMENT_MEASUREMENT'),
)

common_flags = []

if photos_buildtype.contains('plain')
  common_flags += cc.get_supported_arguments([
    '-Wall',
    '-Winvalid-pch',
  ])
endif

common_flags += cc.get_supported_arguments([
  '-fno-strict-aliasing',
  '-Wcast-align',
95
  '-Wclobbered',
96
  '-Wdeclaration-after-statement',
97
  '-Wempty-body',
98
  '-Wformat=2',
99
100
  '-Wignored-qualifiers',
  '-Wimplicit-fallthrough=3',
101
102
103
  '-Winit-self',
  '-Winline',
  '-Wmissing-declarations',
104
  '-Wmissing-field-initializers',
105
106
107
  '-Wmissing-format-attribute',
  '-Wmissing-include-dirs',
  '-Wmissing-noreturn',
108
  '-Wmissing-parameter-type',
109
110
111
  '-Wmissing-prototypes',
  '-Wnested-externs',
  '-Wold-style-definition',
112
  '-Woverride-init',
113
114
115
116
117
118
119
120
  '-Wpacked',
  '-Wpointer-arith',
  '-Wredundant-decls',
  '-Wshadow',
  '-Wsign-compare',
  '-Wstrict-prototypes',
  '-Wswitch-default',
  '-Wswitch-enum',
121
  '-Wtype-limits',
122
  '-Wundef',
123
124
  '-Wuninitialized',
  '-Wunused',
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
  '-Wwrite-strings',
])

common_flags += cc.get_supported_arguments([
  '-Wno-cast-function-type',
  '-Wno-error=cast-function-type',

  '-Wno-missing-field-initializers',
  '-Wno-error=missing-field-initializers',

  '-Wno-unused-parameter',
  '-Wno-error=unused-parameter',
])

add_project_arguments(common_flags, language: 'c')

m_dep = cc.find_library('m')

libgd = subproject(
  'libgd',
  default_options: [
    'static=true',
    'with-gtk-hacks=true',
    'with-main-box=true',
    'with-main-icon-view=true',
    'with-tagged-entry=true',
  ]
)
libgd_dep = libgd.get_variable('libgd_dep')

babl_dep = dependency('babl')
cairo_dep = dependency('cairo', version: '>= 1.14.0')
157
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.36.8')
158
159
160
161
162
gegl_dep = dependency('gegl-0.4', version: '>= 0.4.0')
geocode_glib_dep = dependency('geocode-glib-1.0')
gexiv_dep = dependency('gexiv2', version: '>= 0.10.8')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
163
glib_dep = dependency('glib-2.0', version: '>= 2.62.0')
164
165
166
167

goa_dep = dependency('goa-1.0', version: '>= 3.8.0')
config_h.set('GOA_API_IS_SUBJECT_TO_CHANGE', true)

168
gobject_dep = dependency('gobject-2.0')
169
170
171
172
173
grilo_dep = dependency('grilo-0.3', version: '>= 0.3.5')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.16')
gtk_unix_print_dep = dependency('gtk+-unix-print-3.0')
libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.26.0')
Debarshi Ray's avatar
Debarshi Ray committed
174
libgdata_dep = dependency('libgdata', version: '>= 0.17.13')
175
libgfgraph_dep = dependency('libgfbgraph-0.2', version: '>= 0.2.1')
176
libhandy_dep = dependency ('libhandy-1', version: '>= 1.1.90')
Debarshi Ray's avatar
Debarshi Ray committed
177
libjpeg_dep = dependency('libjpeg')
178
libpng_dep = dependency('libpng16')
Sam Thursfield's avatar
Sam Thursfield committed
179
tracker_sparql_dep = dependency('tracker-sparql-3.0')
180
181

dbus_dep = dependency('dbus-1')
182
dbus_services_dir = dbus_dep.get_pkgconfig_variable(
183
184
185
186
  'session_bus_services_dir',
  define_variable: ['datadir', photos_datadir],
)

Debarshi Ray's avatar
Debarshi Ray committed
187
188
189
190
if photos_manuals_enabled
  xsltproc = find_program('xsltproc')
endif

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
configure_file(
  output: 'config.h',
  configuration: config_h,
)

artists = files('ARTISTS')
authors = files('AUTHORS')

doc_data = artists + authors + files(
  'NEWS',
  'README',
)

install_data(
  doc_data,
  install_dir: photos_docdir,
)

subdir('data')
subdir('src')
Debarshi Ray's avatar
Debarshi Ray committed
211
212
213
214
215

if photos_manuals_enabled
  subdir('manuals')
endif

216
217
218
219
220
221
222
223
224
225
226
subdir('po')
subdir('tests')
subdir('help')

script_name = 'update-authors'
run_target(script_name, command: [find_program(script_name + '.sh'), source_root])

meson.add_install_script(
  'meson_post_install.py',
  photos_datadir,
)