summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2018-05-17 13:42:50 -0700
committerDylan Baker <[email protected]>2019-10-10 16:33:04 -0700
commit8b19c5b145592314a63569d7ba3f0e10df84a5cf (patch)
tree34cc258fef883e982087c48ffd8e706bc588bd08 /meson.build
parent81d44c01eeda9adeb2463b8f6bc610a75770dba7 (diff)
meson: Add support for using win_flex and win_bison on windows
Acked-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build27
1 files changed, 25 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 10b9c9e9b19..b823dd8ecec 100644
--- a/meson.build
+++ b/meson.build
@@ -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')