]> begriffs open source - sa-parse/blob - src/meson.build
ical parser
[sa-parse] / src / meson.build
1 # CSV Parser build configuration
2
3 # Find required tools
4 bison = find_program('bison', 'yacc', required: true)
5 flex = find_program('flex', required: true)
6
7 # Find libderp via pkg-config
8 libderp_dep = dependency('libderp', required: true)
9
10 # Set up generators for bison and flex
11 bison_gen = generator(bison,
12     output: ['@BASENAME@.tab.c', '@BASENAME@.tab.h', '@BASENAME@.output', '@BASENAME@.xml', '@BASENAME@.dot'],
13     arguments: ['-d', '@INPUT@', '--output=@OUTPUT0@', '--defines=@OUTPUT1@', '--report=all,counterexamples', '--report-file=@OUTPUT2@', '--xml=@OUTPUT3@', '--graph=@OUTPUT4@', '--warnings=all,counterexamples'])
14
15 flex_gen = generator(flex,
16     output: ['@BASENAME@.yy.c', '@BASENAME@.lex.h'],
17     arguments: ['--header-file=@OUTPUT1@', '-o', '@OUTPUT0@', '@INPUT@'])
18
19 # Generate parser and lexer files
20 csv_parser_files = bison_gen.process('csv.y')
21 csv_lexer_files = flex_gen.process('csv.l')
22
23 # Generate iCalendar parser and lexer files
24 ical_parser_files = bison_gen.process('ical.y')
25 ical_lexer_files = flex_gen.process('ical.l')
26
27 # Check for yacc/flex libraries that may be needed for linking
28 cc = meson.get_compiler('c')
29 yacc_lib = cc.find_library('y', required: false)
30 flex_lib = cc.find_library('fl', required: false)
31
32 # Collect dependencies
33 parser_deps = [libderp_dep]
34 if yacc_lib.found()
35     parser_deps += yacc_lib
36 endif
37 if flex_lib.found()
38     parser_deps += flex_lib
39 endif
40
41 # Build the CSV parser executable
42 csv_parser = executable('csv_parser',
43     sources: [csv_parser_files, csv_lexer_files, 'csv_driver.c', 'csv_parser.c'],
44     dependencies: parser_deps,
45     c_args: ['-D_XOPEN_SOURCE=600'],
46     install: false)
47
48 # Build the iCalendar parser executable
49 ical_parser = executable('ical_parser',
50     sources: [ical_parser_files, ical_lexer_files, 'ical_driver.c', 'ical_parser.c'],
51     dependencies: parser_deps,
52     c_args: ['-D_XOPEN_SOURCE=600'],
53     install: false)