Building Boost.Python with a custom Python3

I’ve started working on porting some Python libraries to Python3, but I required using an old Visual Studio (2012) for which there is no Python3 version. In the end, I tried following this tutorial. The issue with the tutorial is that you are downloading the externals by hand. It is actually simpler to call get_externals.bat from the PCBuild folder.

Be aware that the solution is a little bit flawed. pylauncher is built in win32 mode in Release instead of x64. This has an impact on deployment.

Once this is done, I had to deploy the build to a proper location so that it is self contained. I inspired myself heavily from another tutorial by the same author, only adding 64 bits support in this gist.

Once this was done, time to build Boost.Python! To start, just compile bjam the usual way, don’t add Python options on the command line, this will utterly fail in Boost.Build. Then add in user-config.jam the following lines (with the proper folders):

using python : 3.4 : D:/Tools/Python-3.4.5/_INSTALL/python.exe : D:/Tools/Python-3.4.5/_INSTALL/include : D:/Tools/Python-3.4.5/_INSTALL/libs ;

This should build the debug and release mode with this line:

.\b2 --with-python --layout=versioned toolset=msvc-11.0 link=shared stage address-model=64
.\b2 --with-python --layout=versioned toolset=msvc-11.0 link=shared stage address-model=64 python-debugging=on
Buy Me a Coffee!
Other Amount:
Your Email Address: