meson: Add support for using win_flex and win_bison on windows

Acked-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Dylan Baker 2018-05-17 13:42:50 -07:00
parent 81d44c01ee
commit 8b19c5b145

View File

@ -1438,8 +1438,31 @@ endif
# pthread stubs. Lets not and say we didn't
prog_bison = find_program('bison', required : with_any_opengl)
prog_flex = find_program('flex', required : with_any_opengl)
if host_machine.system() == 'windows'
# Prefer the winflexbison versions, they're much easier to install and have
# better windows support.
prog_flex = find_program('win_flex', required : false)
if prog_flex.found()
# windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
# _fileno functions)
prog_flex = [prog_flex, '--wincompat']
else
prog_flex = [find_program('lex', 'flex', required : with_any_opengl)]
endif
# Force flex to use const keyword in prototypes, as relies on __cplusplus or
# __STDC__ macro to determine whether it's safe to use const keyword, but
# MSVC never defines __STDC__ unless we disable all MSVC extensions.
prog_flex += '-DYY_USE_CONST='
prog_bison = find_program('win_bison', required : false)
if not prog_bison.found()
prog_bison = find_program('yacc', 'bison', required : with_any_opengl)
endif
else
prog_bison = find_program('bison', required : with_any_opengl)
prog_flex = find_program('flex', required : with_any_opengl)
endif
dep_selinux = null_dep
if get_option('selinux')