# CSV Parser build configuration # Find required tools bison = find_program('bison', 'yacc', required: true) flex = find_program('flex', required: true) # Find libderp via pkg-config libderp_dep = dependency('libderp', required: true) # Set up generators for bison and flex bison_gen = generator(bison, output: ['@BASENAME@.tab.c', '@BASENAME@.tab.h', '@BASENAME@.output', '@BASENAME@.xml', '@BASENAME@.dot'], arguments: ['-d', '@INPUT@', '--output=@OUTPUT0@', '--defines=@OUTPUT1@', '--report=all,counterexamples', '--report-file=@OUTPUT2@', '--xml=@OUTPUT3@', '--graph=@OUTPUT4@', '--warnings=all,counterexamples']) flex_gen = generator(flex, output: ['@BASENAME@.yy.c', '@BASENAME@.lex.h'], arguments: ['--header-file=@OUTPUT1@', '-o', '@OUTPUT0@', '@INPUT@']) # Generate parser and lexer files csv_parser_files = bison_gen.process('csv.y') csv_lexer_files = flex_gen.process('csv.l') # Generate iCalendar parser and lexer files ical_parser_files = bison_gen.process('ical.y') ical_lexer_files = flex_gen.process('ical.l') # Check for yacc/flex libraries that may be needed for linking cc = meson.get_compiler('c') yacc_lib = cc.find_library('y', required: false) flex_lib = cc.find_library('fl', required: false) # Collect dependencies parser_deps = [libderp_dep] if yacc_lib.found() parser_deps += yacc_lib endif if flex_lib.found() parser_deps += flex_lib endif # Build the CSV parser executable csv_parser = executable('csv_parser', sources: [csv_parser_files, csv_lexer_files, 'csv_driver.c', 'csv_parser.c'], dependencies: parser_deps, c_args: ['-D_XOPEN_SOURCE=600'], install: false) # Build the iCalendar parser executable ical_parser = executable('ical_parser', sources: [ical_parser_files, ical_lexer_files, 'ical_driver.c', 'ical_parser.c'], dependencies: parser_deps, c_args: ['-D_XOPEN_SOURCE=600'], install: false)