Setting up SDL3 for Windows using CMake and MinGW-w64

I have made a step by step tutorial to set up SDL3 for Windows using CMake and MinGW-w64: Setting up SDL3 for Windows using CMake and MinGW-w64

Table of contents:

If you have any problems following the instructions, please write in this topic about it.

Discord topic

1 Like

as someone who knows nothing about cmake, do you have the time to explain the flags you used here

cmake -G "MinGW Makefiles" --fresh -S . -B dist -DCMAKE_INSTALL_PREFIX=E:\libs\sdl3-desktop-prefix

With these 2 commands you can get some information:

cmake --help
cmake-gui .

cmake -G “MinGW Makefiles” --fresh -S . -B dist -DCMAKE_INSTALL_PREFIX=E:\libs\sdl3-desktop-prefix

cmake --help

  • “-G <generator-name>” - Specify a build system generator
  • “MinGW Makefiles” - Generates a make file for use with mingw32-make
  • “–fresh” - Configure a fresh build tree, removing any existing cache file
  • “-S <path-to-source>” - Explicitly specify a source directory
  • “-B <path-to-build>” - Explicitly specify a build directory

Type in the console cmake-gui. Search for pre and hover the mouse pointer over CMAKE_INSTALL_PREFIX and you will see the description:

image

  • “-DCMAKE_INSTALL_PREFIX=<path-to-dir>” - Install path prefix, prepended onto install directories.

I’ve updated the guides to SDL 3.1.3: Setting up SDL3 for Windows using CMake and MinGW-w64

Hi to all, sorry for my bad english language …
Hi 8Observer8 … Good Work for your tutorial… thx!!!
A small update …
Now is available for msys2 the package mingw-w64-ucrt-x86_64-sdl3 …so we can install it from shell ucrt64 with command pacman -S mingw-w64-ucrt-x86_64-sdl3

Now we don’t need download , unzip of sdl3 and we don’t need to change the environment variable path…

when this package is installed in msys2 we can continue to use your good tutorial :slight_smile:
… Now your cmake configuration line in msys2 in shell ucrt64 changes to -DSDL3_DIR=/ucrt64/lib/cmake/SDL3

Now we can continue to follow your wonderful tutorial :slight_smile: thank you again!!!

Thank you again for your wonderful tut !!! :slight_smile:

2 Likes