How to Build shadPS4 on Windows: Visual Studio 2022 and VS Code Guide
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 and the Clang-Cl preset located in 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.
VS Code and Command Line Requirements
For a lightweight setup using VS Code or terminal builds, install:
- Git for Windows – Required for cloning and submodule management.
- LLVM 19.1.1 – Download
LLVM-19.1.1-win64.exeand add to system PATH. - CMake ≥ 4.2.3 – Windows x86_64 installer from Kitware.
- Ninja ≥ 1.13.2 – Extract to
C:\ninjaand add to PATH. - Visual Studio Build Tools – Download
vs_BuildTools.exeand install the MSVC Windows SDK and C++ build tools (or use the.vsconfigfile 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:
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:
- Launch Visual Studio 2022.
- Select "Open a local folder" and navigate to the cloned
shadPS4directory (the folder containingCMakeLists.txt). - VS 2022 automatically detects the CMake configuration.
Configure the build:
- In the toolbar, switch from "Clang x64 Debug" to "Clang x64 Release" (or keep Debug for development with symbols).
- The configuration uses the preset defined in
CMakeWindowsPresets.json, setting the generator to Ninja and the compiler toclang-cl.
Build the project:
- Choose Build → Build All.
- CMake generates the build folder under
Build/. - 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:
git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4
cd shadPS4
Open the workspace in VS Code:
- Launch VS Code.
- Open
shadps4.code-workspacefrom the repository root via File → Open Workspace from File…. - The workspace pre-configures the CMake extension to use the Ninja generator and Clang-Cl compiler.
Configure the project:
- In the bottom-left status bar, click CMake: [No Kit Selected] and select the Clang x64 kit (pointing to
clang-cl.exe). - Press F7 or click CMake: Configure. This reads the
x64-Clang-Basepreset fromCMakeWindowsPresets.json, configuring the build with generator Ninja and compiler clang-cl.
Build the executable:
- Press Ctrl+Shift+B or click CMake: Build.
- The build output appears under
Build/x64-Clang-Release/.
Alternatively, use the command line directly:
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 in the repository root. This script:
- Detects the host architecture (x86_64 only; ARM64 is explicitly unsupported)
- Sets compile options including
-march=x86-64-v3for the x86-64-v3 microarchitecture - Includes over a thousand source files across modules like core, video_core, imgui, and shader_recompiler
- Creates the
shadps4executable target
The 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– Entry point that parses command-line arguments and initializes the emulatorsrc/emulator.cpp/src/emulator.h– Core emulator object coordinating kernel, video, audio, and input subsystemssrc/video_core/renderer_vulkan/vk_swapchain.cpp– Vulkan swap-chain implementation, the primary graphics backend on Windowssrc/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 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 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.jsonto ensure CI-compatible binaries. - Clone with
git clone --depth 1 --recursiveto fetch dependencies inexternals/. - 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 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 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, 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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →