~minos-archive/minos/i3

56 by Javier Lopez
automatic sync 31-07-2020:00:00
1
# -*- mode: meson -*-
2
3
# Style objective: be consistent with what mesonbuild.com documents/uses, and/or
4
# the meson book: https://meson-manual.com/
5
6
project(
7
  'i3',
8
  'c',
166 by Javier Lopez
automatic sync 25-10-2022:00:00
9
  version: '4.21.1',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
10
  default_options: [
11
    'c_std=c11',
12
    'warning_level=1',  # enable all warnings (-Wall)
13
    # TODO(https://github.com/i3/i3/issues/4087): switch to
14
    # 'buildtype=debugoptimized',
15
  ],
16
  # Ubuntu 18.04 (supported until 2023) has meson 0.45.
17
  # We can revisit our minimum supported meson version
18
  # if it turns out to be too hard to maintain.
19
  meson_version: '>=0.45.0',
20
)
21
22
cc = meson.get_compiler('c')
23
add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c')
24
25
if meson.version().version_compare('>=0.48.0')
26
  # https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911
27
  meson.add_dist_script('meson/meson-dist-script')
28
else
29
  message('meson <0.48.0 detected, dist tarballs will not be filtered')
30
endif
31
32
################################################################################
33
# Version handling
34
################################################################################
35
36
cdata = configuration_data()
37
38
version_array = meson.project_version().split('.')
39
cdata.set('MAJOR_VERSION', version_array[0].to_int())
40
cdata.set('MINOR_VERSION', version_array[1].to_int())
41
if version_array.length() > 2
42
  cdata.set('PATCH_VERSION', version_array[2].to_int())
43
else
44
  cdata.set('PATCH_VERSION', 0)
45
endif
46
cdata.set_quoted('I3_VERSION', '@VCS_TAG@')
47
cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
48
49
if get_option('b_sanitize').split(',').contains('address')
50
  cdata.set('I3_ASAN_ENABLED', 1)
51
endif
52
53
cdata.set('HAVE_STRNDUP', cc.has_function('strndup'))
54
cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp'))
55
56
# Instead of generating config.h directly, make vcs_tag generate it so that
57
# @VCS_TAG@ is replaced.
58
config_h_in = configure_file(
59
  output: 'config.h.in',
60
  configuration: cdata,
61
)
62
config_h = declare_dependency(
63
  sources: vcs_tag(
64
    input: config_h_in,
65
    output: 'config.h',
66
    fallback: meson.project_version() + '-non-git',
67
  )
68
)
69
70
################################################################################
71
# docs generation
72
################################################################################
73
74
docdir = get_option('docdir')
75
if docdir == ''
76
  docdir = join_paths(get_option('datadir'), 'doc', 'i3')
77
endif
78
79
if get_option('docs')
80
  asciidoc = find_program('asciidoc')
81
  doc_toc_inputs = [
82
    'docs/hacking-howto',
83
    'docs/userguide',
84
    'docs/ipc',
85
    'docs/multi-monitor',
86
    'docs/wsbar',
87
    'docs/testsuite',
88
    'docs/i3bar-protocol',
89
    'docs/layout-saving',
90
  ]
91
  foreach m : doc_toc_inputs
92
    custom_target(
93
      m.underscorify()+'_asciidoc',
94
      input: m,
95
      output: '@BASENAME@.html',
96
      command: [
97
        asciidoc,
98
        '-a', 'toc',
99
        '-n',
100
        '-o', '@OUTPUT@',
101
        '@INPUT@',
102
      ],
103
      install: true,
104
      install_dir: docdir,
105
    )
106
  endforeach
107
108
  doc_notoc_inputs = [
109
    'docs/debugging',
110
  ]
111
  foreach m : doc_notoc_inputs
112
    custom_target(
113
      m.underscorify()+'_asciidoc',
114
      input: m,
115
      output: '@BASENAME@.html',
116
      command: [
117
        asciidoc,
118
        '-n',
119
        '-o', '@OUTPUT@',
120
        '@INPUT@',
121
      ],
122
      install: true,
123
      install_dir: docdir,
124
    )
125
  endforeach
126
127
else
128
  if run_command('[', '-f', 'docs/hacking-howto.html', ']').returncode() == 0
