Building

From DuckStation Wiki
Jump to navigation Jump to search

This page contains instructions for building (compiling) Duckstation. This page will be updated over time but if in doubt, the official build instructions can be found on the GitHub Readme.

Windows

Requirements:

  • Visual Studio 2019
  1. Clone the repository with submodules: git clone --recursive or git clone and git submodule update --init.
  2. Open the Visual Studio solution duckstation.sln in the root, or "Open Folder" for CMake build.
  3. Build solution.
  4. Binaries are located in bin\x64.
  5. Run duckstation-(sdl/qt)-x64-(config).exe.

Linux

Requirements (Debian/Ubuntu package names):
CMake cmake
SDL2 libsdl2-dev, libxrandr-dev
pkg-config pkg-config
Qt 5 qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qttools5-dev
libevdev libevdev-dev
git git
Wayland [1] libwayland-dev, libwayland-egl-backend-dev, extra-cmake-modules
RetroAchievements: libcurl [1] libcurl4-gnutls-dev
(Optional) Framebuffer output libgbm-dev, libdrm-dev
(Optional) Ninja for faster compile ninja-build

Building

  1. Clone the repository. Submodules aren't necessary, there is only one and it is only used for Windows (git clone https://github.com/stenzek/duckstation.git -b dev).
  2. Create a build directory, either in-tree or elsewhere.
  3. Run cmake to configure the build system. Assuming a build subdirectory of build-release: cd build-release && cmake -DCMAKE_BUILD_TYPE=Release -GNinja ...
  4. Compile the source code. For the example above, run ninja.
  5. Run the binary, located in the build directory under bin/duckstation-qt.

Notes:

  1. 1.0 1.1 Enabled by default in cmake, but optional.

macOS

NOTE: macOS is highly experimental and not tested by the developer. Use at your own risk, things may be horribly broken.

Requirements:
CMake (installed by default?) brew install cmake
SDL2 brew install sdl2
Qt 5 brew install qt5
  1. Clone the repository. Submodules aren't necessary, there is only one and it is only used for Windows (git clone https://github.com/stenzek/duckstation.git -b dev).
  2. Clone the mac externals repository (for MoltenVK): git clone https://github.com/stenzek/duckstation-ext-mac.git dep/mac.
  3. Create a build directory, either in-tree or elsewhere, e.g. mkdir build-release && cd build-release.
  4. Run cmake to configure the build system: cmake -DCMAKE_BUILD_TYPE=Release -DQt5_DIR=/usr/local/opt/qt@5/lib/cmake/Qt5 ..
    • You may need to tweak Qt5_DIR depending on your system.
  5. Compile the source code: make -j$(sysctl -n hw.activecpu)
    • -j$(sysctl -n hw.activecpu) uses the number of available CPU threads for a faster build.
  6. Run the binary, located in the build directory under bin/duckstation-sdl, or bin/DuckStation.app for Qt.

Android

Requirements:

  • Android Studio with the NDK and CMake installed
  1. Clone the repository. Submodules aren't necessary, there is only one and it is only used for Windows.
  2. Open the project in the android directory.
  3. Select Build -> Build Bundle(s) / APKs(s) -> Build APK(s).
  4. Install APK on device, or use Run menu for attached device.