Skip to content

Commit c990f9c

Browse files
Fixed manylinux build (#255)
1 parent 145f3cf commit c990f9c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/CMakeLists.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if(ANDROID)
6969
set(FAST_TOKENIZER_FROM_SOURCES ON)
7070
else()
7171
set(FAST_TOKENIZERS_SUPPORTED ON)
72-
if(USE_ABI0 OR WIN32 AND CMAKE_BUILD_TYPE MATCHES "Debug")
72+
if(USE_ABI0 OR (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug"))
7373
set(FAST_TOKENIZER_FROM_SOURCES ON)
7474
else()
7575
set(FAST_TOKENIZER_FROM_SOURCES OFF)
@@ -142,7 +142,11 @@ endif()
142142

143143
include(FetchContent)
144144

145-
find_package(sentencepiece QUIET)
145+
if(NOT USE_ABI0)
146+
# for ABI=0 case, we have to build from sources
147+
find_package(sentencepiece QUIET)
148+
endif()
149+
146150
if(sentencepiece_FOUND)
147151
find_package(absl REQUIRED)
148152
else()
@@ -198,7 +202,9 @@ function(ov_tokenizers_link_sentencepiece TARGET_NAME)
198202
if(CMAKE_CL_64)
199203
target_compile_definitions(sentencepiece-static PRIVATE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
200204
endif()
205+
# to propogate _GLIBCXX_USE_CXX11_ABI value
201206
target_compile_definitions(sentencepiece-static PUBLIC $<TARGET_PROPERTY:openvino::runtime,INTERFACE_COMPILE_DEFINITIONS>)
207+
202208
target_link_libraries(${TARGET_NAME} PRIVATE sentencepiece-static)
203209
if(ANDROID)
204210
# see https://github.com/protocolbuffers/protobuf/issues/2719#issuecomment-625400968
@@ -221,6 +227,9 @@ function(ov_tokenizers_build_static_re2)
221227
FetchContent_Populate(re2)
222228
add_subdirectory(${re2_SOURCE_DIR} ${re2_BINARY_DIR} EXCLUDE_FROM_ALL)
223229
endif()
230+
231+
# to propogate _GLIBCXX_USE_CXX11_ABI value
232+
target_compile_definitions(sentencepiece-static PUBLIC $<TARGET_PROPERTY:openvino::runtime,INTERFACE_COMPILE_DEFINITIONS>)
224233
endfunction()
225234

226235
if(BUILD_FAST_TOKENIZERS)

0 commit comments

Comments
 (0)