Skip to content

Commit a68de12

Browse files
committed
Merge bitcoin/bitcoin#22890: doc: Replace a link to Qt precompiled binaries with compile instructions
6bc4398 doc: Suggest using jom instead of nmake (Hennadii Stepanov) c4139f0 doc: Replace a link to Qt precompiled binaries with compile instructions (Hennadii Stepanov) 5e42f2a build: Make <QtBaseDir> default name Qt and VS versions agnostic (Hennadii Stepanov) Pull request description: This PR replaces a [link to Qt precompiled binaries](https://github.com/sipsorcery/qt_win_binary/releases) with compile instructions that allow users to self-compile static Qt package which is required for building Bitcoin Core with Visual Studio. ACKs for top commit: sipsorcery: ACK 6bc4398. Tree-SHA512: 0c91536e51177ec2ed437614cb37b3fd1dccce856548c22307359da68200433971fd97cd8a537b0856cfccc521ac50d61801a78cb5275b818829ee7b43bc7d6a
2 parents 577b0ff + 6bc4398 commit a68de12

File tree

3 files changed

+34
-36
lines changed

3 files changed

+34
-36
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ task:
9090
QT_DOWNLOAD_URL: 'https://download.qt.io/official_releases/qt/5.12/5.12.11/single/qt-everywhere-src-5.12.11.zip'
9191
QT_LOCAL_PATH: 'C:\qt-everywhere-src-5.12.11.zip'
9292
QT_SOURCE_DIR: 'C:\qt-everywhere-src-5.12.11'
93-
QTBASEDIR: 'C:\Qt5.12.11_x64_static_vs2019_160900'
93+
QTBASEDIR: 'C:\Qt_static'
9494
x64_NATIVE_TOOLS: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"'
9595
IgnoreWarnIntDirInTempDetected: 'true'
9696
merge_script:

build_msvc/README.md

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,65 @@ Building Bitcoin Core with Visual Studio
33

44
Introduction
55
---------------------
6-
Solution and project files to build the Bitcoin Core applications `msbuild` or Visual Studio can be found in the `build_msvc` directory. The build has been tested with Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).
6+
Solution and project files to build Bitcoin Core with `msbuild` or Visual Studio can be found in the `build_msvc` directory. The build has been tested with Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).
77

8-
Building with Visual Studio is an alternative to the Linux based [cross-compiler build](https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md).
8+
To build Bitcoin Core from the command-line, it is sufficient to only install the Visual Studio Build Tools component.
99

10-
Quick Start
11-
---------------------
12-
The minimal steps required to build Bitcoin Core with the msbuild toolchain are below. More detailed instructions are contained in the following sections.
10+
Building with Visual Studio is an alternative to the Linux based [cross-compiler build](../doc/build-windows.md).
1311

14-
```
15-
cd build_msvc
16-
py -3 msvc-autogen.py
17-
msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
18-
```
1912

