Experimenting with ICU linking options.

This commit is contained in:
Kishore Nallan 2018-04-02 19:17:47 +05:30
parent 55ac4feb08
commit ddcb89843f
3 changed files with 22 additions and 9 deletions

View File

@ -72,10 +72,27 @@ add_executable(typesense_test ${SRC_FILES} test/main.cpp test/array_test.cpp tes
test/string_utils_test.cpp)
set(TYPESENSE_VERSION "nightly" CACHE STRING "") # will be overridden from command line during a release build
target_compile_definitions(typesense-server PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
target_compile_definitions(benchmark PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
target_compile_definitions(search PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
target_compile_definitions(typesense_test PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/" TYPESENSE_VERSION="${TYPESENSE_VERSION}")
target_compile_definitions(
typesense-server PRIVATE
TYPESENSE_VERSION="${TYPESENSE_VERSION}"
)
target_compile_definitions(
benchmark PRIVATE
TYPESENSE_VERSION="${TYPESENSE_VERSION}"
)
target_compile_definitions(
search PRIVATE
TYPESENSE_VERSION="${TYPESENSE_VERSION}"
)
target_compile_definitions(
typesense_test PRIVATE
ROOT_DIR="${CMAKE_SOURCE_DIR}/"
TYPESENSE_VERSION="${TYPESENSE_VERSION}"
)
if (APPLE)
set(STD_LIB -static-libstdc++) # https://stackoverflow.com/a/26543140/131050 (can't statically link libgcc on Mac)

View File

@ -1,9 +1,5 @@
#pragma once
#define U_USING_ICU_NAMESPACE 0
#define U_STATIC_IMPLEMENTATION 1
//#define U_DISABLE_RENAMING 1
#include <string>
#include <algorithm>
#include <sstream>

View File

@ -6,7 +6,7 @@ void StringUtils::unicode_normalize(std::string& str) const {
return !std::isalnum(c) && (int)(c) >= 0;
}), str.end());
UnicodeString u_str = UnicodeString::fromUTF8(str);
icu::UnicodeString u_str = icu::UnicodeString::fromUTF8(str);
transliterator->transliterate(u_str);
str.clear();
u_str.toLower().toUTF8String(str);