Skip to content

Commit

Permalink
[infra] Adjust the Caffe 1.0 code to the new Protobuf API (#14639)
Browse files Browse the repository at this point in the history
This commit patches the sources of Caffe 1.0 upon the download in order to
resolve a compilation error coming from the changes of Protobuf's API.

ONE-DCO-1.0-Signed-off-by: Tomasz Dolbniak <[email protected]>
  • Loading branch information
tomdol authored Feb 13, 2025
1 parent d69a435 commit 2ac8fce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions infra/cmake/packages/CaffeSource.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp
index 5295d9dd..f71553c9 100644
--- a/src/caffe/util/io.cpp
+++ b/src/caffe/util/io.cpp
@@ -54,7 +54,7 @@ bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
CHECK_NE(fd, -1) << "File not found: " << filename;
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
CodedInputStream* coded_input = new CodedInputStream(raw_input);
- coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
+ coded_input->SetTotalBytesLimit(kProtoReadBytesLimit);

bool success = proto->ParseFromCodedStream(coded_input);

2 changes: 1 addition & 1 deletion infra/cmake/packages/CaffeSourceConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function(_CaffeSource_import)
envoption(EXTERNAL_DOWNLOAD_SERVER "https://github.com")
envoption(CAFFE_URL ${EXTERNAL_DOWNLOAD_SERVER}/BVLC/caffe/archive/1.0.tar.gz)

ExternalSource_Download(CAFFE ${CAFFE_URL})
ExternalSource_Download(CAFFE ${CAFFE_URL} PATCH ${CMAKE_CURRENT_LIST_DIR}/CaffeSource.patch)

set(CaffeSource_DIR ${CAFFE_SOURCE_DIR} PARENT_SCOPE)
set(CaffeSource_FOUND ${DOWNLOAD_CAFFE} PARENT_SCOPE)
Expand Down

0 comments on commit 2ac8fce

Please sign in to comment.