In order to use the libtorch c++ frontend, I have installed the pre-built distribution as explained here:
It works flawlessly, but now I need to be able to build it from source using CMake in order to provide it as a dependency for another project.
Is there a documentation explaining how to do that? All docs that I have found for building from source use the setup.py approach and I am not sure that this produces an installable lib which can be consumed from CMake projects.
tools/build_libtorch.py. I could not get it to do what I want, but maybe you’ll figure it out (if you do please update with your solution! ).
Thanks for the hint. Actually, looking at the provided scripts, I have found a procedure which works for me:
- git clone
- cd pytorch
- mkdir build
- cd build
- ccmake …/ (and the choose what applies: BUILD_TORCH BUILD_BINARY, BUILD_CAFFE2_OPS and the chosen install dir)
- make -j install
I have only tested that I can use find_package and build simple examples using the c++ API
Can you please clarify what you did? why ccmake and not cmake? why …/ and not … ?
if interested in the c++ libtorch (includes, libs and share stuff) what flags apply?