@@ -21,17 +21,34 @@ add_library(sentencepiece-interface SHARED SentencePieceProcessorInterface.cpp)
2121add_library (cache_container_native SHARED CacheContainerNative.cpp )
2222add_library (dictionary_translator_interface SHARED DictionaryTranslator.cpp protobuf/dictionary_data.pb.cc protobuf/dictionary_data.pb.h )
2323
24- find_library (sqlite4java sqlite4java )
24+ find_package (sqlite4java-android REQUIRED CONFIG )
25+
26+ # protobuf lite import
27+ # FIND THREADS (This populates CMAKE_THREAD_LIBS_INIT) and force protobuf to use it
28+ find_package (Threads REQUIRED )
29+ add_definitions (-DHAVE_PTHREAD )
30+ # Define paths
31+ set (protobuf_source_dir "${CMAKE_CURRENT_SOURCE_DIR } /libs/protobuf-lite" )
32+ set (protobuf_cmake_dir "${protobuf_source_dir } /cmake" )
33+ # Protobuf Lite configuration variables
34+ # These are required by the 'libprotobuf-lite.cmake' file
35+ set (protobuf_VERSION "3.14.0" )
36+ set (LIB_PREFIX "" )
37+ set (protobuf_DEBUG_POSTFIX "" )
38+ set (protobuf_SHARED_OR_STATIC STATIC) # Usually best to build as static for Android JNI
39+ # Include ONLY the lite library definition
40+ # This file defines the 'libprotobuf-lite' target and its source list
41+ include ("${protobuf_cmake_dir} /libprotobuf-lite.cmake" )
2542
2643
2744target_include_directories (dictionary_translator_interface PRIVATE
28- ${CMAKE_CURRENT_SOURCE_DIR } /libs/sentencepiece/third_party/protobuf-lite
45+ # ${CMAKE_CURRENT_SOURCE_DIR}/libs/sentencepiece/third_party/protobuf-lite
2946 ${CMAKE_CURRENT_SOURCE_DIR } /sqlite4java/include
3047)
3148
3249target_link_libraries (dictionary_translator_interface
33- sentencepiece-static-android
34- sqlite4java
50+ libprotobuf-lite
51+ sqlite4java-android::sqlite4java
3552 android
3653 log
3754)
0 commit comments