From 424d8f1076a10e77303954f7567113d2d31cfd33 Mon Sep 17 00:00:00 2001 From: Coo Chew Games <61851819+coochewgames@users.noreply.github.com> Date: Mon, 2 Sep 2024 19:58:03 +1000 Subject: [PATCH] Update to the explanations of building raylib for different OS versions of Raspbian; including example compilation scripts. Some minor typo corrections. --- Working-on-Raspberry-Pi.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/Working-on-Raspberry-Pi.md b/Working-on-Raspberry-Pi.md index 9c9d402..8d3436b 100644 --- a/Working-on-Raspberry-Pi.md +++ b/Working-on-Raspberry-Pi.md @@ -60,24 +60,52 @@ sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev lib **2. To compile in native mode (no X11)** -On Rapsberry Pi 0-4 using RPI OS Bullseye or newer: +On Raspberry Pi models 0 to 4 using the Raspbian OS: + +##### Buster: ``` -make PLATFORM=PLATFORM_DRM +make PLATFORM=PLATFORM_RPI ``` -NOTE: To compile raylib in native mode on Raspberry Pi 4, you need the specific DRM libraries: +##### Bullseye or newer: +To compile raylib in native mode on Bullseye or newer, you will need the install the DRM libraries: ``` sudo apt-get install libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev ``` -raylib also works on [DietPi](https://dietpi.com/) distribution, following libraries are required: + +To build raylib: +``` +make PLATFORM=PLATFORM_DRM +``` + +##### DietPi +raylib also works on the [DietPi](https://dietpi.com/) distribution, though the following libraries are required prior to building raylib: ``` sudo apt-get install libraspberrypi-dev raspberrypi-kernel-headers sudo apt-get install build-essential ``` +#### Example compilation scripts for building a raylib application +The following are example compilation commands that can be used to build a raylib application assuming the raylib repository has been cloned to a parent directory to the application code. +``` +./raylib/src +./app +``` + +The example assumes the application is built from `x.c` in the `app` directory. The emphasis is which libraries to utilise when building on the earlier and later versions of Raspbian OS. The examples provided are derived from code written on a Pi 0. + +##### Buster +``` +cc -o x x.c -I../raylib/src -I/opt/vc/include -L../raylib/src -L/opt/vc/lib -lraylib -lm -lpthread -lbrcmGLESv2 -lbrcmEGL -lvcos -lvchiq_arm -lbcm_host +``` +##### Bullseye +``` +cc -o x x.c -I../raylib/src -I/opt/vc/include -L../raylib/src -L/opt/vc/lib -lraylib -lm -lpthread -lGLESv2 -lEGL -lvcos -lvchiq_arm -lgbm -ldrm +``` + **3. To compile on OPENBOX** -**WARNIGN:** The program compiled as `PLATFORM_DRM` under _openbox_ fails (More testing is required). +**WARNING:** The program compiled as `PLATFORM_DRM` under _openbox_ fails (More testing is required). _It is untested._