Python build script for Blender as a python module
It needs to be its own repository to satisfy the install_requires
of blenderpy
While it is possible to install this module standalone, you will probably get better results installing blenderpy
via pip install bpy
rather than installing pip install bpy-build
, as pip install bpy
will attempt to take care of making sure the bpy
installation is good.
- A supported python installation with pip installed
py -m pip install bpy-build
- Windows users must have Visual Studio 2013 or later and C++ build tools installed to build from sources
- ALL users must have an SVN command-line provider to build from sources (see https://stackoverflow.com/questions/1625406/using-tortoisesvn-via-the-command-line) (this is a requirement as it is how we determine the correct release tag to grab, if any)
- All users must
py -m pip install cmake
in their python environment to build from sources (currently adding it as asetup_requires
does not install it properly); after build it may be uninstalled withpy -m pip uninstall cmake
- Users of Python versions below 3.6 must have
future-fstrings
installedpip install -U future-fstrings
- Users of Python versions 3.4 and below will probably need to update
setuptools
pip install -U setuptools
- Up-to-date
wheel
py -m pip install bpy-build --no-binary
- Create overriding classes CMakeExtension & BuildCMake, which inheirit from the setuptools classes; bpy is a python extension (.pyd) and an instance of CMakeExtension, BuildCMake is the command that is run when installing the extension from pip (or running setup.py)
- Using GitPython, clone Blender sources from https://git.blender.org/
- If on Windows, detect the installed version of Visual Studio and 64bit vs 32bit, and download the appropriate svn library based on that
- Using cmake, configure blender as a python module https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule; configure this build solution in the build_temp directory of the bpy package
- Using cmake, build the configured solution
- Place the built binaries in the built extension parent directory (important!)
- Relocate the / directory (i.e: /2.79) into the directory containing the executable from which this installation was spawned (where 'python.exe' is)
- Clean up using the remaining functionality from the superclasses
build_ext
andExtension
- bpy.pyd/ .so should now be installed into the site-packages