1
0
Fork 0

Bug fix/copy schmutz (#7441)

* don't copy files, rather source them from their actual location directly

* also locate the stemmer modules header
This commit is contained in:
Wilfried Goesgens 2018-11-26 16:35:03 +01:00 committed by Frank Celler
parent 0d5f85e684
commit 285c842983
2 changed files with 30 additions and 40 deletions

View File

@ -166,6 +166,11 @@ if (USE_IRESEARCH)
set(UNWIND_ROOT "invalid")
set(BFD_ROOT "invalid")
set(IRESEARCH_PREGENERATED_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/iresearch.build/")
set(GENERATED_PARSER_SOURCES "${IRESEARCH_PREGENERATED_ROOT}/core/iql/parser.cc" CACHE PATH "use pregenerated source")
include_directories("${IRESEARCH_PREGENERATED_ROOT}/core/")
include_directories("${IRESEARCH_PREGENERATED_ROOT}/external/snowball/libstemmer/")
if(MSVC)
set(USE_IQL OFF CACHE BOOL "Use IQL" FORCE) # skip IQL on MSVC until IResearch upstream is updated
endif()
@ -180,24 +185,6 @@ if (USE_IRESEARCH)
"${IRESEARCH_ROOT}/cmake" # to find iResearch dependencies
)
# cmake will seemingly randomly delete files from ${IRESEARCH_BUILD_DIR} during configuration
# so must copy required files only after the cmake configuration phase is complete, not via file(COPY ...)
# this command must _always_ be executed because the subsequent cmake configuration runs will once again delete files
if(MSVC)
add_custom_command(OUTPUT "${IRESEARCH_BUILD_DIR}/copy_iresearch.build" # non-existent file
COMMAND ${CMAKE_COMMAND} -E copy_directory "${IRESEARCH_ROOT}.build/" "${IRESEARCH_BUILD_DIR}/"
)
else()
# 'cmake -E copy_directory' does not preserve timestamps, use 'cp' directly where avalable
add_custom_command(OUTPUT "${IRESEARCH_BUILD_DIR}/copy_iresearch.build" # non-existent file
COMMAND cp -rp "${IRESEARCH_ROOT}.build/*" "${IRESEARCH_BUILD_DIR}/" # MacOS requires '/*' suffix
)
endif()
add_custom_target("copy_iresearch.build" ALL
DEPENDS "${IRESEARCH_BUILD_DIR}/copy_iresearch.build"
)
add_subdirectory("${IRESEARCH_ROOT}" "${IRESEARCH_BUILD_DIR}" EXCLUDE_FROM_ALL) # do not build unused targets
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_ORIGINAL}) # restore CMAKE_MODULE_PATH
unset(BUILD_SHARED_LIBS) # otherwise ZLib (below) does not build on win32
@ -208,13 +195,6 @@ if (USE_IRESEARCH)
# cmake does not build ICU without this (cmake does not inherit dependencies)
add_dependencies(v8_build icu-build icudata-static icui18n-static icuuc-static)
endif()
# ensure the 'copy_iresearch.build' target is executed before start of build of the 'iresearch' target
if(MSVC)
add_dependencies(iresearch-static-scrt "copy_iresearch.build") # use static + staticCRT to match ArangoDB
else()
add_dependencies(iresearch-static "copy_iresearch.build") # use static to match ArangoDB
endif()
endif()

View File

@ -83,6 +83,14 @@ if (USE_OPTIMIZE_FOR_ARCHITECTURE)
)
endif()
if (GENERATED_PARSER_SOURCES)
message(STATUS "using pre-generated parser")
set(PARSER_SRC "${GENERATED_PARSER_SOURCES}")
else()
message(STATUS "generating parser")
set(PARSER_SRC "./iql/parser.cc")
endif()
set(IResearch_core_sources
./utils/string.cpp
./analysis/analyzer.cpp
@ -107,7 +115,7 @@ set(IResearch_core_sources
./index/segment_reader.cpp
./index/segment_writer.cpp
./index/transaction_store.cpp
./iql/parser.cc
${PARSER_SRC}
./iql/parser_common.cpp
./iql/parser_context.cpp
./iql/query_builder.cpp
@ -301,20 +309,22 @@ if(MSVC)
)
endif()
# generate IQL grammar
# force dependency modification validation by comparing with local copy of the
# source file to suppress file regeneration by scripts generated for MSVC and to
# suppress file regeneration by scripts generated for 'make' due to equal
# dependency and generated file timestamp
add_custom_command(
OUTPUT iql/parser.cc
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E make_directory iql
COMMAND ${CMAKE_COMMAND} -E md5sum iql/parser.cc || ${CMAKE_COMMAND} -E remove iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy iql/parser.yy || bison --graph --report=all -Wnone -o iql/parser.cc ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy iql/parser.yy
)
if (NOT GENERATED_PARSER_SOURCES)
# generate IQL grammar
# force dependency modification validation by comparing with local copy of the
# source file to suppress file regeneration by scripts generated for MSVC and to
# suppress file regeneration by scripts generated for 'make' due to equal
# dependency and generated file timestamp
add_custom_command(
OUTPUT iql/parser.cc
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E make_directory iql
COMMAND ${CMAKE_COMMAND} -E md5sum iql/parser.cc || ${CMAKE_COMMAND} -E remove iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy iql/parser.yy || bison --graph --report=all -Wnone -o iql/parser.cc ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iql/parser.yy iql/parser.yy
)
endif()
# trigger generation of BUILD_IDENTIFIER if needed
add_custom_command(