pytorch/tools/cpp_build/build_caffe2.sh
Orion Reblitz-Richardson edd4e2c5d1
Expose proto utils and ONNX (#8073)
* Expose proto utils and ONNX from PyTorch libcaffe2.so

* Try to use protobuf from _C.so

* Fix ONNX proto header include

* Adjust order of imports for ONNX until nanopb goes away

* Set and use ONNX_NAMESPACE for PyTorch builds

* Show protobuf summary for all builds

* Add ONNX_NAMESPACE for cpp_build

* Statically link libprotobuf.a into libtorch.so

* Set ONNX_NAMESPACE on Windows build

* Move core/dispatch up as well

* Add /MD flag for Windows build of _C

* Potential Windows fix for ONNX and protobuf

* Add direct linkage from _C to ONNX on Windows

* Only include protobuf wrapper for PyTorch

* Pass extra_compile_args to _nvrtc ext build

* Remove installation of .a files
2018-06-13 10:25:32 -07:00

30 lines
622 B
Bash
Executable file

#!/usr/bin/env bash
set -ex
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
pushd $SCRIPTPATH
source ./build_common.sh
echo "Building Caffe2"
mkdir -p $CAFFE2_BUILDPATH
pushd $CAFFE2_BUILDPATH
cmake -DUSE_CUDA=$USE_CUDA \
-DBUILD_CAFFE2=OFF \
-DBUILD_ATEN=ON \
-DBUILD_PYTHON=OFF \
-DBUILD_BINARY=OFF \
-DBUILD_SHARED_LIBS=ON \
-DONNX_NAMESPACE=$ONNX_NAMESPACE \
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:STRING=$INSTALL_PREFIX \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-G "$GENERATE" \
$PYTORCHPATH/
$MAKE -j "$JOBS" install
popd
popd