aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build171
1 files changed, 171 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..bf266e5f
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,171 @@
1project(
2 'sway',
3 'c',
4 license: 'MIT',
5 default_options: [
6 'c_std=c11',
7 'warning_level=2',
8 'werror=true',
9 ],
10)
11
12add_project_arguments('-Wno-unused-parameter', language: 'c')
13add_project_arguments('-Wno-unused-function', language: 'c')
14add_project_arguments('-Wno-unused-result', language: 'c')
15
16cc = meson.get_compiler('c')
17
18is_freebsd = host_machine.system().startswith('freebsd')
19datadir = get_option('datadir')
20sysconfdir = get_option('sysconfdir')
21prefix = get_option('prefix')
22
23jsonc = dependency('json-c', version: '>=0.13')
24pcre = dependency('libpcre')
25wlroots = dependency('wlroots', fallback: ['wlroots', 'wlroots'])
26wayland_server = dependency('wayland-server')
27wayland_client = dependency('wayland-client')
28wayland_cursor = dependency('wayland-cursor')
29wayland_egl = dependency('wayland-egl')
30wayland_protos = dependency('wayland-protocols')
31xkbcommon = dependency('xkbcommon')
32cairo = dependency('cairo')
33pango = dependency('pango')
34pangocairo = dependency('pangocairo')
35gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false)
36pixman = dependency('pixman-1')
37libcap = dependency('libcap')
38libinput = dependency('libinput', version: '>=1.6.0')
39libpam = cc.find_library('libpam')
40math = cc.find_library('m')
41rt = cc.find_library('rt')
42git = find_program('git', required: false)
43a2x = find_program('a2x', required: false)
44
45conf_data = configuration_data()
46
47if gdk_pixbuf.found()
48 conf_data.set('HAVE_GDK_PIXBUF', true)
49endif
50
51if a2x.found()
52 mandir = get_option('mandir')
53 man_files = [
54 'sway/sway.1.txt',
55 'sway/sway.5.txt',
56 'sway/sway-bar.5.txt',
57 'sway/sway-input.5.txt',
58 'sway/sway-security.7.txt',
59 'swaymsg/swaymsg.1.txt',
60 ]
61 foreach filename : man_files
62 topic = filename.split('.')[-3].split('/')[-1]
63 section = filename.split('.')[-2]
64
65 custom_target(
66 'man-@0@-@1@'.format(topic, section),
67 input: filename,
68 output: '@BASENAME@',
69 command: [
70 a2x,
71 '--no-xmllint',
72 '--doctype', 'manpage',
73 '--format', 'manpage',
74 '--destination-dir', meson.current_build_dir(),
75 '@INPUT@'
76 ],
77 install: true,
78 install_dir: '@0@/man@1@'.format(mandir, section)
79 )
80 endforeach
81endif
82
83add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c')
84
85version = get_option('sway_version')
86if version != ''
87 version = '"@0@"'.format(version)
88else
89 if not git.found()
90 error('git is required to make the version string')
91 endif
92
93 git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
94 git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
95 version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
96endif
97add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
98
99sway_inc = include_directories('include')
100
101subdir('include')
102subdir('protocols')
103subdir('common')
104subdir('sway')
105subdir('swaymsg')
106
107subdir('client')
108subdir('swaybg')
109subdir('swaybar')
110subdir('swaylock')
111
112config = configuration_data()
113config.set('sysconfdir', join_paths(prefix, sysconfdir))
114config.set('datadir', join_paths(prefix, datadir))
115config.set('prefix', prefix)
116
117configure_file(
118 configuration: config,
119 input: 'config.in',
120 output: '@BASENAME@',
121 install_dir: sysconfdir + '/sway'
122)
123
124if is_freebsd
125 configure_file(
126 configuration: config,
127 input: 'security.d/10-freebsd.in',
128 output: '@BASENAME@',
129 install_dir: sysconfdir + '/sway/security.d'
130 )
131else
132 configure_file(
133 configuration: config,
134 input: 'security.d/00-defaults.in',
135 output: '@BASENAME@',
136 install_dir: sysconfdir + '/sway/security.d'
137 )
138endif
139
140install_data(
141 'sway.desktop',
142 install_dir: datadir + '/wayland-sessions'
143)
144
145if (get_option('default_wallpaper'))
146 wallpaper_files = files(
147 'assets/Sway_Wallpaper_Blue_768x1024.png',
148 'assets/Sway_Wallpaper_Blue_768x1024_Portrait.png',
149 'assets/Sway_Wallpaper_Blue_1136x640.png',
150 'assets/Sway_Wallpaper_Blue_1136x640_Portrait.png',
151 'assets/Sway_Wallpaper_Blue_1366x768.png',
152 'assets/Sway_Wallpaper_Blue_1920x1080.png',
153 'assets/Sway_Wallpaper_Blue_2048x1536.png',
154 'assets/Sway_Wallpaper_Blue_2048x1536_Portrait.png',
155 )
156 wallpaper_install_dir = datadir + '/backgrounds/sway'
157
158 install_data(wallpaper_files, install_dir: wallpaper_install_dir)
159endif
160
161if (get_option('zsh_completions'))
162 zsh_files = files(
163 'completions/zsh/_sway',
164 'completions/zsh/_swaygrab',
165 'completions/zsh/_swaylock',
166 'completions/zsh/_swaymsg',
167 )
168 zsh_install_dir = datadir + '/zsh/site-functions'
169
170 install_data(zsh_files, install_dir: zsh_install_dir)
171endif