mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
currently torch/CMakeLists doesn't know how to find nanopb without some higher-level script (setup.py or build_all.sh) telling it where to look, which is an obstacle towards fully CMake-ifying libtorch.so. This change removes that dependency.
33 lines
823 B
Bash
Executable file
33 lines
823 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
|
|
pushd $SCRIPTPATH
|
|
source ./build_common.sh
|
|
|
|
echo "Building Torch"
|
|
|
|
mkdir -p $LIBTORCH_BUILDPATH
|
|
pushd $LIBTORCH_BUILDPATH
|
|
|
|
cmake -DUSE_CUDA:BOOL=$USE_CUDA \
|
|
-DNO_API:BOOL=${NO_API:0} \
|
|
-DCAFFE2_PATH=$PYTORCHPATH/ \
|
|
-DCAFFE2_BUILD_PATH=$CAFFE2_BUILDPATH \
|
|
-DONNX_NAMESPACE=$ONNX_NAMESPACE \
|
|
-DNANOPB_BUILD_PATH=$NANOPB_BUILDPATH \
|
|
-DINSTALL_PREFIX=$INSTALL_PREFIX \
|
|
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
|
|
-DCMAKE_INSTALL_PREFIX:STRING=$INSTALL_PREFIX \
|
|
-DCMAKE_INSTALL_MESSAGE=NEVER \
|
|
-Dnanopb_BUILD_GENERATOR:BOOL=OFF \
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
|
|
-DVERBOSE:BOOL=${VERBOSE:-0} \
|
|
-G "$GENERATE" \
|
|
$PYTORCHPATH/torch
|
|
$MAKE -j "$JOBS"
|
|
|
|
popd
|
|
popd
|