diff options
author | Aaron Clauson <aaron@sipsorcery.com> | 2020-09-29 13:48:28 +0100 |
---|---|---|
committer | Aaron Clauson <aaron@sipsorcery.com> | 2020-09-29 13:48:28 +0100 |
commit | 712f95d3324d02310dd468e7bfd1e1b0df432e77 (patch) | |
tree | 3300602820563f8c97bf87e9d2bf01ede25ce358 | |
parent | 1b313cacc99a1b372238f9036abed5491f9d28f7 (diff) |
Update msvc build to use new vcpkg manifest
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.
Set vcpkg manifest version to 1 to avoid any perception it's related to any release or other version numbering.
-rw-r--r-- | .appveyor.yml | 10 | ||||
-rw-r--r-- | build_msvc/.gitignore | 1 | ||||
-rw-r--r-- | build_msvc/README.md | 28 | ||||
-rw-r--r-- | build_msvc/common.init.vcxproj | 9 | ||||
-rw-r--r-- | build_msvc/vcpkg-packages.txt | 1 | ||||
-rw-r--r-- | build_msvc/vcpkg.json | 19 |
6 files changed, 38 insertions, 30 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 6722c1fbec..67739916f6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,25 +11,19 @@ environment: QT_DOWNLOAD_HASH: '9a8c6eb20967873785057fdcd329a657c7f922b0af08c5fde105cc597dd37e21' QT_LOCAL_PATH: 'C:\Qt5.9.8_x64_static_vs2019' VCPKG_INSTALL_PATH: 'C:\tools\vcpkg\installed' - VCPKG_COMMIT_ID: 'f3f329a048eaff759c1992c458f2e12351486bc7' + VCPKG_COMMIT_ID: '13590753fec479c5b0a3d48dd553dde8d49615fc' install: # Disable zmq test for now since python zmq library on Windows would cause Access violation sometimes. # - cmd: pip install zmq # Powershell block below is to install the c++ dependencies via vcpkg. The pseudo code is: # a. Checkout the vcpkg source (including port files) for the specific checkout and build the vcpkg binary, -# b. Install the missing packages. +# b. Install the missing packages using the vcpkg manifest. - ps: | - $env:PACKAGES = Get-Content -Path build_msvc\vcpkg-packages.txt - Write-Host "vcpkg installing packages: $env:PACKAGES" cd c:\tools\vcpkg $env:GIT_REDIRECT_STDERR = '2>&1' # git is writing non-errors to STDERR when doing git pull. Send to STDOUT instead. git pull origin master > $null git -c advice.detachedHead=false checkout $env:VCPKG_COMMIT_ID .\bootstrap-vcpkg.bat > $null - Add-Content "C:\tools\vcpkg\triplets\$env:PLATFORM-windows-static.cmake" "set(VCPKG_BUILD_TYPE release)" - .\vcpkg install --triplet $env:PLATFORM-windows-static $env:PACKAGES.split() > $null - Write-Host "vcpkg packages installed successfully." - .\vcpkg integrate install cd "$env:APPVEYOR_BUILD_FOLDER" before_build: # Powershell block below is to download and extract the Qt static libraries. The pseudo code is: diff --git a/build_msvc/.gitignore b/build_msvc/.gitignore index 3e71c7b8d3..ae8120fdf3 100644 --- a/build_msvc/.gitignore +++ b/build_msvc/.gitignore @@ -24,3 +24,4 @@ libtest_util/libtest_util.vcxproj */Win32 libbitcoin_qt/QtGeneratedFiles/* test_bitcoin-qt/QtGeneratedFiles/* +vcpkg_installed
\ No newline at end of file diff --git a/build_msvc/README.md b/build_msvc/README.md index a489fb36b2..87ea556a23 100644 --- a/build_msvc/README.md +++ b/build_msvc/README.md @@ -3,7 +3,7 @@ Building Bitcoin Core with Visual Studio Introduction --------------------- -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. +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. 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). @@ -12,10 +12,9 @@ Quick Start The minimal steps required to build Bitcoin Core with the msbuild toolchain are below. More detailed instructions are contained in the following sections. ``` -vcpkg install --triplet x64-windows-static berkeleydb boost-filesystem boost-multi-index boost-signals2 boost-test boost-thread libevent[thread] zeromq double-conversion -vcpkg integrate install -py -3 build_msvc\msvc-autogen.py -msbuild /m build_msvc\bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build +cd build_msvc +py -3 msvc-autogen.py +msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build ``` Dependencies @@ -28,14 +27,7 @@ Options for installing the dependencies in a Visual Studio compatible manner are - Download the source code, build each dependency, add the required include paths, link libraries and binary tools to the Visual Studio project files. - Use [nuget](https://www.nuget.org/) packages with the understanding that any binary files have been compiled by an untrusted third party. -The [external dependencies](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md) required for building are: - -- Berkeley DB -- Boost -- DoubleConversion -- libevent -- Qt5 -- ZeroMQ +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. Qt --------------------- @@ -52,12 +44,6 @@ Building The instructions below use `vcpkg` to install the dependencies. - Install [`vcpkg`](https://github.com/Microsoft/vcpkg). -- 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. - -``` -PS >.\vcpkg install --triplet x64-windows-static $(Get-Content -Path build_msvc\vcpkg-packages.txt).split() -PS >.\vcpkg integrate install -``` - Use Python to generate `*.vcxproj` from Makefile @@ -65,7 +51,7 @@ PS >.\vcpkg integrate install PS >py -3 msvc-autogen.py ``` -- 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. +- 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 build from the command line with the Visual Studio 2017 toolchain use: @@ -79,7 +65,7 @@ msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /p:PlatformTools msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build ``` -- Alternatively open the `build_msvc\bitcoin.sln` file in Visual Studio. +- Alternatively open the `build_msvc/bitcoin.sln` file in Visual Studio. AppVeyor --------------------- diff --git a/build_msvc/common.init.vcxproj b/build_msvc/common.init.vcxproj index a080fd2aa4..ed227519ae 100644 --- a/build_msvc/common.init.vcxproj +++ b/build_msvc/common.init.vcxproj @@ -9,6 +9,15 @@ <UseNativeEnvironment>true</UseNativeEnvironment> </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnabled>true</VcpkgEnabled> + <VcpkgEnableManifest>true</VcpkgEnableManifest> + <VcpkgManifestInstall>true</VcpkgManifestInstall> + <VcpkgUseStatic>true</VcpkgUseStatic> + <VcpkgAutoLink>true</VcpkgAutoLink> + <VcpkgConfiguration>$(Configuration)</VcpkgConfiguration> + </PropertyGroup> + <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and !Exists('$(WindowsSdkDir)\DesignTime\CommonConfiguration\Neutral\Windows.props')"> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> diff --git a/build_msvc/vcpkg-packages.txt b/build_msvc/vcpkg-packages.txt deleted file mode 100644 index edce8576c3..0000000000 --- a/build_msvc/vcpkg-packages.txt +++ /dev/null @@ -1 +0,0 @@ -berkeleydb boost-filesystem boost-multi-index boost-process boost-signals2 boost-test boost-thread libevent[thread] zeromq double-conversion diff --git a/build_msvc/vcpkg.json b/build_msvc/vcpkg.json new file mode 100644 index 0000000000..5d5f94227f --- /dev/null +++ b/build_msvc/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "bitcoin-core", + "version-string": "1", + "dependencies": [ + "berkeleydb", + "boost-filesystem", + "boost-multi-index", + "boost-process", + "boost-signals2", + "boost-test", + "boost-thread", + "double-conversion", + { + "name": "libevent", + "features": ["thread"] + }, + "zeromq" + ] +}
\ No newline at end of file |