129
    install_data(
130
      [
131
	'docs/hacking-howto.html',
132
	'docs/userguide.html',
133
	'docs/ipc.html',
134
	'docs/multi-monitor.html',
135
	'docs/wsbar.html',
136
	'docs/testsuite.html',
137
	'docs/i3bar-protocol.html',
138
	'docs/layout-saving.html',
139
	'docs/debugging.html',
140
      ],
141
      install_dir: docdir,
142
    )
143
  endif
144
endif
145
146
install_data(
147
  [
148
    'docs/bigpicture.png',
149
    'docs/single_terminal.png',
150
    'docs/snapping.png',
151
    'docs/two_columns.png',
152
    'docs/two_terminals.png',
153
    'docs/modes.png',
154
    'docs/wsbar.png',
155
    'docs/keyboard-layer1.png',
156
    'docs/keyboard-layer2.png',
157
    'docs/i3-sync-working.png',
158
    'docs/i3-sync.png',
159
    'docs/tree-layout1.png',
160
    'docs/tree-layout2.png',
161
    'docs/tree-shot1.png',
162
    'docs/tree-shot2.png',
163
    'docs/tree-shot3.png',
164
    'docs/tree-shot4.png',
165
    'docs/refcard.html',
166
    'docs/refcard_style.css',
167
    'docs/logo-30.png',
168
    'docs/layout-saving-1.png',
169 by Javier Lopez
automatic sync 02-11-2022:00:00
169
    'docs/gaps1920.png',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
170
  ],
171
  install_dir: docdir,
172
)
173
174
if meson.version().version_compare('>=0.53')
175
  summary('build docs (-Ddocs)', get_option('docs'))
176
endif
177
178
################################################################################
179
# manpages
180
################################################################################
181
182
man1 = join_paths(get_option('mandir'), 'man1')
183
184
if get_option('mans')
185
  asciidoc = find_program('asciidoc')
186
  asciidoc_cdata = configuration_data()
187
  asciidoc_cdata.set('PACKAGE_VERSION', meson.project_version())
188
  asciidoc_conf = configure_file(
189
    input: 'man/asciidoc.conf.in',
190
    output: 'asciidoc.conf',
191
    configuration: asciidoc_cdata,
192
  )
193
194
  xmlto = find_program('xmlto')
195
196
  pod2man = find_program('pod2man')
197
198
  man_inputs = [
199
    'man/i3.man',
200
    'man/i3bar.man',
201
    'man/i3-msg.man',
202
    'man/i3-input.man',
203
    'man/i3-nagbar.man',
204
    'man/i3-config-wizard.man',
205
    'man/i3-migrate-config-to-v4.man',
206
    'man/i3-sensible-editor.man',
207
    'man/i3-sensible-pager.man',
208
    'man/i3-sensible-terminal.man',
209
    'man/i3-dump-log.man',
210
  ]
211
212
  foreach m : man_inputs
213
    xml = custom_target(
214
      m.underscorify()+'_asciidoc',
215
      input: m,
216
      output: '@BASENAME@.xml',
217
      command: [
218
        asciidoc,
219
        '-d', 'manpage',
220
        '-b', 'docbook',
221
        '-f', asciidoc_conf,
222
        '-o', '@OUTPUT@',
223
        '@INPUT@',
224
      ],
225
    )
226
227
    custom_target(
228
      m.underscorify()+'_xmlto',
229
      input: xml,
230
      output: '@BASENAME@.1',
231
      command: [
232
        xmlto,
126 by Javier Lopez
automatic sync 29-10-2021:00:00
233
        '--stringparam',
234
        'man.th.title.max.length=30',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
235
        'man',
236
        '-o',
237
        '@OUTDIR@',
238
        '@INPUT@',
239
      ],
240
      # We should use install and install_dir instead of install_man as per:
241
      # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
242
      # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
243
      install: true,
244
      install_dir: man1,
245
    )
246
  endforeach
247
248
  pod2man_inputs = [
249
    'i3-dmenu-desktop',
250
    'i3-save-tree',
251
  ]
252
  foreach m : pod2man_inputs
253
    custom_target(
254
      m.underscorify()+'_pod2man',
255
      input: m,
256
      output: '@BASENAME@.1',
257
      command: [
258
        pod2man,
259
        '--utf8',
260
        '@INPUT@',
261
        '@OUTPUT@',
262
      ],
263
      # We should use install and install_dir instead of install_man as per:
264
      # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
265
      # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
266
      install: true,
267
      install_dir: man1,
268
    )
269
  endforeach
