abacus: parse: declare proper dependency

Due to creating a dependency, we should use `custom_target` rather a
`generator` expression.
This commit is contained in:
Bruno BELANYI 2021-08-22 14:36:22 +02:00
parent 60a0fbf5b0
commit d3c189bd1f

View file

@ -1,8 +1,10 @@
flex_binary = find_program('flex', required: true) flex_binary = find_program('flex', required: true)
flex = generator( lexer_sources = custom_target(
flex_binary, 'lexer_sources',
output: '@BASENAME@.cc', input: 'scanner.ll',
arguments: [ output: 'scanner.cc',
command: [
flex_binary,
'-o', '-o',
'@OUTPUT@', '@OUTPUT@',
'@INPUT@', '@INPUT@',
@ -10,13 +12,15 @@ flex = generator(
) )
bison_binary = find_program('bison', required: true) bison_binary = find_program('bison', required: true)
bison = generator( parser_sources = custom_target(
bison_binary, 'parser_sources',
input: 'parser.yy',
output: [ output: [
'@BASENAME@.cc', 'parser.cc',
'@BASENAME@.hh', 'parser.hh',
], ],
arguments: [ command: [
bison_binary,
'@INPUT@', '@INPUT@',
'--output=@OUTPUT0@', '--output=@OUTPUT0@',
'--defines=@OUTPUT1@', '--defines=@OUTPUT1@',
@ -25,13 +29,20 @@ bison = generator(
], ],
) )
parser = library( parse_inc = include_directories('.')
parse_lib = library(
'parser', 'parser',
'parser-driver.cc', 'parser-driver.cc',
'parser-driver.hh', 'parser-driver.hh',
flex.process('scanner.ll'), lexer_sources,
bison.process('parser.yy'), parser_sources,
dependencies: [ dependencies: [
bignum, bignum,
], ],
) )
parse = declare_dependency(
link_with: parse_lib,
include_directories: parse_inc,
)