0
0
mirror of https://git.citron-emu.org/Citron/Citron.git synced 2025-02-19 01:15:45 +00:00
1
Building For Windows
Zephyron edited this page 2025-02-17 12:00:40 +00:00

Building Citron for Windows

This guide is intended for developers who wish to build Citron for Windows. Support will be given only to developers.


Table of Contents

  1. Method I: MSVC Build for Windows
    • Minimal Dependencies
    • Cloning Citron with Git
    • Building
  2. Method II: MinGW-w64 Build with MSYS2
    • Prerequisites to Install
    • Install Citron Dependencies for MinGW-w64
    • Clone the Citron Repository with Git
    • Building Citron (Dynamically Linked)
    • Building Without Qt (Optional)
  3. Method III: CLion Environment Setup
    • Minimal Dependencies
    • Cloning Citron with CLion
    • Building & Setup
  4. Building from the Command Line with MSVC

Method I: MSVC Build for Windows

Minimal Dependencies

To build Citron on Windows, you need the following software:

  • Visual Studio 2022 Community: Make sure to select C++ support in the installer. Update to the latest version if already installed.
  • CMake: Used to generate Visual Studio project files. Either the 32-bit or 64-bit version will work.
  • Vulkan SDK: Ensure you select the latest version during installation.
  • Git: We recommend Git for Windows.

While installing Git Bash, ensure the option to include Git in your system path is selected. If not, you'll need to manually configure CMake to find your git.exe.


Cloning Citron with Git

To clone the Citron repository with Git, run the following command:

git clone --recursive https://git.citron-emu.org/Citron/Citron.git
cd citron

By default, Citron will be cloned to:

  • Windows: C:\Users\<user-name>\citron

Building

  1. Open the CMake GUI application and point it to the Citron directory.
  2. For the build directory, create a /build subdirectory within the source directory (or choose another directory).
  3. Click Configure and select Visual Studio 17 2022, with x64 for the optional platform.
  4. If dependencies are missing, enable CITRON_USE_BUNDLED_VCPKG, then click Configure again.
  5. Click Generate to create the Visual Studio project files.
  6. Open the solution file citron.sln in Visual Studio 2022.
  7. Select the Active Project (either Citron or Citron-cmd for command-line) in Solution Explorer.
  8. Select the build type: Debug for debugging or Release for performance (use Release if unsure).
  9. Right-click the project you want to build and select Build, or press F5.

Feel free to reach out on the Citron Discord or IRC if you have issues.


Method II: MinGW-w64 Build with MSYS2

Prerequisites to Install

Before building Citron with MinGW-w64, you need to install:

  • MSYS2
  • Vulkan SDK: Make sure to select the latest version.

Update to the latest version by running pacman -Syu multiple times if necessary.


Install Citron Dependencies for MinGW-w64

  1. Open the MSYS2 MinGW 64-bit shell (mingw64.exe).
  2. Run the following command to install dependencies:
pacman -Syu git make mingw-w64-x86_64-SDL2 mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-qt5 mingw-w64-x86_64-toolchain autoconf libtool automake-wrapper
  1. Add MinGW binaries to the PATH:
echo 'PATH=/mingw64/bin:$PATH' >> ~/.bashrc
  1. Add glslangValidator to the PATH:
echo 'PATH=$(readlink -e /c/VulkanSDK/*/Bin/):$PATH' >> ~/.bashrc

Clone the Citron Repository with Git

git clone --recursive https://git.citron-emu.org/Citron/Citron.git
cd citron

Run the Following Commands to Build Citron (Dynamically Linked)

mkdir build && cd build
cmake -G "MSYS Makefiles" -DCITRON_USE_BUNDLED_VCPKG=ON -DCITRON_TESTS=OFF ..
make -j$(nproc)
  • Note: This is not a static build, so you'll need to include all the required DLLs with the executable to run it.

For example:

cp externals/ffmpeg-*/bin/*.dll bin/

Building Without Qt (Optional)

To build Citron without the large Qt dependency (removes the GUI frontend), pass the -DENABLE_QT=no flag to CMake.


Method III: CLion Environment Setup

Minimal Dependencies

To build Citron with CLion, you need:

  • CLion (this IDE is paid; for a free alternative, see Method I).
  • Vulkan SDK: Ensure you select the latest version.

Cloning Citron with CLion

  1. Clone the Citron repository using Git:
git clone --recursive https://git.citron-emu.org/Citron/Citron.git
cd citron

Building & Setup

  1. Once cloned, CLion will prompt you with setup options.
  2. Set the following:
    • Build type: Release
    • Name: Release
    • Toolchain: Visual Studio
    • Generator: Let CMake decide
    • Build directory: build
  3. Click OK and wait for CLion to create the build directory and index the code.
  4. Once indexing is complete, select All Configurations in the top-right dropdown, then select Citron.
  5. Click the Play button or press Shift+F10 to build Citron. It will launch automatically once built.

Building from the Command Line with MSVC

For a simple command-line build with MSVC:

git clone --recursive https://git.citron-emu.org/Citron/Citron.git
cd citron
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64
cmake --build . --config Release