Building Torchvision C++ API from source

I have been trying to build torchvision from source (master) on Windows 10. I cannot get past the cmake step. I see there is a dependency on the Torch package and cmake specifically asks for TorchConfig.cmake or torch-config.cmake. I have gotten this to work in the past by explicitly passing in --DCMAKE_PREFIX_PATH=“C:\Path\To\Torch” but most recently this has not worked for me. Can the prebuilt windows binary for Torch satisfy this cmake requirement? Can the Python package for Torch satisfy it? What is the actual path I need to supply to make this work? Is it looking for the torch.dll or torch.lib or something?

If you want to invoke the cmake script here, I think LibTorch is sufficient. Here is what I have done to make it work:

  1. Download https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.4.0.zip and extract to D:\libtorch
  2. Clone pybind11 and install to D:\pybind11
git clone https://github.com/pybind/pybind11.git
cd pybind11
mkdir build
cd build
cmake -DPYBIND11_TEST=OFF -DCMAKE_INSTALL_PREFIX="D:\pybind11" ..
  1. Clone torchvision and build
git clone https://github.com/pytorch/vision.git
cd vision
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH="D:\libtorch;D:\pybind11" ..

Thanks Pu Jiachen. I had to modify that a little for my particular case to work. What ended up working for me was

cmake -DCMAKE_PREFIX_PATH=“D:/path/to/libtorch” -Dpybind11_DIR=“D:/path/to/pybind11/share/cmake/pybind11” … -G “Visual Studio 15 2017 Win64”