# Building from source ## Have Pip build from source Useful if the binaries don't work on your system. Make sure Raylib is installed and then: pip3 install --no-binary raylib --upgrade --force-reinstall raylib ## Build from source manually Useful if the Pip build doesn't work, or you want to contribute to the project, or you want to skip building the static lib and just *use the dynamic binding with your own dll*. If you do build on a new platform please submit your binaries as a PR. ### Windows manual build Clone this repo including submodules so you get correct version of Raylib. git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi Open Visual C++ command shell. Fix the symlink that doesnt work on Windows cd raylib-python-cffi copy raylib-c\src\raylib.h raylib\raylib.h Build and install Raylib from the raylib-c directory. cd raylib-python-cffi/raylib-c mkdir build cd build cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release .. msbuild raylib.sln /target:raylib /property:Configuration=Release copy raylib\Release\raylib.lib ..\.. cd ..\.. To update the dynamic libs, download the official release, e.g. https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip and extract `raylib.dll` into `raylib/dynamic`. Delete the files for other platforms, unless you want them in your distribution. To build a binary wheel distribution: rmdir /Q /S build pip3 install cffi pip3 install wheel python setup.py bdist_wheel Alternatively, if you don't want the static binaries and just want to use DLLs with raylib.dynamic: python3 setup_dynamic.py bdist_wheel Then install it: pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl (Note: your wheel's filename will probably be different than the one here.) ### Linux etc manual build These instructions have been tested on Ubuntu 20.10 and 16.04. Mac should be very similar. Clone this repo including submodules so you get correct version of Raylib. git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi Build and install Raylib from the raylib-c directory. sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev cd raylib-python-cffi/raylib-c mkdir build cd build cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release .. sudo make install Optional: Build the Raylib shared libs, if you plan to use `raylib.dynamic` binding. rm -rf * cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release .. sudo make install Optional: Make a patched version of raylib header. (**Not necessary** if you've already got raylib_modifed.h from repo and haven't changed anything.) cd ../../raylib cp raylib.h raylib_modified.h patch -p0