[Mesa-dev] [PATCH v2 29/49] meson: Add support for using win_flex and win_bison on windows
Dylan Baker
dylan at pnwbakers.com
Tue Jul 10 23:17:57 UTC 2018
---
meson.build | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 03b37708ee2..164917eae1a 100644
--- a/meson.build
+++ b/meson.build
@@ -1311,8 +1311,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')
--
2.18.0
More information about the mesa-dev
mailing list