1gnome = import('gnome')
2
3sources = [
4  'celluloid-application.c',
5  'celluloid-common.c',
6  'celluloid-control-box.c',
7  'celluloid-controller.c',
8  'celluloid-controller-actions.c',
9  'celluloid-controller-input.c',
10  'celluloid-file-chooser.c',
11  'celluloid-file-chooser-button.c',
12  'celluloid-header-bar.c',
13  'celluloid-main.c',
14  'celluloid-main-window.c',
15  'celluloid-menu.c',
16  'celluloid-metadata-cache.c',
17  'celluloid-model.c',
18  'celluloid-mpv.c',
19  'celluloid-open-location-dialog.c',
20  'celluloid-option-parser.c',
21  'celluloid-player.c',
22  'celluloid-player-options.c',
23  'celluloid-playlist-widget.c',
24  'celluloid-playlist-item.c',
25  'celluloid-playlist-model.c',
26  'celluloid-plugins-manager.c',
27  'celluloid-plugins-manager-item.c',
28  'celluloid-preferences-dialog.c',
29  'celluloid-seek-bar.c',
30  'celluloid-shortcuts-window.c',
31  'celluloid-time-label.c',
32  'celluloid-video-area.c',
33  'celluloid-view.c',
34
35  'media-keys/celluloid-media-keys.c',
36
37  'mpris/celluloid-mpris.c',
38  'mpris/celluloid-mpris-module.c',
39  'mpris/celluloid-mpris-base.c',
40  'mpris/celluloid-mpris-player.c',
41  'mpris/celluloid-mpris-track-list.c'
42]
43
44sources += custom_target('authors',
45  input: '../AUTHORS',
46  output: 'celluloid-authors.h',
47  command: [
48    find_program('generate-authors.py'),
49    '@INPUT@', '@OUTPUT@'
50  ]
51)
52
53libgtk = dependency('gtk4')
54localedir = join_paths(get_option('prefix'), get_option('localedir'))
55cflags = [
56  '-DG_SETTINGS_ENABLE_BACKEND',
57  '-DPACKAGE_LOCALEDIR="@0@"'.format(localedir),
58  '-DVERSION="@0@"'.format(meson.project_version()),
59  '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
60  '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
61  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_66',
62  '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_66',
63  '-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0',
64  '-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0'
65]
66
67if get_option('buildtype') == 'release'
68  cflags += [
69    '-DG_DISABLE_ASSERT=1',
70    '-DG_DISABLE_CHECKS=1',
71    '-DG_DISABLE_CAST_CHECKS=1'
72  ]
73endif
74
75if target_machine.system() == 'windows'
76  libgio = dependency('gio-2.0', version: '>= 2.44')
77else
78  libgio = dependency('gio-unix-2.0', version: '>= 2.44')
79endif
80
81generated_gdbus_sources = gnome.gdbus_codegen(
82  'celluloid-mpris-gdbus',
83  '../data/celluloid-mpris-gdbus.xml',
84  namespace: 'celluloid_mpris'
85)
86
87generated_marshal_sources = gnome.genmarshal('celluloid-marshal',
88  sources: '../data/celluloid-marshal.lst',
89  prefix: 'g_cclosure_gen_marshal',
90)
91
92# NOTE: All of these are fixed in GLib 2.54 and Meson 0.42.0 and can be
93# removed once version requirements are bumped
94includes = []
95extra_libs = []
96if libgio.version().version_compare('< 2.52.0')
97  # We want to be warning free on old versions:
98  # https://bugzilla.gnome.org/show_bug.cgi?id=778581
99  extra_libs += static_library('mpris-gdbus',
100    generated_gdbus_sources,
101    c_args: cflags + ['-Wno-conversion'],
102    dependencies: libgio,
103    include_directories: include_directories('..'),
104  )
105  # Created includes of `src/...`:
106  # https://bugzilla.gnome.org/show_bug.cgi?id=778801
107  includes = include_directories('..')
108elif meson.version().version_compare('== 0.46.0')
109  # https://github.com/mesonbuild/meson/issues/3488
110  includes = include_directories('..')
111  sources += generated_gdbus_sources
112else
113  sources += generated_gdbus_sources
114endif
115
116if libgio.version().version_compare('< 2.54.0')
117  # Silence warning about missing prototypes in genmarshal-generated files
118  extra_libs += static_library('marshal',
119    generated_marshal_sources,
120    c_args: cflags + ['-Wno-missing-prototypes'],
121    dependencies: libgio,
122    include_directories: include_directories('..')
123  )
124else
125  sources += generated_marshal_sources
126endif
127
128executable('celluloid', sources,
129  dependencies: [
130    libgtk,
131    libgio,
132    meson.get_compiler('c').find_library('m', required: false),
133    dependency('mpv', version: '>= 1.107'),
134    dependency('epoxy')
135  ],
136  link_with: extra_libs,
137  include_directories: includes,
138  c_args: cflags,
139  install: true
140)
141