Skip to content

fdcastel/cpp-dev

Repository files navigation

C++ Developer Environment Setup

Standalone scripts that reproduce the C++ toolchain found on GitHub Actions runner images on your own machines, VMs, or bare-metal servers — without building a full runner image.

Motivation

GitHub Actions runner images ship a rich C++ development environment (MSVC, Clang, GCC, CMake, Ninja, MinGW, vcpkg, …). When you need to replicate that environment outside of GitHub Actions — for a self-hosted builder, a developer workstation, a CI appliance, or an offline lab — you normally have to reverse- engineer what the image provisioner installed. These scripts do that work up front, following the same toolset definitions used by the official images.

Origins

The toolset JSON files (toolset-*.json) are derived from the toolset definitions in the actions/runner-images repository (images/windows/toolsets/ and images/ubuntu/toolsets/). The installation scripts read only the C++-relevant sections of those definitions, mirroring the logic of the official provisioning scripts as closely as practical.

Contents

File Purpose
Install-CppDevEnvironment-Ubuntu2404.ps1 Installs the C++ toolchain on Ubuntu 24.04
Install-CppDevEnvironment-Windows2022.ps1 Installs the C++ toolchain on Windows Server 2022
Install-CppDevEnvironment-Windows2025.ps1 Installs the C++ toolchain on Windows Server 2025
toolset-2404.json Toolset config consumed by the Ubuntu 24.04 script
toolset-2022.json Toolset config consumed by the Windows Server 2022 script
toolset-2025.json Toolset config consumed by the Windows Server 2025 script
install-powershell-ubuntu.sh Bootstrap: installs PowerShell 7 on Ubuntu
install-powershell-windows.cmd Bootstrap: installs PowerShell 7 on Windows via winget
Install-CppDevEnvironment-Windows11.ps1 Installs the C++ toolchain on Windows 11 (client)
toolset-win11.json Toolset config consumed by the Windows 11 script

What gets installed

Ubuntu 24.04

Tool Source
GCC (multiple versions) apt, versions from toolset-2404.json
Clang + clang-format + clang-tidy + lldb + lld (multiple versions) apt, versions from toolset-2404.json
CMake 3.31.6 Official Kitware installer (SHA-256 verified)
Ninja Latest GitHub release binary
vcpkg Cloned from GitHub, bootstrapped, linked to /usr/local/bin

The default Clang version is set via update-alternatives so that clang, clang++, clang-format, and clang-tidy all point to the right binary out of the box.

Windows Server 2022

Tool Source
Visual Studio 2022 BuildTools (or Enterprise) Official VS bootstrapper
C++ workloads: NativeDesktop, NativeGame, NativeMobile, NativeCrossPlat VS installer
VC++ tools: x86/x64, ARM, ARM64, ARM64EC VS installer
LLVM/Clang toolset for VS, MFC, ATL, ASAN, Spectre-mitigated libs VS installer
Windows 10 SDK 10.0.17763 + Windows 11 SDK 10.0.26100 Official SDK installers
Windows Driver Kit (WDK) Official WDK installer
Git, 7-Zip, CMake 3.31.6, Ninja, LLVM Chocolatey
MinGW32 + MinGW64 (UCRT, POSIX threads) niXman/mingw-builds-binaries
MSYS2 Official MSYS2 installer
vcpkg Cloned from GitHub, bootstrapped, integrated

Windows Server 2025

Same as Windows Server 2022 with these differences:

  • Only Windows 11 SDK 10.0.26100 (no Win10 SDK)
  • Windows Driver Kit is not installed
  • DriverKit VS component (Component.Microsoft.Windows.DriverKit) is excluded

Windows 11 (Client)

The new Install-CppDevEnvironment-Windows11.ps1 script targets Windows 11 workstations (client OS). It installs the same developer toolset as the Windows Server scripts (Visual Studio workloads, Chocolatey packages, MinGW/MSYS2, vcpkg, LLVM, CMake, Ninja), but with client-appropriate defaults and optional features. Use toolset-win11.json alongside the script to customize the installed components.

Prerequisites

Ubuntu 24.04

PowerShell 7 is required. If it is not already installed, run the helper script first:

sudo bash install-powershell-ubuntu.sh

The installation script must be run as root or with sudo; it calls sudo internally when not already root.

Windows

PowerShell 7 (pwsh.exe) is required — not the built-in Windows PowerShell 5 (powershell.exe). If it is not already installed, run the helper script from an elevated command prompt:

install-powershell-windows.cmd

The installation script must be run from an elevated PowerShell session (Run as Administrator).

Usage

Ubuntu 24.04

# With default toolset (toolset-2404.json next to the script)
sudo pwsh -File Install-CppDevEnvironment-Ubuntu2404.ps1

# With an explicit toolset path
sudo pwsh -File Install-CppDevEnvironment-Ubuntu2404.ps1 -ToolsetPath /path/to/toolset-2404.json

Windows Server 2022

pwsh.exe -File Install-CppDevEnvironment-Windows2022.ps1

Windows Server 2025

pwsh.exe -File Install-CppDevEnvironment-Windows2025.ps1

Windows 11 (client)

pwsh.exe -File Install-CppDevEnvironment-Windows11.ps1

Idempotency

All installation steps are safe to re-run:

  • Chocolatey and already-installed choco packages are skipped automatically.
  • The Visual Studio installer updates an existing installation rather than installing a second copy.
  • MSYS2 installation is skipped if C:\msys64 already exists.
  • vcpkg is not re-cloned if the target directory already exists.
  • Ubuntu packages are installed with apt-get install, which is a no-op for packages already at the requested version.

License

MIT License -- see the LICENSE file.

About

C++ toolchain found on GitHub Actions runner images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors