1project(
2  'cheese', ['c', 'vala'],
3  version: '41.1',
4  license: 'GPL2',
5  default_options: 'buildtype=debugoptimized',
6  meson_version: '>= 0.50.0',
7)
8
9cheese_name = meson.project_name()
10
11cheese_version = meson.project_version()
12version_array = cheese_version.split('.')
13cheese_major_version = version_array[0].to_int()
14cheese_minor_version = version_array[1].to_int()
15
16#cheese_api_version = cheese_major_version.to_string() + '.0'
17cheese_api_version = '3.0'
18
19cheese_prefix = get_option('prefix')
20cheese_bindir = get_option('bindir')
21cheese_datadir = get_option('datadir')
22cheese_includedir = get_option('includedir')
23cheese_localedir = get_option('localedir')
24cheese_mandir = get_option('mandir')
25
26cheese_namespace = 'org.gnome.Cheese'
27
28#*******************************************************************************
29# Libraries
30#*******************************************************************************
31# Before making a release, the CHEESE_LT_VERSION string should be modified.
32# The string is of the form C:R:A.
33# - If interfaces have been changed or added, but binary compatibility has
34#   been preserved, change to C+1:0:A+1
35# - If binary compatibility has been broken (eg removed or changed interfaces)
36#   change to C+1:0:0
37# - If the interface is the same as the previous version, change to C:R+1:A
38current = 8
39revision = 17
40age = 0
41libcheese_version = '@0@.@1@.@2@'.format(current - age, age, revision)
42
43current = 26
44revision = 7
45age = 1
46libcheese_gtk_version = '@0@.@1@.@2@'.format(current - age, age, revision)
47
48gnome = import('gnome')
49i18n = import('i18n')
50pkg = import('pkgconfig')
51
52source_root = meson.current_source_dir()
53
54po_dir = source_root / 'po'
55vapi_dir = source_root / 'src/vapi'
56
57top_inc = include_directories('.')
58
59cc = meson.get_compiler('c')
60valac = meson.get_compiler('vala')
61
62config_h = configuration_data()
63
64# defines
65set_defines = [
66  # package
67  ['PACKAGE_LOCALEDIR', cheese_prefix / cheese_localedir],
68  ['PACKAGE_NAME', 'Cheese'],
69  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), cheese_version)],
70  ['PACKAGE_TARNAME', cheese_name],
71  ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Cheese'],
72  ['PACKAGE_VERSION', cheese_version],
73  # i18n
74  ['GETTEXT_PACKAGE', cheese_name],
75]
76
77foreach define: set_defines
78  config_h.set_quoted(define[0], define[1])
79endforeach
80
81# compiler flags
82common_flags = ['-DHAVE_CONFIG_H']
83
84if get_option('buildtype').contains('debug')
85  common_flags += cc.get_supported_arguments([
86    '-Wnested-externs',
87    '-Wstrict-prototypes',
88    '-Werror=format=2',
89    '-Werror=implicit-function-declaration',
90    '-Werror=init-self',
91    '-Werror=missing-include-dirs',
92    '-Werror=missing-prototypes',
93    '-Werror=pointer-arith',
94    '-Werror=return-type',
95  ])
96endif
97
98add_project_arguments(common_flags, language: 'c')
99
100#*******************************************************************************
101# Check required libraries
102#*******************************************************************************
103clutter_dep = dependency('clutter-1.0', version: '>= 1.13.2')
104clutter_gst_dep = dependency('clutter-gst-3.0', version: '>= 3.0.0')
105clutter_gtk_dep = dependency('clutter-gtk-1.0')
106gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
107gio_dep = dependency('gio-2.0')
108glib_dep = dependency('glib-2.0', version: '>= 2.38.0')
109gnome_desktop_dep = dependency('gnome-desktop-3.0')
110gstreamer_dep = dependency('gstreamer-1.0')
111gstreamer_pbutils_dep = dependency('gstreamer-pbutils-1.0')
112gstreamer_plugins_bad_dep = dependency('gstreamer-plugins-bad-1.0', version: '>= 1.4')
113gtk_dep = dependency('gtk+-3.0', version: '>= 3.13.4')
114libcanberra_dep = dependency('libcanberra')
115libcanberra_gtk_lib = meson.get_compiler('c').find_library('canberra-gtk3')
116libcanberra_gtk3_dep = declare_dependency(dependencies: [libcanberra_gtk_lib])
117
118m_dep = cc.find_library('m')
119
120cheese_common_dep = valac.find_library('cheese-common', dirs: vapi_dir)
121cheese_thumbview_dep = valac.find_library('cheese-thumbview', dirs: vapi_dir)
122config_dep = valac.find_library('config', dirs: vapi_dir)
123eogthumbnav_dep = valac.find_library('eogthumbnav', dirs: vapi_dir)
124posix_dep = valac.find_library('posix')
125
126x11_dep = dependency('x11')
127have_xtest = false
128if cc.has_header('X11/extensions/XTest.h', dependencies: x11_dep)
129  xtst_dep = dependency('xtst', required: false)
130  have_xtest = xtst_dep.found() and cc.has_function('XTestFakeKeyEvent', dependencies: xtst_dep)
131endif
132
133dbus_session_bus_services_dir = dependency('dbus-1').get_pkgconfig_variable(
134  'session_bus_services_dir',
135  define_variable: ['datadir', cheese_prefix / cheese_datadir],
136)
137
138gio_schemasdir = gio_dep.get_pkgconfig_variable(
139  'schemasdir',
140  define_variable: ['datadir', cheese_prefix / cheese_datadir],
141  default: cheese_prefix / cheese_datadir / 'glib-2.0/schemas',
142)
143
144gnome_video_effects_dep = dependency(
145  'gnome-video-effects',
146  required: false,
147  not_found_message: 'The gnome-video-effects package is required at runtime for effects',
148)
149
150# Recommend some runtime GStreamer plugins.
151gst_inspect = find_program('gst-inspect-1.0', required: false)
152if gst_inspect.found()
153  foreach plugin: ['camerabin', 'vp8enc', 'webmmux']
154    if run_command(gst_inspect, plugin).returncode() != 0
155      warning(plugin + ' was not found. It needs to be installed before Cheese is run')
156    endif
157  endforeach
158else
159  warning('unable to check for runtime GStreamer plugin dependencies')
160endif
161
162# Check for GLib testing utilities.
163# FIXME: meson has its own test framework
164'''
165gtester = find_program('gtester', required: false)
166enable_cheese_tests = gtester.found()
167if not enable_cheese_tests
168  warning('testing disabled as the required utilities were not found')
169endif
170'''
171
172# introspection support
173enable_gir = get_option('introspection')
174if enable_gir
175  dependency('gobject-introspection-1.0', version: '>= 0.6.7')
176endif
177
178subdir('data')
179subdir('libcheese')
180subdir('src')
181
182if get_option('tests')
183  subdir('tests')
184endif
185
186subdir('po')
187subdir('help')
188
189enable_gtk_doc = get_option('gtk_doc')
190enable_man = get_option('man')
191if enable_gtk_doc or enable_man
192  subdir('docs/reference')
193endif
194
195configure_file(
196  output: 'config.h',
197  configuration: config_h,
198)
199
200meson.add_install_script(
201  'meson_post_install.py',
202  cheese_datadir,
203  gio_schemasdir,
204)
205