Skip to content

Commit 36f5a58

Browse files
author
MarcoFalke
committed
Merge bitcoin#19960: build: The vcpkg tool has introduced a proper way to use manifests
712f95d Update msvc build to use new vcpkg manifest (Aaron Clauson) Pull request description: The vcpkg tool has introduced a proper way to use [manifests](https://devblogs.microsoft.com/cppblog/vcpkg-accelerate-your-team-development-environment-with-binary-caching-and-manifests/). This PR replaces the custom text file mechanism with the new manifest approach. It is planned that vckpg manifests will include the ability to version dependencies in the future. Dependency versions would solve a number of issues that currently require workarounds with the appveyor CI. ACKs for top commit: fanquake: ACK 712f95d - This is a nice simplification. I tested this in a Windows VM; packages were downloaded and installed automatically as required: hebasto: Approach ACK 712f95d, I've verified that changes comply MS docs: Tree-SHA512: ff9b3d6ad3cacabcbec6566fd289b179af163dc0c4545f8ba666fc14ba07527557f72bc84ba8abfa3bdffb22e2b8ff0b180f41d909c6de76894ac50ddcf8646b
2 parents c7ad944 + 712f95d commit 36f5a58

File tree

6 files changed

+38
-30
lines changed

6 files changed

+38
-30
lines changed

.appveyor.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,19 @@ environment:
1111
QT_DOWNLOAD_HASH: '9a8c6eb20967873785057fdcd329a657c7f922b0af08c5fde105cc597dd37e21'
1212
QT_LOCAL_PATH: 'C:\Qt5.9.8_x64_static_vs2019'
1313
VCPKG_INSTALL_PATH: 'C:\tools\vcpkg\installed'
14-
VCPKG_COMMIT_ID: 'f3f329a048eaff759c1992c458f2e12351486bc7'
14+
VCPKG_COMMIT_ID: '13590753fec479c5b0a3d48dd553dde8d49615fc'
1515
install:
1616
# Disable zmq test for now since python zmq library on Windows would cause Access violation sometimes.
1717
# - cmd: pip install zmq
1818
# Powershell block below is to install the c++ dependencies via vcpkg. The pseudo code is:
1919
# a. Checkout the vcpkg source (including port files) for the specific checkout and build the vcpkg binary,
20-
# b. Install the missing packages.
20+
# b. Install the missing packages using the vcpkg manifest.
2121
- ps: |
22-
$env:PACKAGES = Get-Content -Path build_msvc\vcpkg-packages.txt
23-
Write-Host "vcpkg installing packages: $env:PACKAGES"
2422
cd c:\tools\vcpkg
2523
$env:GIT_REDIRECT_STDERR = '2>&1' # git is writing non-errors to STDERR when doing git pull. Send to STDOUT instead.
2624
git pull origin master > $null
2725
git -c advice.detachedHead=false checkout $env:VCPKG_COMMIT_ID
2826
.\bootstrap-vcpkg.bat > $null
29-
Add-Content "C:\tools\vcpkg\triplets\$env:PLATFORM-windows-static.cmake" "set(VCPKG_BUILD_TYPE release)"
30-
.\vcpkg install --triplet $env:PLATFORM-windows-static $env:PACKAGES.split() > $null
31-
Write-Host "vcpkg packages installed successfully."
32-
.\vcpkg integrate install
3327
cd "$env:APPVEYOR_BUILD_FOLDER"
3428
before_build:
3529
# Powershell block below is to download and extract the Qt static libraries. The pseudo code is:

build_msvc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ libtest_util/libtest_util.vcxproj
2424
*/Win32
2525
libbitcoin_qt/QtGeneratedFiles/*
2626
test_bitcoin-qt/QtGeneratedFiles/*
27+
vcpkg_installed

build_msvc/README.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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 2017 and 2019.
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 2017 and 2019.
77

88
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).
99

@@ -12,10 +12,9 @@ Quick Start
1212
The minimal steps required to build Bitcoin Core with the msbuild toolchain are below. More detailed instructions are contained in the following sections.
1313

1414
```
15-
vcpkg install --triplet x64-windows-static berkeleydb boost-filesystem boost-multi-index boost-signals2 boost-test boost-thread libevent[thread] zeromq double-conversion
16-
vcpkg integrate install
17-
py -3 build_msvc\msvc-autogen.py
18-
msbuild /m build_msvc\bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
15+
cd build_msvc
16+
py -3 msvc-autogen.py
17+
msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
1918
```
2019

2120
Dependencies
@@ -28,14 +27,7 @@ Options for installing the dependencies in a Visual Studio compatible manner are
2827
- Download the source code, build each dependency, add the required include paths, link libraries and binary tools to the Visual Studio project files.
2928
- Use [nuget](https://www.nuget.org/) packages with the understanding that any binary files have been compiled by an untrusted third party.
3029

31-
The [external dependencies](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md) required for building are:
32-
33-
- Berkeley DB
34-
- Boost
35-
- DoubleConversion
36-
- libevent
37-
- Qt5
38-
- ZeroMQ
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. The `msbuild` project files are configured to automatically install the `vcpkg` dependencies.
3931

4032
Qt
4133
---------------------
@@ -52,20 +44,14 @@ Building
5244
The instructions below use `vcpkg` to install the dependencies.
5345

5446
- Install [`vcpkg`](https://github.com/Microsoft/vcpkg).
55-
- Install the required packages (replace x64 with x86 as required). The list of required packages can be found in the `build_msvc\vcpkg-packages.txt` file. The PowerShell command below will work if run from the repository root directory and `vcpkg` is in the path. Alternatively the contents of the packages text file can be pasted in place of the `Get-Content` cmdlet.
56-
57-
```
58-
PS >.\vcpkg install --triplet x64-windows-static $(Get-Content -Path build_msvc\vcpkg-packages.txt).split()
59-
PS >.\vcpkg integrate install
60-
```
6147

6248
- Use Python to generate `*.vcxproj` from Makefile
6349

6450
```
6551
PS >py -3 msvc-autogen.py
6652
```
6753

68-
- 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.
54+
- 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.
6955

7056
- To build from the command line with the Visual Studio 2017 toolchain use:
7157

@@ -79,7 +65,7 @@ msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /p:PlatformTools
7965
msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
8066
```
8167

82-
- Alternatively open the `build_msvc\bitcoin.sln` file in Visual Studio.
68+
- Alternatively open the `build_msvc/bitcoin.sln` file in Visual Studio.
8369

8470
AppVeyor
8571
---------------------

build_msvc/common.init.vcxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
<UseNativeEnvironment>true</UseNativeEnvironment>
1010
</PropertyGroup>
1111

12+
<PropertyGroup Label="Vcpkg">
13+
<VcpkgEnabled>true</VcpkgEnabled>
14+
<VcpkgEnableManifest>true</VcpkgEnableManifest>
15+
<VcpkgManifestInstall>true</VcpkgManifestInstall>
16+
<VcpkgUseStatic>true</VcpkgUseStatic>
17+
<VcpkgAutoLink>true</VcpkgAutoLink>
18+
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
19+
</PropertyGroup>
20+
1221
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and !Exists('$(WindowsSdkDir)\DesignTime\CommonConfiguration\Neutral\Windows.props')">
1322
<WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10>
1423
<WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10>

build_msvc/vcpkg-packages.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

build_msvc/vcpkg.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "bitcoin-core",
3+
"version-string": "1",
4+
"dependencies": [
5+
"berkeleydb",
6+
"boost-filesystem",
7+
"boost-multi-index",
8+
"boost-process",
9+
"boost-signals2",
10+
"boost-test",
11+
"boost-thread",
12+
"double-conversion",
13+
{
14+
"name": "libevent",
15+
"features": ["thread"]
16+
},
17+
"zeromq"
18+
]
19+
}

0 commit comments

Comments
 (0)