From d3c189bd1f50912420192dcad0647f8ad106b43c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 22 Aug 2021 14:36:22 +0200 Subject: [PATCH] abacus: parse: declare proper dependency Due to creating a dependency, we should use `custom_target` rather a `generator` expression. --- src/parse/meson.build | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/parse/meson.build b/src/parse/meson.build index 1c8159e..254d868 100644 --- a/src/parse/meson.build +++ b/src/parse/meson.build @@ -1,8 +1,10 @@ flex_binary = find_program('flex', required: true) -flex = generator( - flex_binary, - output: '@BASENAME@.cc', - arguments: [ +lexer_sources = custom_target( + 'lexer_sources', + input: 'scanner.ll', + output: 'scanner.cc', + command: [ + flex_binary, '-o', '@OUTPUT@', '@INPUT@', @@ -10,13 +12,15 @@ flex = generator( ) bison_binary = find_program('bison', required: true) -bison = generator( - bison_binary, +parser_sources = custom_target( + 'parser_sources', + input: 'parser.yy', output: [ - '@BASENAME@.cc', - '@BASENAME@.hh', + 'parser.cc', + 'parser.hh', ], - arguments: [ + command: [ + bison_binary, '@INPUT@', '--output=@OUTPUT0@', '--defines=@OUTPUT1@', @@ -25,13 +29,20 @@ bison = generator( ], ) -parser = library( +parse_inc = include_directories('.') + +parse_lib = library( 'parser', 'parser-driver.cc', 'parser-driver.hh', - flex.process('scanner.ll'), - bison.process('parser.yy'), + lexer_sources, + parser_sources, dependencies: [ bignum, ], ) + +parse = declare_dependency( + link_with: parse_lib, + include_directories: parse_inc, +)