This manual describes building Bitcoin Core with Visual Studio using tools--cmake and vcpkg--provided with the VS installation.
-
Visual Studio 2022 version 17.6 or later with the installed "Desktop development with C++" workload.
-
Bitcoin Core code from https://github.com/hebasto/bitcoin/tree/cmake-staging
Open "Developer PowerShell for VS 2022" or "Developer Command Prompt for VS 2022" and run the following commands in it.
The following example assumes using the former. The built-in vcpkg is used in the manifest mode. As such, when caches are unpopulated or invalidated cmake -S ..
commands might take long time.
Create a dedicated build directory:
mkdir build
It is required once only.
This scenario uses the x64-windows
vcpkg triplet and builds dependencies ~30% faster.
cd build
cmake -S .. --fresh --preset vs2022 # It might take a while if caches are unpopulated or invalidated
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
ctest -j $env:NUMBER_OF_PROCESSORS -C Release
This scenario uses the x64-windows-static
vcpkg triplet.
cd build
cmake -S .. --fresh --preset vs2022-static # It might take a while if caches are unpopulated or invalidated
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
ctest -j $env:NUMBER_OF_PROCESSORS -C Release
cmake --install . --config Release # optional
-
vcpkg builds libraries from source. It might demand significant resources like CPU time, disk space etc, especially, for the
qt*
packages. -
To improve the build process performance, one might add the repository folder to the Microsoft Defender Antivirus exclusions.