IDE Support
Visual Studio
Visual Studio supports CMake Presets natively. You just need to open the Dolphin repository folder in Visual Studio, and it will automatically detect the CMakePresets.json file and allow you to select the presets from the dropdown menu in the toolbar.
Visual Studio Code
Visual Studio Code supports CMake Presets through the CMake Tools extension. After installing the extension, you can select the presets from the command palette (Ctrl+Shift+P) by searching for "CMake: Select Configure Preset" and "CMake: Select Build Preset", or by clicking on "⚙️ Build" in the status bar.
Using CMake Presets
Dolphin provides CMake presets for common configuration and build tasks. These presets simplify the build process by predefining common settings for different build types, generators, and target architectures.
Dolphin presets are in the format (generator)(-build)?-(build type)-(architecture), where:
(generator)is the CMake generator to use, the options are:ninjavisualstudio
(-build)?is an optional suffix that is present for build presets.(build type)is the build type, the options are:releasedebug
(architecture)is the target architecture, the options are:x64arm64generic, which is a catch-all for any 64-bit architecture that Dolphin doesn't support.
These presets are defined in the CMakePresets.json file at the root of the repository. You can also create your own custom presets if needed by creating a CMakeUserPresets.json file and defining your presets there. Refer to the CMake documentation for more details on how to create and use presets.
Configure Presets
To configure a build using a preset, you can use the cmake --preset command. For example, to configure a release build for x64 architecture using Ninja:
cmake --preset ninja-release-x64
You can list all available configure presets using the cmake --list-presets command.
Additionally, extra options can be passed or overridden at this step. For example, to only use the vendored-in libraries instead of system libraries, you can add the -DUSE_SYSTEM_LIBS=OFF option:
cmake --preset ninja-release-x64 -DUSE_SYSTEM_LIBS=OFF
You can also specify the generator and options directly if you don't want to use presets, but using presets is recommended for consistency and ease of use:
mkdir -p build/release/x64
cmake -Bbuild/release/x64 -GNinja -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_LIBS=OFF
Build Presets
To build a configured project using a preset, you can use the cmake --build command with the --preset option. For example, to build the previously configured release build for x64 architecture using Ninja:
cmake --build --preset ninja-build-release-x64
You can list all available build presets using the cmake --build --list-presets command.
Additionally, you can specify the target to build using the --target option. For example, to build only the dolphin-emu target:
cmake --build --preset ninja-build-release-x64 --target dolphin-emu
You can also build without using presets by specifying the build directory and target directly, but using presets is recommended for consistency and ease of use:
cmake --build build/release/x64 --target dolphin-emu
Workflows
CMake workflows are provided for common build and configuration tasks. You can use these workflows to simplify the build process, but they can not accept extra options like the configure and build presets can. For example, to configure and build a release version with Ninja:
cmake --workflow ninja-release-x64
Cross-compilation
Dolphin supports being cross-compiled between different architectures, but doing so requires a few extra steps:
If using the visualstudio generator on Windows, you just need to select the correct architecture in the preset name. For example, to build a release version for ARM64:
cmake --workflow --preset visualstudio-release-arm64
If using the ninja generator, you need to have a cross-compiler installed, and a sysroot for the target system and architecture. For example, to build a release version for ARM64:
cmake --preset ninja-release-arm64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SYSROOT=/opt/sysroots/aarch64-linux-gnu
cmake --build --preset ninja-build-release-arm64
You may create a CMakeUserPresets.json file with presets for cross-compilation to avoid having to specify the compiler and sysroot every time.
Dolphin provides its own CMake toolchain file for cross-compilation, which can be found in CMake/DolphinToolchain.cmake. This toolchain file sets up the necessary flags and options for cross-compilation, and is used automatically when using presets. If you are not using presets or wish to override the toolchain file, you can specify it using the -DCMAKE_TOOLCHAIN_FILE option.
CMake options
CMake options can be passed to the cmake command to customize the build process. These options can be used to enable or disable features, specify paths, and more. This table is a non-exhaustive list of CMake options Dolphin supports.
| Option | Description | Default | Condition |
|---|---|---|---|
ENABLE_X11 |
Enables X11 Support | ON |
Unix, non-Apple, non-Android |
ENABLE_EGL |
Enables EGL OpenGL Interface | ON |
Non-Windows, non-Apple, non-Haiku |
ENABLE_CLI_TOOL |
Enable dolphin-tool, a CLI-based utility for functions such as managing disc images | ON |
non-Android |
USE_SYSTEM_LIBS |
Use system libraries instead of bundled libraries. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled. |
AUTO |
|
USE_SYSTEM_<LIB> |
Works in the same way as USE_SYSTEM_LIBS, but for a specific library. <LIB> needs to be replaced by the name of the library: e.g., USE_SYSTEM_SDL. |
AUTO |
|
USE_UPNP |
Enables UPnP port mapping support | ON |
|
ENABLE_NOGUI |
Enable NoGUI frontend | ON |
|
ENABLE_QT |
Enable Qt | ON |
|
ENABLE_LTO |
Enables Link Time Optimization | OFF |
|
ENABLE_GENERIC |
Enables generic build that should run on any little-endian host | OFF |
|
ENABLE_HEADLESS |
Enables running Dolphin as a headless variant | OFF |
|
ENABLE_ALSA |
Enables ALSA sound backend | ON |
|
ENABLE_PULSEAUDIO |
Enables PulseAudio sound backend | ON |
|
ENABLE_CUBEB |
Enables Cubeb sound backend | ON |
|
ENABLE_LLVM |
Enables LLVM support, for disassembly | ON |
|
ENABLE_TESTS |
Enables building the unit tests | ON |
|
ENABLE_VULKAN |
Enables vulkan video backend | ON |
|
USE_DISCORD_PRESENCE |
Enables Discord Rich Presence, show the current game on Discord | ON |
|
USE_MGBA |
Enables GBA controllers emulation using libmgba | ON |
|
ENABLE_AUTOUPDATE |
Enables support for automatic updates | ON |
|
USE_RETRO_ACHIEVEMENTS |
Enables integration with retroachievements.org | ON |
|
ENABLE_CCACHE |
Enables CCache compiler cache | OFF |
|
ENABLE_ANALYTICS |
Enables opt-in Analytics collection. Maintainers: if you consider blanket disabling this for your users, please consider the following points: - No data is being sent without explicit user approval (pop up box at first launch). - The Dolphin team relies on the data in order to understand the behavior of our software in the wild. |
ON |
|
ENCODE_FRAMEDUMPS |
Encode framedumps in AVI format | ON |
|
ENABLE_GPROF |
Enable gprof profiling (must be using Debug build) | OFF |
|
FASTLOG |
Enable all logs | OFF |
|
DSPTOOL |
Build dsptool | OFF |
|
ENABLE_SDL |
Enables SDL as a generic controller backend | ON / OFF |
|
RC_CLIENT_SUPPORTS_RAINTEGRATION |
Enables RetroAchievements developer tools | ON |
Windows only |
MACOS_USE_DEFAULT_SEARCH_PATH |
Don't prioritize system library paths | OFF |
Apple only |
POSTPROCESS_BUNDLE |
Postprocess bundle for redistributability | OFF |
Apple only |
MACOS_CODE_SIGNING |
Enable codesigning | ON |
Apple only |
USE_BUNDLED_MOLTENVK |
Build MoltenVK from Externals with Dolphin-specific patches | ON |
Apple only |
MACOS_CODE_SIGNING_IDENTITY |
The identity used for codesigning. | "-" |
Apple only |
ENABLE_VTUNE |
Enable Intel VTune integration for JIT code. | OFF |
Linux only |
ENABLE_HWDB |
Enables the udev hardware database | ON |
Linux only |
ENABLE_EVDEV |
Enables the evdev controller backend | ON |
Linux only |
-
Building
-
Feature explanations
-
Dolphin Infrastructure
-
Reference
Homepage | Project Site | Forums | Wiki | Issue Tracker | Coding Style | Transifex Page