Table of Contents
- Building Citron for Windows
- Table of Contents
- Method I: MSVC Build for Windows
- Method II: MinGW-w64 Build with MSYS2
- Prerequisites to Install
- Install Citron Dependencies for MinGW-w64
- Clone the Citron Repository with Git
- Run the Following Commands to Build Citron (Dynamically Linked)
- Building Without Qt (Optional)
- Method III: CLion Environment Setup
- Building from the Command Line with MSVC
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
- Method I: MSVC Build for Windows
- Minimal Dependencies
- Cloning Citron with Git
- Building
- 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)
- Method III: CLion Environment Setup
- Minimal Dependencies
- Cloning Citron with CLion
- Building & Setup
- 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
- Open the CMake GUI application and point it to the Citron directory.
- For the build directory, create a
/build
subdirectory within the source directory (or choose another directory). - Click Configure and select Visual Studio 17 2022, with x64 for the optional platform.
- If dependencies are missing, enable
CITRON_USE_BUNDLED_VCPKG
, then click Configure again. - Click Generate to create the Visual Studio project files.
- Open the solution file
citron.sln
in Visual Studio 2022. - Select the Active Project (either Citron or Citron-cmd for command-line) in Solution Explorer.
- Select the build type: Debug for debugging or Release for performance (use Release if unsure).
- 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
- Open the MSYS2 MinGW 64-bit shell (
mingw64.exe
). - 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
- Add MinGW binaries to the PATH:
echo 'PATH=/mingw64/bin:$PATH' >> ~/.bashrc
- 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
- Clone the Citron repository using Git:
git clone --recursive https://git.citron-emu.org/Citron/Citron.git
cd citron
Building & Setup
- Once cloned, CLion will prompt you with setup options.
- Set the following:
- Build type: Release
- Name: Release
- Toolchain: Visual Studio
- Generator: Let CMake decide
- Build directory:
build
- Click OK and wait for CLion to create the build directory and index the code.
- Once indexing is complete, select All Configurations in the top-right dropdown, then select Citron.
- 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