forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#11526: Visual Studio build configuration for Bitcoin Core
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
- Loading branch information
Showing
25 changed files
with
4,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Build directories | ||
Debug/* | ||
Release/* | ||
.vs | ||
packages/* | ||
*/Obj | ||
*/Debug | ||
*/Release | ||
*/x64 | ||
*.vcxproj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Building Bitcoin Core with Visual Studio | ||
======================================== | ||
|
||
Introduction | ||
--------------------- | ||
Solution and project files to build the Bitcoin Core applications (except Qt dependent ones) with Visual Studio 2017 can be found in the build_msvc directory. | ||
|
||
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). | ||
|
||
Dependencies | ||
--------------------- | ||
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. | ||
|
||
Options for installing the dependencies in a Visual Studio compatible manner are: | ||
|
||
- 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. | ||
- 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 required for the Visual Studio build are (see the [dependencies doc](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md) for versions): | ||
|
||
- Berkeley DB, | ||
- OpenSSL, | ||
- Boost, | ||
- libevent, | ||
- ZeroMQ | ||
|
||
Additional dependencies required from the [bitcoin-core](https://github.com/bitcoin-core) github repository are: | ||
- SECP256K1, | ||
- LevelDB | ||
|
||
Building | ||
--------------------- | ||
The instructions below use vcpkg to install the dependencies. | ||
|
||
- Clone and vcpkg from the [github repository](https://github.com/Microsoft/vcpkg) and install as per the instructions in the main README.md. | ||
- Install the required packages (replace x64 with x86 as required): | ||
- Install the required dependencies with vcpkg: | ||
|
||
``` | ||
PS >.\vcpkg install boost:x64-windows-static ` | ||
libevent:x64-windows-static ` | ||
openssl:x64-windows-static ` | ||
zeromq:x64-windows-static ` | ||
berkeleydb:x64-windows-static ` | ||
secp256k1:x64-windows-static ` | ||
leveldb:x64-windows-static | ||
``` | ||
|
||
- Build in Visual Studio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Label="configInitTarget" Project="..\common.init.vcxproj" /> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="..\..\src\bench\base58.cpp" /> | ||
<ClCompile Include="..\..\src\bench\bech32.cpp" /> | ||
<ClCompile Include="..\..\src\bench\bench.cpp" /> | ||
<ClCompile Include="..\..\src\bench\bench_bitcoin.cpp" /> | ||
<ClCompile Include="..\..\src\bench\ccoins_caching.cpp" /> | ||
<ClCompile Include="..\..\src\bench\checkblock.cpp" /> | ||
<ClCompile Include="..\..\src\bench\checkqueue.cpp" /> | ||
<ClCompile Include="..\..\src\bench\coin_selection.cpp" /> | ||
<ClCompile Include="..\..\src\bench\crypto_hash.cpp" /> | ||
<ClCompile Include="..\..\src\bench\examples.cpp" /> | ||
<ClCompile Include="..\..\src\bench\lockedpool.cpp" /> | ||
<ClCompile Include="..\..\src\bench\mempool_eviction.cpp" /> | ||
<ClCompile Include="..\..\src\bench\merkle_root.cpp" /> | ||
<ClCompile Include="..\..\src\bench\rollingbloom.cpp" /> | ||
<ClCompile Include="..\..\src\bench\verify_script.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\libbitcoinconsensus\libbitcoinconsensus.vcxproj"> | ||
<Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> | ||
<Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> | ||
<Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_server\libbitcoin_server.vcxproj"> | ||
<Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> | ||
<Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> | ||
<Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> | ||
<Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> | ||
<Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<VCProjectVersion>15.0</VCProjectVersion> | ||
<ProjectGuid>{1125654E-E1B2-4431-8B5C-62EA9A2FEECB}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>bench_bitcoin</RootNamespace> | ||
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet> | ||
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v141</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v141</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v141</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v141</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
<Linkage-secp256k1>static</Linkage-secp256k1> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<Linkage-secp256k1>static</Linkage-secp256k1> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<Linkage-secp256k1>static</Linkage-secp256k1> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
<Linkage-secp256k1>static</Linkage-secp256k1> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>crypt32.lib;Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>crypt32.lib;Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>crypt32.lib;Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>crypt32.lib;Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>There was an error executing the raw bench header generation task.</ErrorText> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<RawBenchFile Include="..\..\src\bench\data\*.raw" /> | ||
</ItemGroup> | ||
<HeaderFromHexdump RawFilePath="%(RawBenchFile.FullPath)" HeaderFilePath="%(RawBenchFile.FullPath).h" SourceHeader="static unsigned const char %(RawBenchFile.Filename)[] = {" SourceFooter="};" /> | ||
</Target> | ||
<Import Label="configTarget" Project="..\common.vcxproj" /> | ||
<Import Label="hexdumpTarget" Project="..\msbuild\tasks\hexdump.targets" /> | ||
</Project> |
Oops, something went wrong.