1 cc = meson.get_compiler('c')
3 # Find flex, configure lex generator
4 flex_cdata = configuration_data()
6 flex_min_version='2.5.31'
7 flex = find_program('flex', 'win_flex')
9 flexversion_res = run_command([flex, '--version'])
10 if flexversion_res.returncode() != 0
11 error('Could not get flex version (@0@)'.format(flexversion_res.stderr()))
14 flexversion = flexversion_res.stdout().split('\n')[0].split(' ')[1].strip()
15 if flexversion.version_compare('<' + flex_min_version)
16 error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version))
18 message('flex version @0@ >= @1@: YES'.format(flexversion, flex_min_version))
21 flex_cdata.set('FLEX', flex.path())
22 if cc.get_id() == 'msvc'
23 flex_cdata.set('FLEX_ARGS', '--nounistd')
25 flex_cdata.set('FLEX_ARGS', '')
28 gen_lex = configure_file(input : 'gen_lex.py.in',
29 output : 'gen_lex.py',
30 configuration : flex_cdata)
32 # Find bison, configure grammar generator
33 bison_cdata = configuration_data()
35 bison_min_version='2.4'
36 bison = find_program('bison', 'win_bison')
38 bversion_res = run_command([bison, '--version'])
39 if bversion_res.returncode() != 0
40 error('Could not get bison version (@0@)'.format(bversion_res.stderr()))
43 bversion = bversion_res.stdout().split('\n')[0].split(' ')[-1].strip()
44 if bversion.version_compare('<' + bison_min_version)
45 error('bison version @0@ >= @1@: NO'.format(bversion, bison_min_version))
47 message('bison version @0@ >= @1@: YES'.format(bversion, bison_min_version))
52 bison_cdata.set('BISON', bison.path())
53 bison_cdata.set('BISON_ARGS', '')
55 gen_grammar = configure_file(input : 'gen_grammar.py.in',
56 output : 'gen_grammar.py',
57 configuration : bison_cdata)
60 parser = custom_target('parselex',
62 output : ['lex.priv_gst_parse_yy.c', 'parse_lex.h'],
63 command : [python3, gen_lex, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', 'DUMMY']
66 grammar = custom_target('parsegrammar',
68 output : ['grammar.tab.c', 'grammar.tab.h'],
69 command : [python3, gen_grammar, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@'],