270
271
else
272
  if run_command('[', '-f', 'man/i3.1', ']').returncode() == 0
273
    install_data(
274
      [
275
	'man/i3.1',
276
	'man/i3bar.1',
277
	'man/i3-msg.1',
278
	'man/i3-input.1',
279
	'man/i3-nagbar.1',
280
	'man/i3-config-wizard.1',
281
	'man/i3-migrate-config-to-v4.1',
282
	'man/i3-sensible-editor.1',
283
	'man/i3-sensible-pager.1',
284
	'man/i3-sensible-terminal.1',
285
	'man/i3-dump-log.1',
286
	'man/i3-dmenu-desktop.1',
287
	'man/i3-save-tree.1',
288
      ],
289
      install_dir: man1,
290
    )
291
  endif
292
endif
293
294
if meson.version().version_compare('>=0.53')
68 by Javier Lopez
automatic sync 29-10-2020:00:00
295
  summary('build manpages (-Dmans)', get_option('mans'))
56 by Javier Lopez
automatic sync 31-07-2020:00:00
296
endif
297
298
# Required for e.g. struct ucred to be defined as per unix(7).
299
add_project_arguments('-D_GNU_SOURCE', language: 'c')
300
301
# https://mesonbuild.com/howtox.html#add-math-library-lm-portably
302
m_dep = cc.find_library('m', required: false)
303
rt_dep = cc.find_library('rt', required: false)
304
iconv_dep = cc.find_library('iconv', required: false)
305
306
libsn_dep = dependency('libstartup-notification-1.0', method: 'pkg-config')
307
xcb_dep = dependency('xcb', method: 'pkg-config')
308
xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config')
309
xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config')
310
xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config')
311
xcb_shape_dep = dependency('xcb-shape', method: 'pkg-config')
312
xcb_util_dep = dependency('xcb-util', method: 'pkg-config')
313
xcb_util_cursor_dep = dependency('xcb-cursor', method: 'pkg-config')
314
xcb_util_keysyms_dep = dependency('xcb-keysyms', method: 'pkg-config')
315
xcb_util_wm_dep = dependency('xcb-icccm', method: 'pkg-config')
316
xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config')
317
xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config')
318
xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config')
319
yajl_dep = dependency('yajl', method: 'pkg-config')
137 by Javier Lopez
automatic sync 30-11-2021:00:00
320
libpcre_dep = dependency('libpcre2-8', version: '>=10', method: 'pkg-config')
56 by Javier Lopez
automatic sync 31-07-2020:00:00
321
cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config')
322
pangocairo_dep = dependency('pangocairo', method: 'pkg-config')
323
glib_dep = dependency('glib-2.0', method: 'pkg-config')
324
gobject_dep = dependency('gobject-2.0', method: 'pkg-config')
325
326
ev_dep = cc.find_library('ev')
327
328
inc = include_directories('include')
329
330
libi3srcs = [
108 by Javier Lopez
automatic sync 14-06-2021:00:00
331
  'libi3/boolstr.c',
86 by Javier Lopez
automatic sync 21-01-2021:00:00
332
  'libi3/create_socket.c',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
333
  'libi3/dpi.c',
334
  'libi3/draw_util.c',
335
  'libi3/fake_configure_notify.c',
336
  'libi3/font.c',
337
  'libi3/format_placeholders.c',
338
  'libi3/get_colorpixel.c',
339
  'libi3/get_config_path.c',
340
  'libi3/get_exe_path.c',
341
  'libi3/get_mod_mask.c',
342
  'libi3/get_process_filename.c',
343
  'libi3/get_visualtype.c',
344
  'libi3/g_utf8_make_valid.c',
345
  'libi3/ipc_connect.c',
346
  'libi3/ipc_recv_message.c',
347
  'libi3/ipc_send_message.c',
348
  'libi3/is_debug_build.c',
86 by Javier Lopez
automatic sync 21-01-2021:00:00
349
  'libi3/path_exists.c',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
350
  'libi3/resolve_tilde.c',
351
  'libi3/root_atom_contents.c',
352
  'libi3/safewrappers.c',
353
  'libi3/string.c',
354
  'libi3/ucs2_conversion.c',
86 by Javier Lopez
automatic sync 21-01-2021:00:00
355
  'libi3/nonblock.c',
105 by Javier Lopez
automatic sync 21-05-2021:00:00
356
  'libi3/screenshot_wallpaper.c',
357
  'libi3/is_background_set.c',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
358
]
359
360
if not cdata.get('HAVE_STRNDUP')
361
  libi3srcs += 'libi3/strndup.c'
