Building SDL 3

The Simple DirectMedia Layer (SDL) recently released its new major version 3 (as version 3.2.0) and that was a good oppurtunity to check it out and play a bit with it. But before I could do that, I had to build the library first.

More info on this can be found in the SDL CMake ReadMe, but the following steps should be enough to get started:

  1. Download the source code for the latest stable release.

  2. Extract the downloaded archive file (in this example to C:\temp\SDL-release-3.4.2).

  3. Configure its CMake buildsystem:

    Please note (via SDL CMake ReadMe: Shared or static):

    By default, only a dynamic (shared) SDL library is built and installed.
    The options -DSDL_SHARED= and -DSDL_STATIC= accept boolean values to change this.

    One can build and install both the shared and static version at the same time/in the same destination folder:

     C:\temp\SDL-release-3.4.2> cmake -S . -B .\_build -DSDL_SHARED=ON -DSDL_STATIC=ON
    
  4. Build the library:

     C:\temp\SDL-release-3.4.2> cmake --build .\_build --config RelWithDebInfo
    
  5. Install the built artifacts, for example to a custom destination (the prefix path):

     C:\temp\SDL-release-3.4.2> cmake --install .\_build --config RelWithDebInfo --prefix C:\<install>\<to>\...
    

Done!