# So it can't find anything using default paths. # This is because find command doesn't include any path for Windows. # It will find include and lib folders under this directory. Set (CMAKE_VERBOSE_MAKEFILE ON ) cmake_minimum_required (VERSION 3.6 ) project (SDL_Sandbox ) set (CMAKE_CXX_STANDARD 11 ) # Put the FindSDL2.cmake in a folder and tell CMake to find it there set (CMAKE_MODULE_PATH "C:/Development/CMake/modules" ) # This path is used by FindSDL2 module. I’ll further explain the details on CMakeList file.
Get FindSDL2.cmake and place it in a common path ( C:/Development/CMake/modules in this case). Good folks out there have already written some module files for SDL2. If you put your libraries and header files in any folder named other than include or lib you have to add those paths explicitly to the module file. CMake’s find commands work by searching suffixes. find_package will search and find the library files. Either we explicitly include and link SDL2 and SDL_gpu by hardcoding the paths to CMakeList or use CMake’s find_package.
Grab the installer from and install the base, developer-toolkit, gcc-g++ and msys-base packages.ĭownload SDL2 development libraries and source code.ĭownload SDL_gpu (SDL2_gpu for SDL2) development libraries and source code.įor both, extract the libraries and header files to the same folder for proper use (e.g. Note that, before publishing, its important to replace debug libraries with release ones, expecially with the ones provided by the library owners because they probablyįirst, we should install necessary MinGW packages. Thus I’m going to compile them and generate libraries myself. Later on, I’ll implement my own renderer.Īlthough there are available debug builds for SDL2 and SDL_gpu, I couldn’t find a way to attach sources on CLion for libraries compiled elsewhere. Instead of using SDL’s renderer, initially, I’m planning to use SDL_gpu ( ), a native OpenGL/OpenGLES renderer library for SDL/SDL2. There are alternatives to SDL, however none of them officially support Mobile platforms. SDL (Simple Directmedia Layer) is a cross-platform library providing low level access to audio, input and graphics hardware. I thought it would be nice to add a complete guide for the people who want to use the same environment as I’m using.
There are a few guides about how to start using SDL2 for different operating systems and compilers. I plan to develop my own simple 2D game engine on top of SDL2 and document my progress periodically. I’ll build both libraries locally with MinGW. In this post I’ll cover detailed explanation of setting up SDL2 along with SDL_gpu on Windows using CMake (CLion). Setting up SDL2 and SDL_gpu on Windows using CMake