362
endif
363
364
if not cdata.get('HAVE_MKDIRP')
365
  libi3srcs += 'libi3/mkdirp.c'
366
endif
367
368
libi3 = static_library(
369
  'i3',
370
  libi3srcs,
371
  include_directories: inc,
372
  dependencies: [
373
    pangocairo_dep,
374
    config_h,
375
  ],
376
)
377
378
i3srcs = [
379
  'src/assignments.c',
380
  'src/bindings.c',
381
  'src/click.c',
382
  'src/commands.c',
383
  'src/commands_parser.c',
384
  'src/con.c',
385
  'src/config.c',
386
  'src/config_directives.c',
387
  'src/config_parser.c',
388
  'src/display_version.c',
389
  'src/drag.c',
390
  'src/ewmh.c',
391
  'src/fake_outputs.c',
392
  'src/floating.c',
169 by Javier Lopez
automatic sync 02-11-2022:00:00
393
  'src/gaps.c',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
394
  'src/handlers.c',
395
  'src/ipc.c',
396
  'src/key_press.c',
397
  'src/load_layout.c',
398
  'src/log.c',
399
  'src/main.c',
400
  'src/manage.c',
401
  'src/match.c',
402
  'src/move.c',
403
  'src/output.c',
404
  'src/randr.c',
405
  'src/regex.c',
406
  'src/render.c',
407
  'src/resize.c',
408
  'src/restore_layout.c',
409
  'src/scratchpad.c',
410
  'src/sd-daemon.c',
411
  'src/sighandler.c',
412
  'src/startup.c',
413
  'src/sync.c',
149 by Javier Lopez
automatic sync 29-07-2022:00:00
414
  'src/tiling_drag.c',
56 by Javier Lopez
automatic sync 31-07-2020:00:00
415
  'src/tree.c',
416
  'src/util.c',
417
  'src/version.c',
418
  'src/window.c',
419
  'src/workspace.c',
420
  'src/x.c',
421
  'src/xcb.c',
422
  'src/xcursor.c',
423
  'src/xinerama.c',
424
]
425
426
# Verify the perl interpreter is present for running parser_gen,
427
# ensuring a good error message when it isn’t:
428
perl = find_program('perl')
429
parser_gen = find_program('generate-command-parser.pl')
430
431
command_parser = custom_target(
432
  'command_parser',
433
  input: 'parser-specs/commands.spec',
434
  output: [
435
    'GENERATED_command_enums.h',
436
    'GENERATED_command_tokens.h',
437
    'GENERATED_command_call.h',
438
  ],
439
  command: [perl, parser_gen, '--input=@INPUT@', '--prefix=command'],
440
)
441
442
i3srcs += command_parser
443
444
config_parser = custom_target(
445
  'config_parser',
446
  input: 'parser-specs/config.spec',
447
  output: [
448
    'GENERATED_config_enums.h',
449
    'GENERATED_config_tokens.h',
450
    'GENERATED_config_call.h',
451
  ],
452
  command: [parser_gen, '--input=@INPUT@', '--prefix=config'],
453
)
454
455
i3srcs += config_parser
456
457
# src/log.c uses threading primitives for synchronization
458
thread_dep = dependency('threads')
459
460
common_deps = [
461
  thread_dep,
462
  m_dep,
463
  iconv_dep,
464
  rt_dep,
465
  libsn_dep,
466
  xcb_dep,
467
  xcb_xkb_dep,
468
  xcb_xinerama_dep,
469
  xcb_randr_dep,
470
  xcb_shape_dep,
471
  xcb_util_dep,
472
  xcb_util_cursor_dep,
473
  xcb_util_keysyms_dep,
474
  xcb_util_wm_dep,
475
  xcb_util_xrm_dep,
476
  xkbcommon_dep,
477
  xkbcommon_x11_dep,
478
  yajl_dep,
479
  libpcre_dep,
480
  cairo_dep,
481
  pangocairo_dep,
482
  glib_dep,
483
  gobject_dep,
484
  ev_dep,
485
  config_h,
486
]
487
488
executable(
489
  'i3',
490
  i3srcs,
491
  install: true,
492
  include_directories: inc,
493
  dependencies: common_deps,
494
  link_with: libi3,
495
)
496
497
# This is the only currently working way of installing a symbolic link:
498
meson.add_install_script(
499
  'meson/meson-install-i3-with-shmlog',
500
  get_option('bindir'),
501
)
502
503
executable(
504
  'i3bar',
505
  [
506
    'i3bar/src/child.c',
507
    'i3bar/src/config.c',
508
    'i3bar/src/ipc.c',
509
    'i3bar/src/main.c',
510
    'i3bar/src/mode.c',
511
    'i3bar/src/outputs.c',
512
    'i3bar/src/parse_json_header.c',
513
    'i3bar/src/workspaces.c',
514
    'i3bar/src/xcb.c',
515
  ],
516
  install: true,
517
  include_directories: include_directories('include', 'i3bar/include'),
518
  dependencies: common_deps,
519
  link_with: libi3,
520
)
521
522
executable(
523
  'i3-config-wizard',
524
  [
525
    'i3-config-wizard/i3-config-wizard-atoms.xmacro.h',
526
    'i3-config-wizard/main.c',
527
    'i3-config-wizard/xcb.h',
74 by Javier Lopez
automatic sync 22-11-2020:00:00
528
    config_parser,
56 by Javier Lopez
automatic sync 31-07-2020:00:00
529
  ],
530
  install: true,
531
  include_directories: include_directories('include', 'i3-config-wizard'),
532
  dependencies: common_deps,
533
  link_with: libi3,
534
)
535
536
executable(
537
  'i3-dump-log',
538
  'i3-dump-log/main.c',
539
  install: true,
540
  include_directories: inc,
541
  dependencies: common_deps,
542
  link_with: libi3,
543
)
544
545
executable(
546
  'i3-input',
547
  [
548
    'i3-input/i3-input.h',
549
    'i3-input/keysym2ucs.h',
550
    'i3-input/keysym2ucs.c',
551
    'i3-input/main.c',
552
  ],
553
  install: true,
554
  include_directories: inc,
555
  dependencies: common_deps,
556
  link_with: libi3,
557
)
558
559
executable(
560
  'i3-msg',
561
  'i3-msg/main.c',
562
  install: true,
563
  include_directories: inc,
564
  dependencies: common_deps,
565
  link_with: libi3,
566
)
567
568
executable(
569
  'i3-nagbar',
570
  [
571
    'i3-nagbar/i3-nagbar-atoms.xmacro.h',
572
    'i3-nagbar/main.c',
573
  ],
574
  install: true,
575
  include_directories: include_directories('include', 'i3-nagbar'),
576
  dependencies: common_deps,
577
  link_with: libi3,
578
)
579
580
install_data(
581
  [
582
    'i3-dmenu-desktop',
583
    'i3-migrate-config-to-v4',
584
    'i3-save-tree',
585
    'i3-sensible-editor',
586
    'i3-sensible-pager',
587
    'i3-sensible-terminal',
588
  ],
589
  install_dir: 'bin',
590
)
591
592
install_subdir(
593
  'etc',
594
  strip_directory: true,
595
  install_dir: join_paths(get_option('sysconfdir'), 'i3'),
596
)
597
598
install_subdir(
599
  'share/',
600
  strip_directory: true,
601
  install_dir: get_option('datadir'),
602
)
603
604
install_headers(
605
  'include/i3/ipc.h',
606
  subdir: 'i3',
607
)
608
609
# We cannot use configure_file for complete-run.pl.in and i3test.pm.in
610
# because configure_file strips the backslash in e.g. \@display,
611
# resulting in @display, breaking our Perl code:
612
# https://github.com/mesonbuild/meson/issues/7165
63 by Javier Lopez
automatic sync 20-10-2020:00:00
613
bash = find_program('bash')
56 by Javier Lopez
automatic sync 31-07-2020:00:00
614
replace_dirs = [
63 by Javier Lopez
automatic sync 20-10-2020:00:00
615
  bash, '-c',  # Use bash to capture output and mark as executable
616
  'sed -e \'s,@abs_top_builddir@,'
617
  + meson.current_build_dir()
618
  + ',g;s,@abs_top_srcdir@,'
619
  + meson.current_source_dir()+',g\''
620
  # Only mark files ending in .pl as executables
621
  + ' "$0" > "$1" && { [[ "${1##*.}" == pl ]] && chmod +x "$1" || true; }',
622
  '@INPUT0@',   # $0
623
  '@OUTPUT0@',  # $1
56 by Javier Lopez
automatic sync 31-07-2020:00:00
624
]
625
complete_run = custom_target(
626
  'complete-run',
627
  input: ['testcases/complete-run.pl.in'],
628
  output: ['complete-run.pl'],
629
  command: replace_dirs,
630
  # build this target when running e.g. ninja or ninja test.
631
  # This is required for older meson versions (< 0.46.0).
632
  build_by_default: true,
633
)
634
i3test_pm = custom_target(
635
  'i3test-pm',
636
  input: ['testcases/lib/i3test.pm.in'],
637
  output: ['i3test.pm'],
638
  command: replace_dirs,
639
  # build this target when running e.g. ninja or ninja test.
640
  # This is required for older meson versions (< 0.46.0).
641
  build_by_default: true,
642
)
643
644
if get_option('docs')
645
  i3_pod2html = find_program('docs/i3-pod2html')
