1
0
Fork 0

address MacOS build failure, backport from iresearch upstream: ensure build_version builds as a separate target and no visibility is set on static libraries, ensure doc_ids are not truncated in the postings list, address some MSVC warnings, address MacOS warnings

This commit is contained in:
Vasiliy 2018-04-10 19:14:39 +03:00
parent 4e49b1afad
commit b8245f9be7
7 changed files with 42 additions and 19 deletions

View File

@ -170,7 +170,7 @@ if (USE_IRESEARCH)
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}/"
COMMAND cp -rp "${IRESEARCH_ROOT}.build/*" "${IRESEARCH_BUILD_DIR}/" # MacOS requires '/*' suffix
)
endif()

View File

@ -314,18 +314,24 @@ add_custom_target(
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/utils/build_identifier.csx
)
# trigger generation of BUILD_VERSION if needed
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/BUILD_VERSION
COMMAND ${CMAKE_COMMAND} -E echo_append "${IResearch_version}" > ${CMAKE_BINARY_DIR}/BUILD_VERSION
)
# trigger regeneration of utils/version_utils.cpp with build_id from file: BUILD_VERSION
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/utils/build_version.csx
COMMAND ${CMAKE_COMMAND} -DSRC="${CMAKE_BINARY_DIR}/BUILD_VERSION" -DDST="${CMAKE_CURRENT_BINARY_DIR}/utils/build_version.csx" -P "${PROJECT_SOURCE_DIR}/cmake/HexEncodeFile.cmake"
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/version_utils.cpp
DEPENDS utils
DEPENDS utils ${CMAKE_BINARY_DIR}/BUILD_VERSION
WORKING_DIRECTORY utils
)
add_custom_target(
${IResearch_TARGET_NAME}-build_version
DEPENDS ${CMAKE_BINARY_DIR}/BUILD_VERSION
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/utils/build_version.csx
)
add_dependencies(${IResearch_TARGET_NAME}-shared
@ -436,6 +442,7 @@ set_target_properties(${IResearch_TARGET_NAME}-shared
IMPORT_PREFIX lib
OUTPUT_NAME iresearch
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;BOOST_ALL_DYN_LINK;$<$<CONFIG:Debug>:YYDEBUG=1>"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-static
@ -454,6 +461,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME iresearch-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;BOOST_ALL_DYN_LINK"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-static-scrt
@ -713,6 +721,7 @@ set_target_properties(${IResearch_TARGET_NAME}-analyzer-delimited-shared
OUTPUT_NAME analyzer-delimited
DEBUG_POSTFIX "" # otherwise library names will not match expected dynamically loaded value
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-analyzer-delimited-static
@ -731,6 +740,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME analyzer-delimited-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-analyzer-delimited-static-scrt
@ -865,6 +875,7 @@ set_target_properties(${IResearch_TARGET_NAME}-analyzer-text-shared
OUTPUT_NAME analyzer-text
DEBUG_POSTFIX "" # otherwise library names will not match expected dynamically loaded value
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN;BOOST_ALL_DYN_LINK"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-analyzer-text-static
@ -883,6 +894,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME analyzer-text-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN;BOOST_ALL_DYN_LINK"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-analyzer-text-static-scrt
@ -1018,6 +1030,7 @@ set_target_properties(${IResearch_TARGET_NAME}-format-1_0-shared
OUTPUT_NAME format-1_0
DEBUG_POSTFIX "" # otherwise library names will not match expected dynamically loaded value
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN;FST_NO_DYNAMIC_LINKING"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-format-1_0-static
@ -1036,6 +1049,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME format-1_0-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_EXPORTS;IRESEARCH_DLL_PLUGIN;FST_NO_DYNAMIC_LINKING"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-format-1_0-static-scrt
@ -1174,6 +1188,7 @@ set_target_properties(${IResearch_TARGET_NAME}-scorer-tfidf-shared
OUTPUT_NAME scorer-tfidf
DEBUG_POSTFIX "" # otherwise library names will not match expected dynamically loaded value
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_IMPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-scorer-tfidf-static
@ -1192,6 +1207,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME scorer-tfidf-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_IMPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-scorer-tfidf-static-scrt
@ -1300,6 +1316,7 @@ set_target_properties(${IResearch_TARGET_NAME}-scorer-bm25-shared
OUTPUT_NAME scorer-bm25
DEBUG_POSTFIX "" # otherwise library names will not match expected dynamically loaded value
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_IMPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-scorer-bm25-static
@ -1318,6 +1335,7 @@ if(MSVC)
IMPORT_PREFIX lib
OUTPUT_NAME scorer-bm25-scrt
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:IRESEARCH_DEBUG>;IRESEARCH_DLL;IRESEARCH_DLL_IMPORTS;IRESEARCH_DLL_PLUGIN"
CXX_VISIBILITY_PRESET hidden
)
set_target_properties(${IResearch_TARGET_NAME}-scorer-bm25-static-scrt

View File

@ -296,19 +296,24 @@ class doc_iterator : public iresearch::doc_iterator {
}
doc_id_t read_skip(skip_state& state, index_input& in) {
state.doc = in.read_vint();
state.doc = in.read_vlong();
state.doc_ptr += in.read_vlong();
if (features_.position()) {
state.pend_pos = in.read_vint();
state.pos_ptr += in.read_vlong();
const bool has_pay = features_.payload();
if (has_pay || features_.offset()) {
if (has_pay) {
state.pay_pos = in.read_vint();
}
state.pay_ptr += in.read_vlong();
}
}
return state.doc;
}
@ -4225,10 +4230,10 @@ void postings_writer::end_term(version10::term_meta& meta, const uint64_t* tfreq
}
void postings_writer::write_skip(size_t level, index_output& out) {
const uint32_t doc_delta = doc.block_last; //- doc.skip_doc[level];
const uint64_t doc_delta = doc.block_last; //- doc.skip_doc[level];
const uint64_t doc_ptr = doc.out->file_pointer();
out.write_vint(doc_delta);
out.write_vlong(doc_delta);
out.write_vlong(doc_ptr - doc.skip_ptr[level]);
doc.skip_doc[level] = doc.block_last;

View File

@ -815,12 +815,12 @@ parser_context::query_state parser_context::current_state() const {
parser_context::query_node const& parser_context::find_node(
parser::semantic_type const& value
) const {
#if defined (__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtype-limits"
#elif defined(__APPLE__)
#if defined(__APPLE__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
#elif defined (__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtype-limits"
#elif defined(_MSC_VER)
#pragma warning(disable: 4127) // conditional expression is constant
#endif
@ -830,10 +830,10 @@ parser_context::query_node const& parser_context::find_node(
return m_nodes[0];
}
#if defined (__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__APPLE__)
#if defined(__APPLE__)
#pragma clang diagnostic pop
#elif defined (__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(default: 4127)
#endif
@ -1429,4 +1429,4 @@ parser::semantic_type parser_context::try_eval(
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

View File

@ -90,7 +90,7 @@ class mmap_index_input : public irs::bytes_ref_input {
IR_FRMT_ERROR("Failed to madvise input file, path: " IR_FILEPATH_SPECIFIER ", error %d", file, errno);
}
handle->dontneed(bool(advice & irs::IOAdvice::READONCE));
handle->dontneed(irs::IOAdvice(0) != (advice & irs::IOAdvice::READONCE));
return mmap_index_input::make<mmap_index_input>(std::move(handle));
}

View File

@ -50,9 +50,9 @@ class StringLeftWeight {
typedef StringLeftWeight<Label> ReverseWeight;
typedef std::basic_string<Label> str_t;
typedef typename str_t::const_iterator iterator;
static const StringLeftWeight<Label>& Zero() {
static const StringLeftWeight<Label> zero(kStringInfinity);
static const StringLeftWeight<Label> zero((Label)kStringInfinity); // cast same as in FST
return zero;
}
@ -62,7 +62,7 @@ class StringLeftWeight {
}
static const StringLeftWeight<Label>& NoWeight() {
static const StringLeftWeight<Label> no_weight(kStringBad);
static const StringLeftWeight<Label> no_weight((Label)kStringBad); // cast same as in FST
return no_weight;
}

View File

@ -423,7 +423,7 @@ template<
slot_size = freelist::MIN_SIZE;
}
slot_size = (slot_size + freelist::MIN_ALIGN - 1) & (-freelist::MIN_ALIGN);
slot_size = (slot_size + freelist::MIN_ALIGN - 1) & (0 - freelist::MIN_ALIGN);
assert(slot_size >= freelist::MIN_SIZE);
assert(!(slot_size % freelist::MIN_ALIGN));