Skip to content

About

Simple SDL3 template using VCPKG (SDL3, SDL3_image, SDL3_ttf, SDL3_mixer, imgui)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

SDL3Template

A C++23 project template using SDL3 with Dear ImGui.

Prerequisites


Quick Setup

Run create_project.bat from your terminal in the project root:

create_project.bat

That's it. It will:

  1. Install dependencies via vcpkg
  2. Move them into Dependencies/
  3. Reconfigure the project to use the local folder
  4. Rewrite .vcxproj paths to use $(SolutionDir)

Then open the solution in Visual Studio and build.


Manual Setup

Step 1: Configure with vcpkg (installs dependencies)

cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake

CMake reads your vcpkg.json, vcpkg installs all packages into build/vcpkg_installed/x64-windows/.

Replace C:/vcpkg with your local vcpkg path (run vcpkg root to find it).

Step 2: Move the dependencies out of build/

rmdir /S /Q Dependencies
move build\vcpkg_installed Dependencies

This moves the folder to a top-level Dependencies/ so it survives clean builds and can be shared.

Step 3: Reconfigure without vcpkg

del build\CMakeCache.txt
cmake -B build -S .

The first configure baked vcpkg paths into the cache. Deleting it and reconfiguring without the toolchain file makes CMake use the CMAKE_PREFIX_PATH in CMakeLists.txt, which points at Dependencies/x64-windows/. The generated .vcxproj files now reference Dependencies/ instead of the old build/vcpkg_installed/ location.

Step 4: Build

cmake --build build --config Release

Or open the solution in Visual Studio and hit Ctrl+Shift+B.


Building (after setup)

No vcpkg required:

cmake -B build -S .
cmake --build build

Updating Dependencies

  1. Delete Dependencies/
  2. Delete build/
  3. Re-run create_project.bat (or repeat the manual steps)

Project Structure

├── CMakeLists.txt
├── create_project.bat
├── vcpkg.json
├── README.md
├── src/
│   └── main.cpp
└── Dependencies/              ← generated by setup, no vcpkg needed to build
    └── x64-windows/
        ├── bin/               ← Release DLLs
        ├── debug/
        │   ├── bin/           ← Debug DLLs
        │   └── lib/           ← Debug .lib files
        ├── include/
        ├── lib/               ← Release .lib files
        └── share/             ← CMake config files

About

Simple SDL3 template using VCPKG (SDL3, SDL3_image, SDL3_ttf, SDL3_mixer, imgui)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages