How to compile C++ dependencies during pip install

2019-03-16 04:28发布

问题:

I want to make my python code pip-able. However, my code depends on another library which isn't pip-able. So, somehow I need to compile the source code when a user calls pip install.

How can I do that? I haven't been able to find a good reference via simple Google searches.

回答1:

I would recommend taking a look at how llvmlite solves this problem. The idea is to use custom cmdclasss in setup.py that calls your other build system. In llvmlite, they call out to CMake, for example.

See: https://github.com/numba/llvmlite/blob/master/setup.py