# How to Build shadPS4 on Windows: Visual Studio 2022 and VS Code Guide

> Build shadPS4 on Windows using Visual Studio 2022 or VS Code. Follow our guide to clone the repository and compile shadps4.exe with CMake and Clang.

- Repository: [shadps4-emu/shadPS4](https://github.com/shadps4-emu/shadPS4)
- Tags: how-to-guide
- Published: 2026-03-19

---

**To build shadPS4 on Windows, install Visual Studio 2022 with Clang components or VS Code with LLVM/Build Tools, clone the repository recursively, and compile using CMake with the Clang-Cl preset to generate `shadps4.exe`.**

shadPS4 is a modern PlayStation 4 emulator written in C++23 and built with CMake. If you want to build shadps4-emu on Windows from source, the project officially supports two toolchains: Visual Studio 2022 and VS Code with Ninja. Both methods rely on the same CMake configuration defined in [`CMakeLists.txt`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt) and the Clang-Cl preset located in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json).

## Prerequisites for Building shadPS4 on Windows

Before compiling, you must install the toolchain and dependencies. The emulator requires **x86_64 architecture support only** (ARM64 is not supported) and targets the `x86-64-v3` microarchitecture level.

### Visual Studio 2022 Requirements

Download the Visual Studio 2022 Community installer and select the following:

- **Workload:** "Desktop development with C++"
- **Individual Components:**
  - "C++ Clang Compiler for Windows"
  - "MSBuild support for LLVM"

The Clang-Cl compiler matches the CI toolchain and ensures binary compatibility with the CMake presets defined in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json).

### VS Code and Command Line Requirements

For a lightweight setup using VS Code or terminal builds, install:

1. **Git for Windows** – Required for cloning and submodule management.
2. **LLVM 19.1.1** – Download `LLVM-19.1.1-win64.exe` and add to system PATH.
3. **CMake ≥ 4.2.3** – Windows x86_64 installer from Kitware.
4. **Ninja ≥ 1.13.2** – Extract to `C:\ninja` and add to PATH.
5. **Visual Studio Build Tools** – Download `vs_BuildTools.exe` and install the MSVC Windows SDK and C++ build tools (or use the `.vsconfig` file provided in the repository).

## Method 1: Building with Visual Studio 2022 (GUI)

This is the simplest path for developers already using the Visual Studio IDE.

First, clone the repository with all submodules:

```bash
git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4

```

The `--recursive` flag pulls third-party dependencies located in `externals/`, including Boost, fmt, and Vulkan SDK headers.

Next, open the project:

1. Launch Visual Studio 2022.
2. Select **"Open a local folder"** and navigate to the cloned `shadPS4` directory (the folder containing [`CMakeLists.txt`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt)).
3. VS 2022 automatically detects the CMake configuration.

Configure the build:

1. In the toolbar, switch from **"Clang x64 Debug"** to **"Clang x64 Release"** (or keep Debug for development with symbols).
2. The configuration uses the preset defined in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json), setting the generator to Ninja and the compiler to `clang-cl`.

Build the project:

1. Choose **Build → Build All**.
2. CMake generates the build folder under `Build/`.
3. The resulting binary appears at `Build/x64-Clang-Release/shadps4.exe`.

## Method 2: Building with VS Code and Ninja (Command Line)

This method uses the same Clang-Cl toolchain as the CI pipeline and is ideal for lightweight development environments.

First, ensure all prerequisites (LLVM, CMake, Ninja, Build Tools) are installed and available in your system PATH.

Clone the repository:

```bash
git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4
cd shadPS4

```

Open the workspace in VS Code:

1. Launch VS Code.
2. Open `shadps4.code-workspace` from the repository root via **File → Open Workspace from File…**.
3. The workspace pre-configures the CMake extension to use the Ninja generator and Clang-Cl compiler.

Configure the project:

1. In the bottom-left status bar, click **CMake: [No Kit Selected]** and select the **Clang x64** kit (pointing to `clang-cl.exe`).
2. Press **F7** or click **CMake: Configure**. This reads the `x64-Clang-Base` preset from [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json), configuring the build with generator Ninja and compiler clang-cl.

Build the executable:

1. Press **Ctrl+Shift+B** or click **CMake: Build**.
2. The build output appears under `Build/x64-Clang-Release/`.

Alternatively, use the command line directly:

```bash
cmake -S . -B Build/x64-Clang-Release -G Ninja \
      -DCMAKE_C_COMPILER=clang-cl \
      -DCMAKE_CXX_COMPILER=clang-cl
cmake --build Build/x64-Clang-Release --config Release

```

The compiled `shadps4.exe` is located at `Build/x64-Clang-Release/shadps4.exe`.

