Where Are shadps4-emu Build Scripts Located? Complete CMake Guide
The shadps4-emu build scripts are located in the repository root as CMakeLists.txt and CMakePresets.json, with additional CI automation in .github/ and .ci/ directories, and modular CMake configurations scattered throughout src/**/CMakeLists.txt files.
The shadps4-emu project (shadPS4) is an open-source PlayStation 4 emulator that relies on CMake for its build system. Understanding where the shadps4-emu build scripts are located is essential for developers who want to compile the emulator from source, modify build configurations, or set up continuous integration pipelines.
Root-Level CMake Configuration
The primary entry point for the shadPS4 build system resides at the repository root, where two critical files define the global build behavior.
CMakeLists.txt
The top-level [CMakeLists.txt](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt) serves as the main shadps4-emu build script. It defines the project name, version requirements, compiler flags, and includes all sub-module CMake files from the src/ directory. This file also handles dependency detection and sets up the main executable target.
CMakePresets.json
Located at the repository root, [CMakePresets.json](https://github.com/shadps4-emu/shadPS4/blob/main/CMakePresets.json) provides pre-configured build environments for common scenarios. These shadps4-emu build presets eliminate manual configuration by specifying generator types, cache variables, and environment settings for Debug, Release, and Docker builds.
CI and Automation Scripts
Beyond the core CMake configuration, the repository contains specialized shadps4-emu build scripts for continuous integration and packaging automation.
Linux AppImage Generation
The .github/ directory contains [linux-appimage-sdl.sh](https://github.com/shadps4-emu/shadPS4/blob/main/.github/linux-appimage-sdl.sh), a shell script used by GitHub Actions to create distributable AppImage packages for Linux. This script handles the bundling of SDL libraries and dependencies into a single portable executable.
Code Formatting Checks
In the .ci/ directory, [clang-format.sh](https://github.com/shadps4-emu/shadPS4/blob/main/.ci/clang-format.sh) provides automated style verification. This shadps4-emu build helper runs clang-format against the entire source tree during pull request validation to enforce consistent code formatting.
Platform-Specific Build Guides
While not executable scripts, the documents/ directory contains markdown guides that function as human-readable build scripts for different platforms:
- [
building-linux.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-linux.md) — Exact CMake commands for Linux compilation - [
building-windows.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md) — Visual Studio and CMake Tools instructions - [
building-macos.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-macos.md) — macOS-specific build steps - [
building-docker.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-docker.md) — Containerized build process
Modular CMake Components
The shadps4-emu build system follows a modular architecture where individual components define their own build rules. Throughout the src/ directory, sub-folders contain their own CMakeLists.txt files that are included by the root configuration.
For example, [src/video_core/host_shaders/CMakeLists.txt](https://github.com/shadps4-emu/shadPS4/blob/main/src/video_core/host_shaders/CMakeLists.txt) handles the compilation of host-side shaders, while other modules like src/imgui/renderer/ and src/core/ maintain their own CMake configurations. This separation allows developers to modify component-specific build flags without affecting the global build script.
Building shadPS4: Practical Examples
Basic Linux Build
To compile shadPS4 from source using the root shadps4-emu build scripts:
# Clone the repository
git clone https://github.com/shadps4-emu/shadPS4.git
cd shadPS4
# Create build directory
mkdir build && cd build
# Configure using the root CMakeLists.txt
cmake .. -DCMAKE_BUILD_TYPE=Release
# Compile
ninja
Alternatively, use the predefined shadps4-emu build presets:
cmake --preset=release-linux
cmake --build build
Docker-Based Build
For containerized builds using the shadps4-emu build scripts:
# Build the Docker image as defined in the repository
docker build -t shadps4-builder -f Dockerfile .
# Run compilation inside container
docker run --rm -v $(pwd):/src shadps4-builder \
bash -c "cd /src && cmake -B build -S . -DCMAKE_BUILD_TYPE=Release && cmake --build build"
Local Code Formatting
To verify code style using the CI helper shadps4-emu build script:
./.ci/clang-format.sh
This executes clang-format checks locally before submitting pull requests.
Summary
- The shadps4-emu build scripts are centralized in the repository root as
CMakeLists.txtandCMakePresets.json, providing the primary build configuration and preset environments. - CI automation scripts reside in
.github/linux-appimage-sdl.sh(Linux packaging) and.ci/clang-format.sh(style verification). - Platform-specific build instructions are documented in
documents/building-*.mdfiles for Linux, Windows, macOS, and Docker. - The modular architecture places component-specific CMake configurations throughout
src/**/CMakeLists.txtfiles, such assrc/video_core/host_shaders/CMakeLists.txt.
Frequently Asked Questions
Where is the main CMake configuration for shadps4-emu located?
The main shadps4-emu build script is located at the repository root in [CMakeLists.txt](https://github.com/shadps4-emu/shadPS4/blob/main/CMakeLists.txt). This file defines the project structure, compiler flags, and includes all sub-module CMake configurations from the src/ directory.
How do I build shadPS4 using the provided presets?
Use the [CMakePresets.json](https://github.com/shadps4-emu/shadPS4/blob/main/CMakePresets.json) file located in the repository root. Run cmake --preset=release-linux (or the appropriate preset name for your platform) to automatically configure the build directory with optimized settings, then execute cmake --build build to compile.
What CI scripts are available in the shadPS4 repository?
The repository includes two primary CI helper scripts: [.github/linux-appimage-sdl.sh](https://github.com/shadps4-emu/shadPS4/blob/main/.github/linux-appimage-sdl.sh) for creating Linux AppImage packages, and [.ci/clang-format.sh](https://github.com/shadps4-emu/shadPS4/blob/main/.ci/clang-format.sh) for automated code style verification during pull request validation.
Where can I find platform-specific build instructions?
Platform-specific shadps4-emu build guides are located in the documents/ directory as markdown files: [building-linux.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-linux.md), [building-windows.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md), [building-macos.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-macos.md), and [building-docker.md](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-docker.md).
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 →