my goal is to build a minimalist cpu build of libtorch.
I now see what you mean that I can use python to build libtorch:

  
      github.com
  
  
    pytorch/pytorch/blob/master/docs/libtorch.rst 4
libtorch (C++-only)
===================

The core of pytorch does not depend on Python. A
CMake-based build system compiles the C++ source code into a shared
object, libtorch.so.

Building libtorch using Python
------------------------------

You can use a python script/module located in tools package to build libtorch
::
   cd <pytorch_root>

   # Make a new folder to build in to avoid polluting the source directories
   mkdir build_libtorch && cd build_libtorch

   # You might need to export some required environment variables here.
   Normally setup.py sets good default env variables, but you'll have to do
   that manually.


  This file has been truncated. show original

  
  
    
    
  
  


but I think the problem is I am not sure if I can link to through through other C++ programs.
Anyways, I will try it now.