## Understanding the Build Architecture

### CMake Configuration and Presets

The build system is orchestrated by [`CMakeLists.txt`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt) in the repository root. This script:

- Detects the host architecture (x86_64 only; ARM64 is explicitly unsupported)
- Sets compile options including `-march=x86-64-v3` for the x86-64-v3 microarchitecture
- Includes over a thousand source files across modules like *core*, *video_core*, *imgui*, and *shader_recompiler*
- Creates the `shadps4` executable target

The [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json) file provides the `x64-Clang-Base` preset used by both Visual Studio and VS Code workflows, ensuring consistent compiler flags and generator settings across different IDEs.

### Source Structure and Key Components

When building, the compiler processes critical source files including:

- [`src/main.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/main.cpp) – Entry point that parses command-line arguments and initializes the emulator
- [`src/emulator.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/emulator.cpp) / [`src/emulator.h`](https://github.com/shadps4-emu/shadPS4/blob/main/src/emulator.h) – Core emulator object coordinating kernel, video, audio, and input subsystems
- [`src/video_core/renderer_vulkan/vk_swapchain.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/video_core/renderer_vulkan/vk_swapchain.cpp) – Vulkan swap-chain implementation, the primary graphics backend on Windows
- [`src/imgui/renderer/imgui_impl_vulkan.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/imgui/renderer/imgui_impl_vulkan.cpp) – ImGui Vulkan integration rendering the emulator's user interface

## Troubleshooting Common Build Issues

**MSYS2/MinGW builds are currently broken.** While the repository documentation historically listed MinGW as an option, the current [`documents/building-windows.md`](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md) explicitly directs users to use Visual Studio 2022 or VS Code with Clang instead. Attempting to build with MSYS2 will result in compilation errors.

**Missing submodules** cause CMake configuration failures. If you see errors about missing `externals/` libraries, ensure you cloned with `--recursive` or run `git submodule update --init --recursive`.

**Architecture mismatch errors** occur if you attempt to build on ARM64 Windows. The [`CMakeLists.txt`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt) explicitly targets x86_64 with `-march=x86-64-v3` and does not support ARM64 builds.

## Summary

- **shadPS4** requires a C++23 toolchain and CMake, officially supporting **Visual Studio 2022** and **VS Code with Ninja** on Windows.
- Both methods use the **Clang-Cl compiler** (version 19.1.1+) and the preset defined in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json) to ensure CI-compatible binaries.
- Clone with `git clone --depth 1 --recursive` to fetch dependencies in `externals/`.
- Build outputs appear in `Build/x64-Clang-Release/shadps4.exe`.
- **MSYS2/MinGW is currently unsupported**; use the Visual Studio or VS Code workflows instead.

## Frequently Asked Questions

### What compiler does shadPS4 require on Windows?

shadPS4 requires the **Clang-Cl compiler** (part of LLVM) on Windows. The project specifically uses Clang 19.1.1 or later, which matches the continuous integration (CI) pipeline. While Visual Studio's MSVC compiler is installed as part of the Build Tools, the active CMake preset in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json) explicitly selects `clang-cl.exe` as the C and C++ compiler to ensure compatibility with the C++23 codebase and specific optimization flags like `-march=x86-64-v3`.

### Can I build shadPS4 with MinGW or MSYS2?

**No.** While the documentation in [`documents/building-windows.md`](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md) historically listed MSYS2/MinGW as a build option, the current source explicitly states that this approach is **broken and deprecated**. The build system is only tested and maintained for the Clang-Cl toolchain via Visual Studio 2022 or VS Code with Ninja. Attempting to compile with MinGW will result in unresolved dependencies and compilation errors due to missing Windows-specific headers and incompatible standard library implementations.

### Where is the compiled shadps4.exe located after building?

After a successful build, the `shadps4.exe` binary is located in the `Build/x64-Clang-Release/` directory (for release builds) or `Build/x64-Clang-Debug/` (for debug builds). This path is determined by the CMake preset `x64-Clang-Base` defined in [`CMakeWindowsPresets.json`](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeWindowsPresets.json), which sets the binary output directory relative to the build root. You can launch the emulator directly from this location or copy the executable to a different folder, though it must remain able to access the runtime data directories.

### Do I need the full Visual Studio IDE, or can I use Build Tools only?

You can use **Visual Studio Build Tools** without installing the full Visual Studio IDE. The VS Code workflow specifically requires only the Build Tools (for the Windows SDK and MSVC headers) combined with LLVM/Clang, CMake, and Ninja. However, if you choose the GUI-based workflow, you need the full Visual Studio 2022 installation to access the CMake integration and project explorer. Both methods ultimately use the same underlying compilers and produce identical binaries when using the Clang-Cl preset.