File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -188,14 +188,26 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
188
188
SET (OPTIONAL_CACHE_ARGS "-DZLIB_ROOT:STRING=${ZLIB_ROOT} " )
189
189
ENDIF ()
190
190
191
+ SET (PROTOBUF_REPO "https://github.com/google/protobuf.git" )
192
+ SET (PROTOBUF_TAG "9f75c5aa851cd877fb0d93ccc31b8567a6706546" )
193
+ IF (MOBILE_INFERENCE )
194
+ # The reason why the official version is not used is described in
195
+ # https://github.com/PaddlePaddle/Paddle/issues/6114
196
+ SET (PROTOBUF_REPO "https://github.com/qingqing01/protobuf.git" )
197
+ SET (PROTOBUF_TAG "v3.2.0" )
198
+ IF (NOT BUILD_FOR_HOST )
199
+ SET (OPTIONAL_ARGS ${OPTIONAL_ARGS} "-Dprotobuf_BUILD_PROTOC_BINARIES=OFF" )
200
+ ENDIF ()
201
+ ENDIF ()
202
+
191
203
ExternalProject_Add (
192
204
${TARGET_NAME}
193
205
${EXTERNAL_PROJECT_LOG_ARGS}
194
206
PREFIX ${PROTOBUF_SOURCES_DIR}
195
207
UPDATE_COMMAND ""
196
208
DEPENDS zlib
197
- GIT_REPOSITORY "https://github.com/google/protobuf.git"
198
- GIT_TAG "9f75c5aa851cd877fb0d93ccc31b8567a6706546"
209
+ GIT_REPOSITORY ${PROTOBUF_REPO}
210
+ GIT_TAG ${PROTOBUF_TAG}
199
211
CONFIGURE_COMMAND
200
212
${CMAKE_COMMAND} ${PROTOBUF_SOURCES_DIR} /src/${TARGET_NAME}/cmake
201
213
${OPTIONAL_ARGS}
@@ -213,7 +225,11 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
213
225
)
214
226
ENDFUNCTION ()
215
227
216
- SET (PROTOBUF_VERSION 3.1 )
228
+ IF (NOT MOBILE_INFERENCE )
229
+ SET (PROTOBUF_VERSION 3.1 )
230
+ ELSE ()
231
+ SET (PROTOBUF_VERSION 3.2 )
232
+ ENDIF ()
217
233
IF (CMAKE_CROSSCOMPILING )
218
234
build_protobuf (protobuf_host TRUE )
219
235
LIST (APPEND external_project_dependencies protobuf_host )
You can’t perform that action at this time.
0 commit comments