Skip to content

Development Environment Setup

Michael Connor Buchan edited this page Oct 31, 2024 · 3 revisions

Welcome to the Stirling Engine project! Let's get your development environment set up.

1. Get VS Code

We recommend you develop this project with Microsoft's Visual Studio Code, for convenience and consistency, especially when working with other contributors. To that end, we've included some VS Code configuration files to make getting set up as quick and simple as possible; But feel free to use whatever you like best.

Download and install VS Code from https://code.visualstudio.com. You can also install it using a package manager of your choice:

# Winget (built into Windows 11)
winget install Microsoft.VisualStudioCode
# Homebrew (macOS)
brew install --cask visual-studio-code

For Linux, follow Microsoft's installation instructions.

2. Get a C++ Toolchain and CMake

This project is written in C++, so naturally, you're going to need a C++ compiler, debugger, and other tools.

🪟 Windows

Install the Microsoft Visual Studio Build Tools. You can do this easily with winget:

winget install Microsoft.VisualStudio.2022.BuildTools

Note

The msbuild tools are normally distributed with versions of the Visual Studio IDE, so if you already have the full version of Visual Studio 2022 installed, you may already have them. However, you do not need a full Visual Studio installation! If you'd like to save space, install only the command-line build tools.

Once they're installed, do the following:

  1. Open the newly installed "Visual Studio Installer" program
  2. Next to "Visual Studio Build Tools 2022" (or "Visual Studio Community 2022" if you have the full Visual Studio installed), Click "modify"
  3. Under the "Workloads" tab, make sure "Desktop Development with C++" is checked
  4. If it wasn't checked, click "modify" to install it

🍏 macOS

Install the xCode command-line tools, which include a C++ toolchain:

xcode-select --install

Follow the prompts that appear.

You'll also need to install CMake. The best way to do this is via Homebrew:

  1. Go to https://brew.sh, and install it by copying the installation command into your terminal
  2. Once it's installed, you can use the brew command to install CMake:
    brew install cmake

🐧 Linux

In general, you need a C++ compiler, gdb for debugging, and cmake. On Debian / Ubuntu and derivatives you can get these with:

sudo apt install build-essential gdb cmake

On Arch Linux:

sudo pacman -S --needed base-devel gdb cmake

Note

--needed instructs pacman not to reinstall packages you already have, which can save some time, since you're likely to have everything in the base-devel group already.

On Redhat derivatives like Fedora:

sudo dnf groupinstall "Development Tools"
sudo dnf install gdb cmake

Caution

I haven't tested this

3. (Optional) Install Doxygen

We document our code with comments compatible with the Doxygen documentation generator, and if CMake finds doxygen on your system, a target will automatically be created to build HTML documentation from these comments.

🪟 Windows

Install with winget:

winget install DimitriVanHeesch.Doxygen

🍏 macOS

Install Homebrew as explained above, then run:

brew install doxygen

🐧 Linux

Doxygen is likely already in your distro's package manager:

# On Debian / Ubuntu / derivatives
sudo apt -install doxygen
# On Arch Linux
sudo pacman -S doxygen
# On Redhat / Fedora
sudo dnf install doxygen

4. Clone and Open the Project

You can either download and extract the project's zip file, or clone it somewhere with this command:

git clone https://github.com/stirling-uscc/stirling-engine

Once it's cloned, open it in VS Code:

cd stirling-engine
code .

5. Install Recommended Extensions

When you open the repository in VS Code, a prompt will likely appear suggesting recommended extensions for this project (such as the C++ and CMake Tools extensions). Click Install to add them. Alternatively, you can manually install the extensions from the recommended section of the Extensions sidebar tab.

6. Set the CMake Target

  1. Open the CMake sidebar by clicking on the CMake icon on the left.
  2. In the CMake sidebar, choose the "Select debug target" option
  3. Choose stirling-engine as your default target. This ensures you’ll build and run the main engine executable by default when you hit Run or Debug.

7. Run the Program!

Press the play button in the status bar, choose "Start Debugging" from the "Run" menu, or press f8. You should see a blank window appear titled "Stirling Engine" if it worked.


And that’s it! You’re ready to start contributing to the Stirling Engine project. If you run into any setup issues, reach out in the project's Discord chat, or open an issue.