CMake is a cross-platform and open source software used to convert applications developed in C or C++ into projects for any compiler.
We will use CMake to compile the library code built for SDL into a project that can be compiled with the CodeBlocks 20.03 32-bit IDE.
1. Download cmake-3.31.1-rc3-windows-x86_64.zip file from here and open it on our computer.
2. When we unzip the cmake file, a directory structure will be created as follows:
3. Let's edit the Windows PATH variable to include only the bin directory of the MingW compiler for compiling.
C:\Program Files (x86)\CodeBlocks\MinGW\bin
This edit will ensure that we use the same compiler as the CodeBlocks 20.03 32-bit compiler in the files that will be created by CMake.
There are libraries that extend the basic functions of SDL.
You can access the web page includes SDL Libraries from here.
Although many of these libraries start with "SDL_", none of them are part of the core SDL library.
Loads images onto SDL surfaces and textures. The supported image formats are as follows:
BMP, GIF, JPEG, LBM, PCX, PNG, PNM, SVG, TGA, TIFF, WEBP, XCF, XPM, XV
Links related to SDL_image library
Project page: https://github.com/libsdl-org/SDL_image
SDL Wiki: https://wiki.libsdl.org/SDL3_image/FrontPage
Latest version: https://github.com/libsdl-org/SDL_image/releases
Creating the SDL3_image.dll file
When we prepare this page, since the latest released version of the SDL_image library is 2.8.2 for SDL2 and there is no release for SDL3, we need to build the SDL3 version of this library from the source code.
1. Let's download the SDL_image-main.zip file from here and open it on our computer.
2. When we open the downloaded file on our computer, a directory structure will be created as follows:
3. Let's create a directory named build on our computer. This directory will be used to transfer the created project. Here, we create the directory just under the C: drive. You can create it in any section of your drive.
4. Let's run the cmake-gui.exe file and follow the steps below:
4. Let's run the CodeBlocks 20.03 program and open the project named SDL3_image.cbp and perform the build process.
5. As a result of this process, the following files will be created in the build directory.
6. Let's copy the SDL3_image.dll file in the build directory to the C:\SDL3-3.1.6\i686-w64-mingw32\bin directory, the libSDL3_image.dll.a file to the C:\SDL3-3.1.6\i686-w64-mingw32\lib directory, and the SDL3_image directory under the include directory in the SDL-image_main directory to the C:\SDL3-3.1.6\i686-w64-mingw32\include directory.
SDL_mixer is a virtually portable audio mixing library used with the SDL library. It allows a programmer to use multiple samples with music without having to code a mixing algorithm. It also simplifies the process of loading and playing samples and music from any file format.
Links related to SDL_mixer library
Project page: https://github.com/libsdl-org/SDL_mixer
Latest version: https://github.com/libsdl-org/SDL_mixer/releases/tag/release-2.8.0
SDL3_mixer.dll file creation
When we prepare this page, since the latest released version of the SDL_image library is 2.8.0 for SDL2 and no version has been released for SDL3, we need to create the version of this library for SDL3 from the source codes.
1. Let's download the SDL_mixer-main.zip file from here and open it on our computer.
2. When we open the downloaded file on our computer, a directory structure will be created as follows:
3. Let's create a directory called build on our computer. This directory will be used to transfer the created project. Here, we create the directory just under the C: drive. You can create it in any section of your drive.
4. Let's run the cmake-gui.exe file and follow the steps below:
4. Let's run the CodeBlocks 20.03 program and open the project named SDL3_mixer.cbp and perform the build process.
5. As a result of this process, the following files will be created in the build directory.
6. Let's copy the SDL3_mixer.dll file in the build directory to the C:\SDL3-3.1.6\i686-w64-mingw32\bin directory, the libSDL3_mixer.dll.a file to the C:\SDL3-3.1.6\i686-w64-mingw32\lib directory, and the SDL3_mixer directory under the include directory in the SDL-mixer_main directory to the C:\SDL3-3.1.6\i686-w64-mingw32\include directory.