20-
Dependencies
13+
Prerequisites
2114
---------------------
22-
A number of [open source libraries](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md) are required in order to be able to build Bitcoin Core.
15+
To build [dependencies](../doc/dependencies.md) (except for [Qt](#qt)),
16+
the default approach is to use the [vcpkg](https://docs.microsoft.com/en-us/cpp/vcpkg) package manager from Microsoft:
2317

24-
Options for installing the dependencies in a Visual Studio compatible manner are:
18+
1. [Install](https://vcpkg.io/en/getting-started.html) vcpkg.
2519

26-
- Use Microsoft's [vcpkg](https://docs.microsoft.com/en-us/cpp/vcpkg) to download the source packages and build locally. This is the recommended approach.
27-
- Download the source code, build each dependency, add the required include paths, link libraries and binary tools to the Visual Studio project files.
28-
- Use [nuget](https://www.nuget.org/) packages with the understanding that any binary files have been compiled by an untrusted third party.
20+
2. By default, vcpkg makes both `release` and `debug` builds for each package.
21+
To save build time and disk space, one could skip `debug` builds (example uses PowerShell):
22+
```powershell
2923
30-
The [external dependencies](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md) required for building are listed in the `build_msvc/vcpkg.json` file. To ensure `msbuild` project files automatically install the `vcpkg` dependencies use:
31-
32-
```
33-
vcpkg integrate install
24+
Add-Content -Path "vcpkg\triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
3425
```
3526

3627
Qt
3728
---------------------
38-
In order to build Bitcoin Core a static build of Qt is required. The runtime library version (e.g. v142) and platform type (x86 or x64) must also match.
29+
To build Bitcoin Core with the GUI, a static build of Qt is required.
30+
31+
1. Download a single ZIP archive of Qt source code from https://download.qt.io/official_releases/qt/ (e.g., [`qt-everywhere-src-5.12.11.zip`](https://download.qt.io/official_releases/qt/5.12/5.12.11/single/qt-everywhere-src-5.12.11.zip)), and expand it into a dedicated folder. The following instructions assume that this folder is `C:\dev\qt-source`.
32+
33+
2. Open "x64 Native Tools Command Prompt for VS 2019", and input the following commands:
34+
```cmd
35+
cd C:\dev\qt-source
36+
mkdir build
37+
cd build
38+
..\configure -release -silent -opensource -confirm-license -opengl desktop -no-shared -static -static-runtime -mp -qt-zlib -qt-pcre -qt-libpng -no-libjpeg -nomake examples -nomake tests -nomake tools -no-dbus -no-libudev -no-icu -no-gtk -no-opengles3 -no-angle -no-sql-sqlite -no-sql-odbc -no-sqlite -no-libudev -no-vulkan -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -no-openssl -no-feature-sql -no-feature-sqlmodel -prefix C:\Qt_static
39+
nmake
40+
nmake install
41+
```
3942

40-
Some prebuilt x64 versions of Qt can be downloaded from [here](https://github.com/sipsorcery/qt_win_binary/releases). Please be aware these downloads are NOT officially sanctioned by Bitcoin Core and are provided for developer convenience only. They should NOT be used for builds that will be used in a production environment or with real funds.
43+
One could speed up building with [`jom`](https://wiki.qt.io/Jom), a replacement for `nmake` which makes use of all CPU cores.
4144

42-
To determine which Qt prebuilt version to download open the `.cirrus.yml` file and note the `QT_DOWNLOAD_URL`. When extracting the zip file the destination path must be set to `C:\`. This is due to the way that Qt includes, libraries and tools use internal paths.
45+
To build Bitcoin Core without Qt, unload or disable the `bitcoin-qt`, `libbitcoin_qt` and `test_bitcoin-qt` projects.
4346

44-
To build Bitcoin Core without Qt unload or disable the `bitcoin-qt`, `libbitcoin_qt` and `test_bitcoin-qt` projects.
4547

4648
Building
4749
---------------------
48-
The instructions below use `vcpkg` to install the dependencies.
49-
50-
- Install [`vcpkg`](https://github.com/Microsoft/vcpkg).
51-
52-
- Use Python to generate `*.vcxproj` from Makefile
50+
1. Use Python to generate `*.vcxproj` from Makefile:
5351

5452
```
5553
PS >py -3 msvc-autogen.py
5654
```
5755

58-
- An optional step is to adjust the settings in the `build_msvc` directory and the `common.init.vcxproj` file. This project file contains settings that are common to all projects such as the runtime library version and target Windows SDK version. The Qt directories can also be set.
56+
2. An optional step is to adjust the settings in the `build_msvc` directory and the `common.init.vcxproj` file. This project file contains settings that are common to all projects such as the runtime library version and target Windows SDK version. The Qt directories can also be set. To specify a non-default path to a static Qt package directory, use the `QTBASEDIR` environment variable.
5957

60-
- To build from the command line with the Visual Studio 2019 toolchain use:
58+
3. To build from the command-line with the Visual Studio 2019 toolchain use:
6159

62-
```
63-
msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
60+
```cmd
61+
msbuild -property:Configuration=Release -maxCpuCount -verbosity:minimal bitcoin.sln
6462
```
6563

66-
- Alternatively, open the `build_msvc/bitcoin.sln` file in Visual Studio 2019.
64+
Alternatively, open the `build_msvc/bitcoin.sln` file in Visual Studio 2019.
6765

6866
Security
6967
---------------------

build_msvc/common.qt.init.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

44
<PropertyGroup Label="QtGlobals">
5-
<QtBaseDir>C:\Qt5.12.11_x64_static_vs2019_160900</QtBaseDir>
5+
<QtBaseDir Condition="'$(QTBASEDIR)' == ''">C:\Qt_static</QtBaseDir>
66
<QtPluginsLibraryDir>$(QtBaseDir)\plugins</QtPluginsLibraryDir>
77
<QtLibraryDir>$(QtBaseDir)\lib</QtLibraryDir>
88
<QtIncludeDir>$(QtBaseDir)\include</QtIncludeDir>

0 commit comments

Comments
 (0)