From 60c17dda29e77a26af303f60e6167e976a4fb8ea Mon Sep 17 00:00:00 2001 From: Jerin Philip Date: Wed, 3 May 2023 18:33:28 +0530 Subject: [PATCH] Android NDK compile patch (#2) --- src/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16e41f65..7bd1fb84 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,6 +159,16 @@ find_package(Threads REQUIRED) set(SPM_LIBS ${PROTOBUF_LITE_LIBRARY} Threads::Threads) +if(ANDROID) + # SentencePiece throws compilation errors when attempted to compile for ARM + # via android ndk, about missing libraries of android and log. Solution + # adapted from OpenCV. + # - https://github.com/opencv/opencv/issues/17282 + # - https://github.com/opencv/opencv/pull/19049 + set(SPM_LIBS ${SPM_LIBS} android log) +endif(ANDROID) + + if (SPM_ENABLE_NFKC_COMPILE) find_package(ICU 4.4 COMPONENTS i18n data uc REQUIRED) include_directories(${ICU_INCLUDE_DIRS})