[Interest] qmake-qt5 and lex/yacc parsing

René J.V. Bertin rjvbertin at gmail.com
Fri May 15 10:37:49 CEST 2015


Hello,

I'm porting an application (xxdiff) to Qt5 that has a lex/yacc based parser on board. The .pro file contains the following section:

#
# Parser/grammar generation.
#
QMAKE_LEX = flex
QMAKE_YACC = bison
QMAKE_YACCFLAGS = -d -o y.tab.c
QMAKE_YACC_HEADER = y.tab.h
QMAKE_YACC_SOURCE = y.tab.c
LEXSOURCES = resParser.l
YACCSOURCES = resParser.y
# We don't need to actually build the parser, we include it from resParser.o to
# isolate it in its namespace, but this means that we do need to add appropriate
# dependencies.


With Qt4, this generates resParser_yacc.{h,cpp} and resParser_lex.{h,cpp} and the build works out fine. Two source files listed in <SOURCE> include resParser_yacc.h and 1 includes resParser_lex.h .

This is not the case with Qt 5.4.1 . The resParser_yacc files get created correctly, but the build fails when resParser.cpp tries to include resParser_lex.h which has not been generated at that point. It's as if dependencies aren't scanned or parsed correctly, and flex is never called.
I added resParser_lex.h to the <HEADERS> list tentatively, and for some reason the caused flex to be executed, but that apparently was a coincidence.

Was it a coincidence that this ever worked under Qt4, or is there a regression in Qt5's qmake?

I'm doing this under OS X; the original xxdiff sources are @ https://bitbucket.org/blais/xxdiff (a mercurial repo).

Thanks,
R.



More information about the Interest mailing list