Skip to content

Setting up your computer

Ravbug edited this page Mar 2, 2025 · 7 revisions

If you're a complete beginner, then this is the guide for you!

I'm on Windows

  1. Download the Visual Studio Community Edition installer from visualstudio.microsoft.com/vs/ and run it.
    • What about Visual Studio Code? Visual Studio is not the same as Visual Studio Code. Don't use Visual Studio Code for C/C++ development unless you're an expert. If you're reading this page, that's not you.
  2. Choose the latest Visual Studio version. When you are prompted to install additional modules, select the Desktop Development in C++ module.
  3. Hit install and wait for it to finish.
  4. Open Visual Studio. After completing the first-launch setup, you'll see a window that looks like this:
  1. Press Clone a Repository. Paste https://github.com/Ravbug/sdl3-sample into the Repository Location field. Then press Open
  2. Select Folder View in the Solution Explorer - Views panel
  • image
  1. Select sdl-min.exe (Debug\sdl-min.exe) in the dropdown under the green run button. image
  2. Press the green triangle button to build and run. If all goes well, you'll see this!
  • image
  1. To modify the sample, find the main.cpp file in the Solution explorer.
  • image

I'm on Mac

  1. Install Xcode via the App Store.
  2. Wait for Xcode to finish installing.
  3. Download CMake from cmake.org/download. Find "Latest Release", then find "Binary Distributions" and find the link labeled "macOS 10.13 or later."
  4. Open the downloaded .dmg file, and drag CMake to the Applications folder.
  5. Use Spotlight (cmd+Space) to open Terminal. You'll see a window that looks like this: terminal
  6. The terminal window is currently at your Home folder. If you type ls and hit enter, you'll see your Documents, Desktop, Downloads, and other folders listed there. Type cd ~/Downloads and hit enter. The terminal is now in your Downloads folder.
  7. We're now going to download the code for this repository. In the terminal window, run git clone https://github.com/Ravbug/sdl3-sample --recurse-submodules --depth=1
    • What did this do? It told git to download the code for the sample, as well as the code for SDL (--recurse-submodules) and to not download the entire change history (--depth=1).
  8. We're done with the terminal now, so you can close it.
  9. Open CMake. You'll see a window that looks like this:
    • image
  10. Click the Browse Source button and select the sdl3-sample folder. It'll be in your Downloads folder if you followed along with the earlier steps.
  11. Click the Browse Build folder. Make a new empty folder somewhere using the New Folder button in the Open dialog, then press Open.
  12. Press the Generate button at the bottom of the CMake window. Choose the Xcode generator. Leave the other settings to their defaults.
  • image
  1. Wait for this to complete. It can take around 5-10 minutes. You'll see some logging appear in the blank area at the bottom of the CMake window. When it completes, you'll see some red text appear in the CMake window. This is OK.
  • What is this doing? CMake is creating an Xcode project file for you.
  1. Press the Open Project button at the bottom of the CMake window. This will launch Xcode on the generated project file.
  2. Press the Run button. Xcode will build SDL and the example code, then launch it. If all goes well, you should see this!
image
  1. Start modifying this sample (main.cpp) to add your own things to it. If you add additional .cpp or .h files, You'll need to press Generate in the CMake window again so that CMake adds them to the Xcode project.

I'm on Linux

Because you're on Linux, this section will be shorter than the others as familiarity with a terminal, git, and package managers is expected. If you don't know any of the terms I just mentioned, then please learn about those first.

  1. Open your favorite terminal and use your package manager to install:
    • clang or gcc
    • cmake
    • git
    • X11 development libraries (if you use X11)
    • Wayland development libraries (if you use Wayland)
    • ALSA, Pulse, or JACK development libraries (for sound output)
    • OpenGL development libraries (for hardware accelerated rendering)
  2. cd to where you want the sample to download
  3. git clone https://github.com/Ravbug/sdl3-sample --recurse-submodules --depth=1
  4. cd sdl3-sample
  5. cmake -S . -B build
    • CMake will generate a Makefile by default. If you want to generate a Ninja file instead, add -G Ninja to the command. You will also need to install Ninja via your package manager.
  6. Wait for CMake to finish generating a Makefile inside the build subfolder
  7. cmake --build build --parallel --target sdl-min
  8. If all goes well, you'll have a runnable executable inside build. If you run it, you should see a rainbow window appear.

Clone this wiki locally