Skip to content

Frankenstein'd project to jumpstart creating a project with SDL. This one uses Vulkan but can easily be changed.

Notifications You must be signed in to change notification settings

timecomplexity/SDL2_Jumpstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDL2 Jumpstart

Easy starting point for playing around with SDL2 and Vulkan, frankenstein'd from other projects.

Dependencies

CMake is our build tool of choice. Need to install at least version 3.26.

Download and build SDL2 which we will be using as our cross-platform window and input system. I cloned the latest release branch of SDL, changed into the root directory and ran the following (For Visual Studio 2022 on Windows). This will put all of the libraries into one place cleanly.

# Builds and installs Debug libraries
cmake -S . -B build/debug -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug --target install --config Debug

# Builds and installs Release libraries
cmake -S . -B build/release -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Release
cmake --build build/release --target install --config Release

We are using C++17. The following compilers are verified to work:

  • Visual Studio 2019
  • Visual Studio 2022
  • GCC 8
  • GCC 12

Setup

Set up Vulkan using the installation process described here.

No need to install GLFW or GLM as we are using SDL2 and GLM is included as a submodule. We are using SDL2 instead of GLFW.

Building

For the final step, there is also a provided build.sh script which only needs the named variables updated at the top of the script to match your generator and custom SDL2 install path.

In order to build shaders, when invoking CMake you will need to supply the argument -DCOMPILE_SHADERS=1.

git clone --recurse-submodules https://github.com/timecomplexity/SDL2_Jumpstart.git
cd SDL2_Jumpstart

# Setup a shadow build
mkdir build && cd build

# Run CMake, replacing with appropriate values for your setup
cmake ../ -G <DesiredGenerator> -DCMAKE_BUILD_TYPE=<DesiredBuildConfiguration> -DCMAKE_PREFIX_PATH=<CustomSDLInstallLocation>
cmake --build . --config <DesiredBuildConfiguration>

# Example for Visual Studio 2022 and a custom install location for SDL2 in Release mode
cmake ../ -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="E:/SDL/install"
cmake --build . --config Release

About

Frankenstein'd project to jumpstart creating a project with SDL. This one uses Vulkan but can easily be changed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published