Windows

You can use official binary downloads for this OS, with gcc-win64 or msvc-win64 suffixes.
If you just want to change the file icon or description you don't need to compile, you can use tools like Resource Hacker .

You have 2 major options to build the miner from source: MSYS2 or Microsoft Visual Studio 2019.

Preparation

CMake

Download and install latest CMake release, during install choose option: Add CMake to the system PATH for all users or Add CMake to the system PATH for the current user.

Dependencies
  1. Create folder c:\xmrig-deps
  2. Download the most recent version of prebuilt dependencies by using the green Code button and Download ZIP
  3. Extract gcc and msvc2019 folders to c:\xmrig-deps

Final directory structure should looks like:

C:\xmrig-deps
├───gcc
│   ├───x64
│   │   ├───include
│   │   └───lib
│   └───x86
│       ├───include
│       └───lib
└───msvc2019
    └───x64
        ├───include
        └───lib

MSYS2

Follow instructions on www.msys2.org to install and update MSYS2.

1. pacman -S mingw-w64-x86_64-gcc git make
2. git clone https://github.com/xmrig/xmrig.git
3. mkdir xmrig/build && cd xmrig/build
4. "c:\Program Files\CMake\bin\cmake.exe" .. -G "Unix Makefiles" -DXMRIG_DEPS=c:/xmrig-deps/gcc/x64
5. make -j$(nproc)

Microsoft Visual Studio 2019

  1. Download and install Visual Studio Community 2019 , during install choose following components: Desktop development with C++ (left side) and C++/CLI support for v142 build tools (right side).
  2. Download and install git , default setup parameters are fine.
1. git clone https://github.com/xmrig/xmrig.git
2. mkdir xmrig\build && cd xmrig\build
3. cmake .. -G "Visual Studio 16 2019" -A x64 -DXMRIG_DEPS=c:\xmrig-deps\msvc2019\x64
4. cmake --build . --config Release

CUDA

CUDA plugin build is optional and only required if you like to use NVIDIA GPUs.

We provide binary downloads for CUDA plugin built with CUDA from 9.0 to 11, if you like to build plugin by yourself the only possible option is to use Microsoft Visual Studio. This manual suitable only for CUDA 10.1+ older versions require older Microsoft Visual Studio.

Follow instructions on https://developer.nvidia.com/cuda-downloads to install CUDA.

1. git clone https://github.com/xmrig/xmrig-cuda.git
2. mkdir xmrig-cuda\build && cd xmrig-cuda\build
3. cmake .. -G "Visual Studio 16 2019" -A x64 -DCUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0"
4. cmake --build . --config Release