1
0
Fork 0

added FLEX and BISON

This commit is contained in:
Frank Celler 2016-02-22 18:43:16 +01:00
parent 6fa4e319bb
commit 0639e688f5
4 changed files with 121 additions and 93 deletions

View File

@ -65,7 +65,7 @@ configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/lib/Basics/build.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/lib/Basics/build.h")
configure_file (
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lib/Basics/VERSION.in"
"${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
@ -317,7 +317,7 @@ endif ()
# Maintainer mode (Assertions) -------------------------------------------------
option(USE_MAINTAINER_MODE
"whether we want to have assertions and other development features" OFF)
if (USE_MAINTAINER_MODE)
if ()
add_definitions("-DTRI_ENABLE_MAINTAINER_MODE=1")
endif ()
@ -656,6 +656,42 @@ if (OPENSSL_VERSION)
endif ()
endif ()
# BISON&FLEX -------------------------------------------------------------------
find_package(BISON)
# FLEX -------------------------------------------------------------------------
find_package(FLEX)
# Python
find_package(PythonInterp 2)
set(ENV{PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE})
# zlib -------------------------------------------------------------------------
set(ZLIB_VERSION "unknown" CACHE string "ZLIB version")
if (MSVC OR RASPBIAN)
set(ZLIB_LIBS z CACHE string "ZLIB libraries")
else ()
set(ZLIB_INCLUDE ${PROJECT_SOURCE_DIR}/3rdParty/zlib-1.2.7
CACHE path "ZLIB include path")
set(ZLIB_LIB_PATH ${PROJECT_SOURCE_DIR}/3rdParty/zlib-1.2.7
CACHE path "ZLIB library path")
set(ZLIB_LIBS z CACHE string "ZLIB libraries")
endif ()
if (ZLIB_INCLUDE)
include_directories(${ZLIB_INCLUDE})
endif ()
if (ZLIB_LIB_PATH)
link_directories(${ZLIB_LIB_PATH})
endif ()
add_definitions("-DTRI_ZLIB_VERSION=\"${ZLIB_VERSION}\"")
# 3rd party libraries
add_subdirectory(3rdParty)
# sub directories --------------------------------------------------------------
add_subdirectory(lib)

View File

@ -54,12 +54,42 @@ if (MSVC)
)
endif ()
# note that we check-in the generated FLEX/BISON files, therefore they are
# generate inside the source tree
if (USE_MAINTAINER_MODE)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/Aql/tokens.cpp
COMMAND
${CMAKE_SOURCE_DIR}/utils/flex-c++.sh
${FLEX_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/Aql/tokens.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Aql/tokens.ll
MAIN_DEPENDENCY
${CMAKE_CURRENT_SOURCE_DIR}/Aql/tokens.ll
)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/Aql/grammar.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Aql/position.h
COMMAND
${CMAKE_SOURCE_DIR}/utils/bison-c.sh
${BISON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/Aql/grammar.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Aql/grammar.y
MAIN_DEPENDENCY
${CMAKE_CURRENT_SOURCE_DIR}/Aql/grammar.y
)
endif ()
add_executable(
${BIN_ARANGOD}
${ARANGO_MSVC}
${ProductVersionFiles}
Actions/actions.cpp
Actions/RestActionHandler.cpp
Actions/actions.cpp
ApplicationServer/ApplicationFeature.cpp
ApplicationServer/ApplicationServer.cpp
Aql/Aggregator.cpp
@ -74,12 +104,12 @@ add_executable(
Aql/CalculationBlock.cpp
Aql/ClusterBlocks.cpp
Aql/ClusterNodes.cpp
Aql/Collection.cpp
Aql/Collections.cpp
Aql/CollectionScanner.cpp
Aql/CollectBlock.cpp
Aql/CollectNode.cpp
Aql/CollectOptions.cpp
Aql/Collection.cpp
Aql/CollectionScanner.cpp
Aql/Collections.cpp
Aql/Condition.cpp
Aql/ConditionFinder.cpp
Aql/EnumerateCollectionBlock.cpp
@ -93,13 +123,13 @@ add_executable(
Aql/Expression.cpp
Aql/Function.cpp
Aql/Functions.cpp
Aql/grammar.cpp
Aql/Graphs.cpp
Aql/Index.cpp
Aql/IndexBlock.cpp
Aql/IndexNode.cpp
Aql/ModificationBlocks.cpp
Aql/ModificationNodes.cpp
Aql/ModificationOptions.cpp
Aql/NodeFinder.cpp
Aql/Optimizer.cpp
Aql/OptimizerRules.cpp
@ -117,20 +147,20 @@ add_executable(
Aql/SortCondition.cpp
Aql/SortNode.cpp
Aql/SubqueryBlock.cpp
Aql/tokens.cpp
Aql/TraversalConditionFinder.cpp
Aql/TraversalBlock.cpp
Aql/TraversalConditionFinder.cpp
Aql/TraversalNode.cpp
Aql/V8Expression.cpp
Aql/Variable.cpp
Aql/VariableGenerator.cpp
Aql/ModificationOptions.cpp
Aql/grammar.cpp
Aql/tokens.cpp
Cluster/AgencyComm.cpp
Cluster/ApplicationCluster.cpp
Cluster/ClusterComm.cpp
Cluster/ClusterInfo.cpp
Cluster/ClusterTraverser.cpp
Cluster/ClusterMethods.cpp
Cluster/ClusterTraverser.cpp
Cluster/HeartbeatThread.cpp
Cluster/RestShardHandler.cpp
Cluster/ServerJob.cpp
@ -159,6 +189,7 @@ add_executable(
HttpServer/HttpsCommTask.cpp
HttpServer/HttpsServer.cpp
HttpServer/PathHandler.cpp
IndexOperators/index-operator.cpp
Indexes/CapConstraint.cpp
Indexes/EdgeIndex.cpp
Indexes/FulltextIndex.cpp
@ -170,15 +201,14 @@ add_executable(
Indexes/PrimaryIndex.cpp
Indexes/SimpleAttributeEqualityMatcher.cpp
Indexes/SkiplistIndex.cpp
IndexOperators/index-operator.cpp
Replication/ContinuousSyncer.cpp
Replication/InitialSyncer.cpp
Replication/Syncer.cpp
RestHandler/RestAdminLogHandler.cpp
RestHandler/RestBaseHandler.cpp
RestHandler/RestBatchHandler.cpp
RestHandler/RestDebugHandler.cpp
RestHandler/RestCursorHandler.cpp
RestHandler/RestDebugHandler.cpp
RestHandler/RestDocumentHandler.cpp
RestHandler/RestEdgeHandler.cpp
RestHandler/RestEdgesHandler.cpp
@ -233,8 +263,8 @@ add_executable(
V8Server/V8TimerTask.cpp
V8Server/V8Traverser.cpp
V8Server/v8-actions.cpp
V8Server/v8-collection.cpp
V8Server/v8-collection-util.cpp
V8Server/v8-collection.cpp
V8Server/v8-dispatcher.cpp
V8Server/v8-query.cpp
V8Server/v8-replication.cpp
@ -246,37 +276,37 @@ add_executable(
V8Server/v8-voccursor.cpp
V8Server/v8-vocindex.cpp
V8Server/v8-wrapshapedjson.cpp
VocBase/DatafileStatistics.cpp
VocBase/Ditch.cpp
VocBase/DocumentAccessor.cpp
VocBase/ExampleMatcher.cpp
VocBase/Graphs.cpp
VocBase/KeyGenerator.cpp
VocBase/Legends.cpp
VocBase/Shaper.cpp
VocBase/Traverser.cpp
VocBase/VocShaper.cpp
VocBase/auth.cpp
VocBase/cleanup.cpp
VocBase/collection.cpp
VocBase/compactor.cpp
VocBase/datafile.cpp
VocBase/DatafileStatistics.cpp
VocBase/Ditch.cpp
VocBase/document-collection.cpp
VocBase/DocumentAccessor.cpp
VocBase/ExampleMatcher.cpp
VocBase/edge-collection.cpp
VocBase/Graphs.cpp
VocBase/headers.cpp
VocBase/KeyGenerator.cpp
VocBase/Legends.cpp
VocBase/replication-applier.cpp
VocBase/replication-common.cpp
VocBase/replication-dump.cpp
VocBase/server.cpp
VocBase/shape-accessor.cpp
VocBase/shaped-json.cpp
VocBase/Shaper.cpp
VocBase/transaction.cpp
VocBase/Traverser.cpp
VocBase/vocbase.cpp
VocBase/vocbase-defaults.cpp
VocBase/VocShaper.cpp
VocBase/vocbase.cpp
Wal/AllocatorThread.cpp
Wal/CollectorThread.cpp
Wal/LogfileManager.cpp
Wal/Logfile.cpp
Wal/LogfileManager.cpp
Wal/Marker.cpp
Wal/RecoverState.cpp
Wal/RemoverThread.cpp

View File

@ -9,6 +9,35 @@ include_directories(${PROJECT_SOURCE_DIR}/3rdParty/linenoise-ng/src)
include_directories(${PROJECT_SOURCE_DIR}/3rdParty/velocypack/include)
include_directories(${V8_INCLUDE_DIR})
# note that we check-in the generated FLEX/BISON files, therefore they are
# generate inside the source tree
if (USE_MAINTAINER_MODE)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/lib/JsonParser/json-parser.cpp
COMMAND
${CMAKE_SOURCE_DIR}/utils/flex-c++.sh
${FLEX_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/lib/JsonParser/json-parser.ll
${CMAKE_CURRENT_SOURCE_DIR}/lib/JsonParser/json-parser.cpp
MAIN_DEPENDENCY
${CMAKE_CURRENT_SOURCE_DIR}/lib/JsonParser/json-parser.ll
)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/lib/JsonParser.cpp
COMMAND
${CMAKE_SOURCE_DIR}/utils/flex-c++.sh
${FLEX_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/V8/v8-json.ll
${CMAKE_CURRENT_SOURCE_DIR}/V8/v8-json.cpp
MAIN_DEPENDENCY
${CMAKE_CURRENT_SOURCE_DIR}/V8/v8-json.ll
)
endif ()
################################################################################
## LIB_ARANGO
################################################################################

View File

@ -1,67 +0,0 @@
#!/bin/sh
BISON="$1"
OUTPUT="$2"
INPUT="$3"
if test "x$BISON" = x -o "x$OUTPUT" = x -o "x$INPUT" = x; then
echo "usage: $0 <bison> <output> <input>"
exit 1
fi
#############################################################################
## bison
#############################################################################
${BISON} -l -d -ra -S lalr1.cc --warnings="deprecated,other,error=conflicts-sr,error=conflicts-rr" -o ${OUTPUT} ${INPUT}
#############################################################################
## sanity checks
#############################################################################
PREFIX=`echo ${OUTPUT} | sed -e 's:\.cpp$::'`
test -f ${PREFIX}.hpp || exit 1
test -f ${PREFIX}.cpp || exit 1
#############################################################################
# the following command will insert extra parentheses around a sub expression
# to suppress compiler warnings. it will copy the file to a new location 1st
#############################################################################
DIR=`dirname ${OUTPUT}`
mv ${DIR}/position.hh ${DIR}/position.hh.tmp
sed -e 's/\(pos1.filename && pos2.filename && .pos1.filename == .pos2.filename\)/(&)/g' \
${DIR}/position.hh.tmp > ${DIR}/position.hh
# give some information
diff -u ${DIR}/position.hh.tmp ${DIR}/position.hh
# cleanup
rm -f ${DIR}/position.hh.tmp
#############################################################################
## rename file
#############################################################################
mv ${PREFIX}.hpp ${PREFIX}.h || exit 1
#############################################################################
## fix header file name in source, fix defines
#############################################################################
sed -e 's:\.hpp:.h:' < ${OUTPUT} \
| sed -e 's:# if YYENABLE_NLS:# if defined(YYENABLE_NLS) \&\& YYENABLE_NLS:' \
| sed -e 's:__attribute__((__unused__)):' \
> ${OUTPUT}.tmp
# give some information
diff -u ${OUTPUT} ${OUTPUT}.tmp
# and move the files to the final destination
mv ${OUTPUT}.tmp ${OUTPUT} || exit 1