Tests are made from Ubuntu 20.04.
sudo apt install build-essential
sudo apt install libsdl2-dev
sudo apt install cmake
- or
snap install cmake --classic
to get a recent version
- or
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release
.. (or Debug)make
./sdl_sample
The Ubuntu version is build against system-wide installed libraries. It's ok as long as the objective is to build and run locally.
sudo apt install mingw-w64
sudo apt install cmake
- or
snap install cmake --classic
to get a recent version
- or
- Then choose Method 1 or Method 2 below.
mkdir build_win
cd build-win
cmake -DCMAKE_TOOLCHAIN_FILE=ubuntu-mingw64.cmake -DCMAKE_BUILD_TYPE=Release
.. (or Debug)make
- Some DLL needs to be accessible. By putting them in the same folder as the
.exe file for example.
libgcc_s_sjlj-1.dll
libwinpthread-1.dll
SDL2d.dll
in Debug andSDL2.dll
in Release.
wine sdl_sample.exe
The cross-compilation needs a SDL version compiled for the target system.
Use the provided pre-compiled release on the SDL2 site
(for example SDL2-devel-2.0.16-mingw.tar.gz
).
The main problem with this prebuilt release is that it's made to be installed system-wide, but without being packaged.
Extract SDL sources in the extern folder and use add_subdirectory
.
- The end of two paths contains a hardcoded version. Can it be made better?