add modified docs with more detailed explanation on how to create the… (#2805)

add modified docs with more detailed explanation on how to create the bindings for windows
This commit is contained in:
David Luis Alonso 2018-03-06 08:53:39 +01:00 committed by Arvid Norberg
parent 5478f57e43
commit 94498072e1
1 changed files with 28 additions and 18 deletions

View File

@ -14,39 +14,49 @@ building
Building the libtorrent python bindings will produce a shared library (DLL)
which is a python module that can be imported in a python program.
building using setup.py
-----------------------
building using boost build (windows)
------------------------------------
There is a ``setup.py`` shipped with libtorrent that can be used on windows.
On windows the setup.py will invoke ``bjam`` and assume that you have boost
sources at ``$BOOST_PATH``. The resulting executable is self-contained, it does
not depend any boost or libtorrent dlls.
Download and install `Visual C++ 2015 Build Tools`__
On other systems, the setup.py is generated by running
``./configure --enable-python-binding``.
.. __: http://landinghub.visualstudio.com/visual-cpp-build-tools
To build the Python bindings do:
Download `Boost libraries`__ Extract it to c:/Libraries/boost_1_63_0 and create these environmental vars:
1. Run::
.. __: http://www.boost.org/users/history/
python setup.py build
1. BOOST_BUILD_PATH: "c:/Libraries/boost_1_63_0/tools/build/"
2. BOOST_ROOT: "c:/Libraries/boost_1_63_0/"
2. As root, run::
Navigate to BOOST_ROOT, execute "bootstrap.bat" and add to the path "c:/Libraries/boost_1_63_0/tools/build/src/engine/bin.ntx86/"
Move the file ``user-config.jam`` from ``%BOOST_BUILD_PATH%/example/`` to ``%BOOST_BUILD_PATH%/user-config.jam`` and add this at the end:
python setup.py install
::
using msvc : 14.0 : : /std:c++11 ;
using python : 3.5 : C:/Users/<UserName>/AppData/Local/Programs/Python/Python35 : C:/Users/<UserName>/AppData/Local/Programs/Python/Python35/include : C:/Users/<UserName>/AppData/Local/Programs/Python/Python35/libs ;
building using boost build
--------------------------
(change the python path for yours)
Navigate to binding/torrents and execute::
python setup.py build --bjam
Note: If you are using 64bits python you should edit setup.py and add this to the b2 command:
``address-model=64``
This will create the file libtorrent.pyd inside build/lib/ that contains the binding.
building using boost build (others)
-----------------------------------
To set up your build environment, you need to add some settings to your
``$BOOST_BUILD_PATH/user-config.jam``.
Make sure your user config contains the following line::
A similar line to this line should be in the file (could be another python version)::
using python : 2.3 ;
#using python : 2.3 ;
Set the version to the version of python you have installed or want to use. If
Uncomment it and change it with the version of python you have installed or want to use. If
you've installed python in a non-standard location, you have to add the prefix
path used when you installed python as a second option. Like this::