Merge lp:~zorba-coders/zorba/bug-1034582-flexlexerh into lp:zorba

Proposed by Chris Hillery
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 10978
Merged at revision: 10980
Proposed branch: lp:~zorba-coders/zorba/bug-1034582-flexlexerh
Merge into: lp:zorba
Diff against target: 56 lines (+18/-6)
2 files modified
cmake_modules/CMakeUseFlex.cmake (+17/-5)
src/compiler/parser/copyparser.sh.cmake (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1034582-flexlexerh
Reviewer Review Type Date Requested Status
Paul J. Lucas Approve
Chris Hillery Approve
Review via email: mp+119075@code.launchpad.net

Commit message

Add "generation" of local copy of FlexLexer.h, to ensure it always stays in sync with the generated lexer .cpp file.

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Why do you copy FlexLexer.h to the top-level src directory? Why isn't it copied to build/src/compiler/parser to mirror the pre-generated location?

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Yep, it works on Mountain Lion using the stock flex.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1034582-flexlexerh-2012-08-10T03-41-04.821Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake_modules/CMakeUseFlex.cmake'
2--- cmake_modules/CMakeUseFlex.cmake 2012-07-24 08:48:48 +0000
3+++ cmake_modules/CMakeUseFlex.cmake 2012-08-10 02:20:25 +0000
4@@ -29,6 +29,7 @@
5
6 IF(NOT FLEX_EXECUTABLE)
7 MESSAGE(STATUS "Looking for flex")
8+ FIND_PATH(FLEX_INCLUDE_DIR FlexLexer.h)
9 FIND_PROGRAM(FLEX_EXECUTABLE flex)
10 IF(FLEX_EXECUTABLE)
11 EXEC_PROGRAM(
12@@ -63,15 +64,26 @@
13 ELSE(FLEX_PREFIX_OUTPUTS)
14 SET(PREFIX "yy")
15 ENDIF(FLEX_PREFIX_OUTPUTS)
16+ # If we regenerate the scanner, be sure to copy the corresponding
17+ # FlexLexer.h as well. Put it in the top-level src/ directory since
18+ # that path is on the include-directories list; also, that way
19+ # multiple flex'd files will all share the include file.
20+ SET(FLEXLEXERH "${CMAKE_CURRENT_BINARY_DIR}/FlexLexer.h")
21+ ADD_CUSTOM_COMMAND(
22+ OUTPUT "${FLEXLEXERH}"
23+ COMMAND "${CMAKE_COMMAND}"
24+ ARGS -E copy_if_different
25+ "${FLEX_INCLUDE_DIR}/FlexLexer.h"
26+ "${FLEXLEXERH}")
27 SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${PREFIX}.cpp")
28 ADD_CUSTOM_COMMAND(
29 OUTPUT "${OUTFILE}"
30 COMMAND "${FLEX_EXECUTABLE}"
31- ARGS -t
32- "--debug"
33- "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
34- > ${OUTFILE}
35- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
36+ ARGS -t --debug "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
37+ # flex's --outfile doesn't seem to work right, so redirect stdout
38+ > "${OUTFILE}"
39+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
40+ "${FLEXLEXERH}")
41 SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
42 ENDMACRO(FLEX_FILE)
43 ENDIF(FLEX_EXECUTABLE)
44
45=== modified file 'src/compiler/parser/copyparser.sh.cmake'
46--- src/compiler/parser/copyparser.sh.cmake 2012-07-24 08:48:48 +0000
47+++ src/compiler/parser/copyparser.sh.cmake 2012-08-10 02:20:25 +0000
48@@ -20,7 +20,7 @@
49
50 cp $BINARY_DIR/compiler/parser/xquery_parser.hpp $SOURCE_DIR/compiler/parser
51 cp $BINARY_DIR/compiler/parser/xquery_parser.cpp $SOURCE_DIR/compiler/parser
52-cp /usr/include/FlexLexer.h $SOURCE_DIR/compiler/parser/FlexLexer.h
53+cp $BINARY_DIR/FlexLexer.h $SOURCE_DIR/compiler/parser/FlexLexer.h
54 sed -e 's|^#include <FlexLexer.h>|#include "compiler/parser/FlexLexer.h"|g' $BINARY_DIR/compiler/parser/xquery_scanner.cpp > $SOURCE_DIR/compiler/parser/xquery_scanner.cpp
55
56 echo "Copying Done!"

Subscribers

People subscribed via source and target branches