This commit is contained in:
Tyler Perkins 2022-12-26 19:22:00 -05:00
parent 477377b7df
commit 71aafdb23f

View File

@ -0,0 +1,34 @@
<div>
<div>
<p>If you want to do graphical applications with SDL2 on a rapsberry pi
without the overhead of X11, you will need to compile SDL2 yourself. I'll
assume you are running raspian.</p>
<p>Install required libraries to build</p>
<blockquote class="code-block">sudo apt-get install libdrm-dev libgdm-dev</blockquote>
<p>Next download a SDL2 source tarball. They can be found <a
href="https://www.libsdl.org/download-2.0.php">here</a>.
Next, change to the directory of the unzipped tarball and run the following.</p>
<blockquote class="code-block">./configure --enable-video=kmsdrm
make -j4
sudo make install
</blockquote>
<p>To check if the library was compiled sucessfully, compile <a
href="https://pastebin.com/raw/5gQXZ2mZ">this</a>
piece of code. You should see the screen flashing, as well as your desired
graphics driver on stdout. To compile,</p>
<blockquote class="code-block">g++ ./test_prog.cpp `pkg-config --cflags --libs sdl2`
</blockquote>
<p>You can change the driver used via raspi-config if opengl es is not
desired.</p>
<p>I hope this helped someone, happy embedded programming!</p>
</div>
</div>