How to Build renodx from Source: Complete CMake Guide for ReShade Add-ons

Building renodx from source requires cloning the repository with submodules, selecting a CMake preset for your toolchain (Ninja, Visual Studio, or Clang), and running cmake --build to generate .addon64 or .addon32 modules that ReShade can load into DirectX applications.

The renodx project provides a CMake-driven build system that automates the compilation of DirectX-compatible add-ons. Understanding how to build renodx from source allows developers to customize shaders, modify hooking behavior, and create game-specific modifications. The build pipeline handles tool detection, shader compilation, binary embedding, and architecture-specific linking through configurations defined in CMakeLists.txt and CMakePresets.json.

Prerequisites

Before you build renodx from source, ensure your development environment includes:

  • CMake 3.20 or higher for generating build scripts
  • Visual Studio 2019 or newer, Clang, or Ninja as your toolchain
  • Windows SDK (provides fxc.exe and dxc.exe for shader compilation)
  • Git with submodule support (to fetch external/Detours and other dependencies)

Step-by-Step Build Instructions

Follow these commands to compile the project from a clean state:

  1. Clone the repository recursively to fetch all submodules including the Detours library:
git clone --recursive https://github.com/clshortfuse/renodx.git
cd renodx
  1. Configure the build using a CMake preset. For 64-bit release builds with Ninja:
cmake --preset=ninja-x64-release

For Visual Studio users, use vs-x64 instead. Available presets are defined in CMakePresets.json (lines 21‑86).

  1. Compile the add-ons:
cmake --build --preset=ninja-x64-release
  1. Run tests (optional):
cmake --build --preset=ninja-x64-debug -t test
ctest --preset=ninja-x64-debug

The build outputs .addon64 files (or .addon32 for 32-bit presets) into the build directory, ready for deployment with ReShade.

Understanding the CMake Build Pipeline

The CMakeLists.txt file orchestrates a complex pipeline that transforms shader source code into embedded binary modules.

Tool Discovery

The build script locates shader compilers in the repository bin/ folder or via the Windows SDK (lines 12‑34). It searches for fxc.exe (DirectX 11), dxc.exe (DirectX 12), slangc.exe (Slang shaders), and optionally glslangValidator (Vulkan/OpenGL).

Architecture Detection

The system inspects CMAKE_SIZEOF_VOID_P to determine whether to produce 64-bit (.addon64) or 32-bit (.addon32) binaries (lines 29‑41). This automatic detection ensures the correct memory pointer size for the target ReShade host application.

Detours Library Compilation

The Microsoft Detours library—used for function hooking—is compiled as a static dependency using the VC++ environment via vcvarsall.bat (lines 60‑73). The resulting static library is imported as a CMake target and linked against every add-on module.

Shader Compilation Stages

The build system supports three shader languages, each processed by dedicated compiler logic:

  • HLSL shaders: Compiled with fxc for DX11 targets or dxc for DX12+ using profiles specified in CMakeLists.txt (lines 94‑155)
  • Slang shaders: Processed by slangc with options to emit either DXBC or DXIL bytecode (lines 200‑260)
  • GLSL shaders: Translated to SPIR-V binaries using glslangValidator for Vulkan compatibility (lines 370‑440)

Binary Embedding and Header Generation

Compiled shader binaries are converted into C++ header files by the embed_file utility (located at src/embed_file.cpp). The CMakeLists.txt invokes this tool (lines 310‑380) to aggregate all shaders into a single shaders.h file containing macro tables that the runtime uses to discover custom shaders.

Add-on Target Generation

For every addon.cpp file discovered under src/**/**/addon.cpp, CMake creates a dedicated module target (lines 76‑133). Each target links against the Detours static library and receives the appropriate suffix (.addon64 or .addon32) based on the architecture detected earlier.

CMake Presets and Toolchains

The CMakePresets.json file (lines 21‑86) defines pre-configured environments that abstract toolchain differences. Presets include:

  • ninja-x64-release and ninja-x86-release: Fast builds using the Ninja generator
  • vs-x64: Visual Studio project generation for IDE-based development
  • clang-x64: LLVM/Clang toolchain support for alternative compiler optimization

Each preset specifies the generator, architecture, and build type (Debug or Release), eliminating manual configuration of CMAKE_GENERATOR and CMAKE_BUILD_TYPE.

Summary

  • Build renodx from source using CMake with presets defined in CMakePresets.json to handle toolchain selection automatically
  • The pipeline compiles shaders using fxc, dxc, slangc, or glslangValidator depending on the target graphics API
  • Binary shader data is embedded into headers via src/embed_file.cpp to create self-contained add-on modules
  • Output files use the .addon64 or .addon32 extension based on CMAKE_SIZEOF_VOID_P detection (lines 29‑41)
  • Every add-on links against the Detours library compiled from external/Detours using vcvarsall.bat (lines 60‑73)

Frequently Asked Questions

What tools are required to build renodx from source?

You need CMake, a C++ compiler (MSVC, Clang, or GCC via Ninja), and the Windows SDK. The build system specifically requires fxc.exe or dxc.exe for HLSL compilation, which the CMakeLists.txt locates in either the repository bin/ folder or system SDK paths (lines 12‑34). Git must be configured to fetch submodules recursively to obtain the Detours dependency.

How do I compile 32-bit add-ons instead of 64-bit?

Select a preset containing x86 instead of x64. For example, run cmake --preset=ninja-x86-release followed by cmake --build --preset=ninja-x86-release. The architecture detection logic in CMakeLists.txt (lines 29‑41) checks CMAKE_SIZEOF_VOID_P and automatically assigns the .addon32 suffix to the output files.

Where does the build system locate shader compilers?

The CMakeLists.txt searches for fxc.exe, dxc.exe, and slangc.exe in the repository's local bin/ directory first, then falls back to the Windows SDK installation paths (lines 12‑34). This allows the project to ship specific compiler versions while remaining compatible with system-wide SDK installations.

What is the purpose of the embed_file utility?

The embed_file executable (source at src/embed_file.cpp) converts compiled shader binaries into C++ header files containing byte arrays. During the build process (lines 310‑380), CMake invokes this tool to generate shaders.h, which aggregates all shader data into macro tables that the ReShade add-on runtime queries at initialization time.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →