1pkg = import('pkgconfig')
2
3libdecor_includepath = include_directories('.')
4
5libdecor_includes = [
6  libdecor_includepath,
7  top_includepath,
8]
9
10libdecor_sources = [
11  'libdecor.c',
12  'libdecor-fallback.c',
13]
14
15libdecor_headers = [
16  'libdecor.h',
17]
18install_headers(libdecor_headers,
19  subdir: '@0@'.format(libdecor_full_name),
20)
21
22libdecor_built_sources = []
23
24wayland_scanner = find_program('wayland-scanner')
25
26# Format:
27#  - protocol stability
28#  - protocol name
29#  - optional: protocol version, if unstable
30wayland_protocols = [
31  ['stable', 'xdg-shell'],
32  ['unstable', 'xdg-decoration', '1'],
33]
34
35protocols_dir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
36assert(protocols_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
37
38foreach p: wayland_protocols
39  stability = p.get(0)
40  name = p.get(1)
41
42  assert(stability in ['stable', 'unstable'],
43         'protocol \'@0@\' must be \'stable\' or \'unstable\''.format(name))
44
45  suffix = stability=='unstable' ? '-unstable-v@0@'.format(p.get(2)) : ''
46
47  output_base = name
48  input = join_paths(protocols_dir, stability, name, name+suffix+'.xml')
49
50  libdecor_built_sources += custom_target('@0@ client header'.format(output_base),
51    input: input,
52    output: '@0@-client-protocol.h'.format(output_base),
53    command: [
54      wayland_scanner,
55      'client-header',
56      '@INPUT@', '@OUTPUT@',
57    ]
58  )
59  libdecor_built_sources += custom_target('@0@ source'.format(output_base),
60    input: input,
61    output: '@0@-protocol.c'.format(output_base),
62    command: [
63      wayland_scanner,
64      'private-code',
65      '@INPUT@', '@OUTPUT@',
66    ]
67  )
68endforeach
69
70## cursor settings
71cursor_settings = static_library('cursor_settings',
72  sources: ['cursor-settings.c'],
73  include_directories: [top_includepath],
74  dependencies: [dbus_dep],
75)
76
77cursor_settings_dep = declare_dependency(
78  link_with: cursor_settings,
79  dependencies: [dbus_dep],
80)
81
82## os compatibility
83os_compatibility = static_library('os_compatibility',
84  sources: ['os-compatibility.c'],
85  include_directories: [top_includepath],
86)
87
88os_compatibility_dep = declare_dependency(
89  link_with: os_compatibility,
90)
91
92## core decor library
93libdecor = shared_library(libdecor_name,
94  sources: [
95    libdecor_sources,
96    libdecor_built_sources,
97  ],
98  soversion: libdecor_soversion,
99  version: libdecor_libversion,
100  include_directories: libdecor_includes,
101  c_args: libdecor_c_args,
102  dependencies: [
103    wayland_client_dep,
104    dl_dep,
105    cursor_settings_dep,
106  ],
107  install: true
108)
109
110libdecor_dep = declare_dependency(
111  link_with: libdecor,
112  dependencies: [
113    wayland_client_dep,
114  ],
115)
116
117## decor plugins
118subdir('plugins')
119
120## pkg-config file
121pkg.generate(
122  name: libdecor_full_name,
123  description: 'library for Wayland client-side window decors',
124  libraries: libdecor,
125  subdirs: libdecor_full_name,
126  version: meson.project_version()
127)
128