Update protobuf detection

Summary:
The scripts/build_local.sh script would always build protoc from the
third_party protobuf tree and override the PROTOBUF_PROTOC_EXECUTABLE
CMake variable. This variable is used by the protobuf CMake files, so
it doesn't let us detect whether the protoc was specified by the user
or by the protobuf CMake files (e.g. an existing installation). This
in turn led to a problem where system installed headers would be
picked up while using protoc built from third_party. This only works
if the system installed version matches the version included in the
Caffe2 tree. Therefore, this commit changes the variable to specify a
custom protoc executable to CAFFE2_CUSTOM_PROTOC_EXECUTABLE, and
forces the use of the bundled libprotobuf when it is specified.

The result is that we now EITHER specify a custom protoc (as required
for cross-compilation where protoc must be compiled for the host and
libprotobuf for the target architecture) and use libprotobuf from the
Caffe2 tree, OR use system protobuf.

If system protobuf cannot be found, we fall back to building protoc
and libprotobuf in tree and packaging it as part of the Caffe2 build
artifacts.
Closes https://github.com/caffe2/caffe2/pull/1328

Differential Revision: D6032836

Pulled By: pietern

fbshipit-source-id: b75f8dd88412f02c947dc81ca43f7b2788da51e5
6 files changed
tree: 254328308396edccc7941fc42d1aae07e84f648c
  1. .travis/
  2. caffe/
  3. caffe2/
  4. cmake/
  5. conda/
  6. docker/
  7. docs/
  8. scripts/
  9. third_party/
  10. .Doxyfile
  11. .Doxyfile-c
  12. .Doxyfile-python
  13. .gitignore
  14. .gitmodules
  15. .travis.yml
  16. appveyor.yml
  17. CMakeLists.txt
  18. LICENSE
  19. Makefile
  20. NOTICE
  21. README.md
  22. release-notes.md
README.md

Caffe2

License TravisCI Build Status Appveyor Build Status

Caffe2 is a lightweight, modular, and scalable deep learning framework. Building on the original Caffe, Caffe2 is designed with expression, speed, and modularity in mind.

News and Events

Caffe2 research award competition request for proposals

Questions and Feedback

Please use Github issues (https://github.com/caffe2/caffe2/issues) to ask questions, report bugs, and request new features.

Please participate in our survey (https://www.surveymonkey.com/r/caffe2). We will send you information about new releases and special developer events/webinars.

License

Caffe2 is released under the Apache 2.0 license. See the NOTICE file for details.

Further Resources on Caffe2.ai