646
647
  custom_target(
648
    'lib-i3test.html',
649
    input: i3test_pm,
650
    output: 'lib-i3test.html',
651
    command: [
652
      i3_pod2html,
653
      '@INPUT@',
654
      '@OUTPUT@',
655
    ],
656
    install: true,
77 by Javier Lopez
automatic sync 09-12-2020:00:00
657
    install_dir: docdir,
56 by Javier Lopez
automatic sync 31-07-2020:00:00
658
  )
659
660
  custom_target(
661
    'lib-i3test-test.html',
662
    input: 'testcases/lib/i3test/Test.pm',
663
    output: 'lib-i3test-test.html',
664
    command: [
665
      i3_pod2html,
666
      '@INPUT@',
667
      '@OUTPUT@',
668
    ],
669
    install: true,
77 by Javier Lopez
automatic sync 09-12-2020:00:00
670
    install_dir: docdir,
56 by Javier Lopez
automatic sync 31-07-2020:00:00
671
  )
672
endif
673
674
executable(
675
  'test.inject_randr15',
676
  'testcases/inject_randr1.5.c',
677
  include_directories: inc,
678
  dependencies: common_deps,
679
  link_with: libi3,
680
)
681
682
executable(
683
  'test.commands_parser',
74 by Javier Lopez
automatic sync 22-11-2020:00:00
684
  [
685
    'src/commands_parser.c',
686
    command_parser,
687
  ],
56 by Javier Lopez
automatic sync 31-07-2020:00:00
688
  include_directories: inc,
689
  c_args: '-DTEST_PARSER',
690
  dependencies: common_deps,
691
  link_with: libi3,
692
)
693
694
executable(
695
  'test.config_parser',
74 by Javier Lopez
automatic sync 22-11-2020:00:00
696
  [
697
    'src/config_parser.c',
698
    config_parser,
699
  ],
56 by Javier Lopez
automatic sync 31-07-2020:00:00
700
  include_directories: inc,
701
  c_args: '-DTEST_PARSER',
702
  dependencies: common_deps,
703
  link_with: libi3,
704
)
705
706
anyevent_i3 = custom_target(
707
  'anyevent-i3',
708
  # Should be AnyEvent-I3/blib/lib/AnyEvent/I3.pm,
709
  # but see https://github.com/mesonbuild/meson/issues/2320
710
  output: 'AnyEvent-I3.stamp',
711
  command: [
712
    'sh',
713
    '-c',
714
    'cp -r @0@/AnyEvent-I3 . && cd AnyEvent-I3 && perl Makefile.PL && make && touch ../AnyEvent-I3.stamp'.format(meson.current_source_dir()),
715
  ],
716
)
717
718
if meson.version().version_compare('>=0.46.0')
719
  test(
720
    'complete-run',
721
    perl,
722
    args: [complete_run],
723
    depends: [
724
      anyevent_i3,
725
      i3test_pm,
726
    ],
104 by Javier Lopez
automatic sync 30-04-2021:00:00
727
    timeout: 120,  # Default of 30 seconds can cause timeouts on slower machines
56 by Javier Lopez
automatic sync 31-07-2020:00:00
728
  )
729
else
730
  # meson < 0.46.0 does not support the depends arg in test targets.
731
  # Just hope for the best.
732
  test(
733
    'complete-run',
734
    perl,
735
    args: [complete_run],
736
  )
737
  message('meson < 0.46 detected, you might need to run ninja test twice')
738
endif