Skip to content

Clone and build RayLib

Richard Goodwin edited this page Dec 9, 2021 · 16 revisions

RayLib is a graphics library developed by RaySan5 initially to support his work teaching videogame development.

However, due to its speed and simplicity, it is ideally suited to an application such as this, so the Europi GUI makes extensive use of the 2D Graphics, Touchscreen, Gesture & Text capabilities of RayLib.

Running the following instructions from a Raspberry Pi console will download and build the RayLib libraries.

Raylib needs the X11 drivers, so xorg-dev will include everything.

sudo apt-get install xorg-dev

Then, clone the Master branch:

sudo git clone https://github.com/raysan5/raylib.git

Finally, build the raylib library itself. Note the PLATFORM= switch will vary depending on the particular Raspberry Pi version you are running.

cd raylib/src

For Raspberry Pi Zero,1,2 & 3

sudo make PLATFORM=PLATFORM_RPI

For RPi 4 in NATIVE Mode (ie with no desktop running):

sudo make PLATFORM=PLATFORM_DRM

For RPi 4 running within the default desktop

sudo make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21

It will print out a lot of warnings (mainly about unused variables) but, if it builds correctly towards the end of the listing it should say:

raylib static library generated (libraylib.a) in [some directory name]!

Next: