Skip to content

Commit ef7beae

Browse files
committed
Visual Studio build configuration for Bitcoin Core
1 parent f66e1c7 commit ef7beae

File tree

25 files changed

+4753
-0
lines changed

25 files changed

+4753
-0
lines changed

build_msvc/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Build directories
2+
Debug/*
3+
Release/*
4+
.vs
5+
packages/*
6+
*/Obj
7+
*/Debug
8+
*/Release
9+
*/x64
10+
*.vcxproj.user

build_msvc/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Building Bitcoin Core with Visual Studio
2+
========================================
3+
4+
Introduction
5+
---------------------
6+
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.
7+
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).
9+
10+
Dependencies
11+
---------------------
12+
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.
13+
14+
Options for installing the dependencies in a Visual Studio compatible manner are:
15+
16+
- 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.
17+
- Download the source code, build each dependency, add the required include paths, link libraries and binary tools to the Visual Studio project files.
18+
- Use [nuget](https://www.nuget.org/) packages with the understanding that any binary files have been compiled by an untrusted third party.
19+
20+
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):
21+
22+
- Berkeley DB,
23+
- OpenSSL,
24+
- Boost,
25+
- libevent,
26+
- ZeroMQ
27+
28+
Additional dependencies required from the [bitcoin-core](https://github.com/bitcoin-core) github repository are:
29+
- SECP256K1,
30+
- LevelDB
31+
32+
Building
33+
---------------------
34+
The instructions below use vcpkg to install the dependencies.
35+
36+
- Clone and vcpkg from the [github repository](https://github.com/Microsoft/vcpkg) and install as per the instructions in the main README.md.
37+
- Install the required packages (replace x64 with x86 as required):
38+
- Install the required dependencies with vcpkg:
39+
40+
```
41+
PS >.\vcpkg install boost:x64-windows-static `
42+
libevent:x64-windows-static `
43+
openssl:x64-windows-static `
44+
zeromq:x64-windows-static `
45+
berkeleydb:x64-windows-static `
46+
secp256k1:x64-windows-static `
47+
leveldb:x64-windows-static
48+
```
49+
50+
- Build in Visual Studio.
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Label="configInitTarget" Project="..\common.init.vcxproj" />
4+
<ItemGroup Label="ProjectConfigurations">
5+
<ProjectConfiguration Include="Debug|Win32">
6+
<Configuration>Debug</Configuration>
7+
<Platform>Win32</Platform>
8+
</ProjectConfiguration>
9+
<ProjectConfiguration Include="Release|Win32">
10+
<Configuration>Release</Configuration>
11+
<Platform>Win32</Platform>
12+
</ProjectConfiguration>
13+
<ProjectConfiguration Include="Debug|x64">
14+
<Configuration>Debug</Configuration>
15+
<Platform>x64</Platform>
16+
</ProjectConfiguration>
17+
<ProjectConfiguration Include="Release|x64">
18+
<Configuration>Release</Configuration>
19+
<Platform>x64</Platform>
20+
</ProjectConfiguration>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClCompile Include="..\..\src\bench\base58.cpp" />
24+
<ClCompile Include="..\..\src\bench\bech32.cpp" />
25+
<ClCompile Include="..\..\src\bench\bench.cpp" />
26+
<ClCompile Include="..\..\src\bench\bench_bitcoin.cpp" />
27+
<ClCompile Include="..\..\src\bench\ccoins_caching.cpp" />
28+
<ClCompile Include="..\..\src\bench\checkblock.cpp" />
29+
<ClCompile Include="..\..\src\bench\checkqueue.cpp" />
30+
<ClCompile Include="..\..\src\bench\coin_selection.cpp" />
31+
<ClCompile Include="..\..\src\bench\crypto_hash.cpp" />
32+
<ClCompile Include="..\..\src\bench\examples.cpp" />
33+
<ClCompile Include="..\..\src\bench\lockedpool.cpp" />
34+
<ClCompile Include="..\..\src\bench\mempool_eviction.cpp" />
35+
<ClCompile Include="..\..\src\bench\merkle_root.cpp" />
36+
<ClCompile Include="..\..\src\bench\rollingbloom.cpp" />
37+
<ClCompile Include="..\..\src\bench\verify_script.cpp" />
38+
</ItemGroup>
39+
<ItemGroup>
40+
<ProjectReference Include="..\libbitcoinconsensus\libbitcoinconsensus.vcxproj">
41+
<Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project>
42+
</ProjectReference>
43+
<ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj">
44+
<Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project>
45+
</ProjectReference>
46+
<ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj">
47+
<Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project>
48+
</ProjectReference>
49+
<ProjectReference Include="..\libbitcoin_server\libbitcoin_server.vcxproj">
50+
<Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project>
51+
</ProjectReference>
52+
<ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj">
53+
<Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project>
54+
</ProjectReference>
55+
<ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj">
56+
<Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project>
57+
</ProjectReference>
58+
<ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj">
59+
<Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project>
60+
</ProjectReference>
61+
<ProjectReference Include="..\libunivalue\libunivalue.vcxproj">
62+
<Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project>
63+
</ProjectReference>
64+
</ItemGroup>
65+
<PropertyGroup Label="Globals">
66+
<VCProjectVersion>15.0</VCProjectVersion>
67+
<ProjectGuid>{1125654E-E1B2-4431-8B5C-62EA9A2FEECB}</ProjectGuid>
68+
<Keyword>Win32Proj</Keyword>
69+
<RootNamespace>bench_bitcoin</RootNamespace>
70+
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
71+
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
72+
</PropertyGroup>
73+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
74+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
75+
<ConfigurationType>Application</ConfigurationType>
76+
<UseDebugLibraries>true</UseDebugLibraries>
77+
<PlatformToolset>v141</PlatformToolset>
78+
<CharacterSet>Unicode</CharacterSet>
79+
</PropertyGroup>
80+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
81+
<ConfigurationType>Application</ConfigurationType>
82+
<UseDebugLibraries>false</UseDebugLibraries>
83+
<PlatformToolset>v141</PlatformToolset>
84+
<WholeProgramOptimization>true</WholeProgramOptimization>
85+
<CharacterSet>Unicode</CharacterSet>
86+
</PropertyGroup>
87+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
88+
<ConfigurationType>Application</ConfigurationType>
89+
<UseDebugLibraries>true</UseDebugLibraries>
90+
<PlatformToolset>v141</PlatformToolset>
91+
<CharacterSet>Unicode</CharacterSet>
92+
</PropertyGroup>
93+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
94+
<ConfigurationType>Application</ConfigurationType>
95+
<UseDebugLibraries>false</UseDebugLibraries>
96+
<PlatformToolset>v141</PlatformToolset>
97+
<WholeProgramOptimization>true</WholeProgramOptimization>
98+
<CharacterSet>Unicode</CharacterSet>
99+
</PropertyGroup>
100+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
101+
<ImportGroup Label="ExtensionSettings">
102+
</ImportGroup>
103+
<ImportGroup Label="Shared">
104+
</ImportGroup>
105+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
106+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
107+
</ImportGroup>
108+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
109+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
110+
</ImportGroup>
111+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
112+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
113+
</ImportGroup>
114+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
115+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
116+
</ImportGroup>
117+
<PropertyGroup Label="UserMacros" />
118+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
119+
<LinkIncremental>false</LinkIncremental>
120+
<Linkage-secp256k1>static</Linkage-secp256k1>
121+
</PropertyGroup>
122+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
123+
<LinkIncremental>true</LinkIncremental>
124+
<Linkage-secp256k1>static</Linkage-secp256k1>
125+
</PropertyGroup>
126+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
127+
<LinkIncremental>true</LinkIncremental>
128+
<Linkage-secp256k1>static</Linkage-secp256k1>
129+
</PropertyGroup>
130+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
131+
<LinkIncremental>false</LinkIncremental>
132+
<Linkage-secp256k1>static</Linkage-secp256k1>
133+
</PropertyGroup>
134+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
135+
<ClCompile>
136+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
137+
<WarningLevel>Level3</WarningLevel>
138+
<Optimization>MaxSpeed</Optimization>
139+
<FunctionLevelLinking>true</FunctionLevelLinking>
140+
<IntrinsicFunctions>true</IntrinsicFunctions>
141+
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
142+
<SDLCheck>true</SDLCheck>
143+
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
144+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
145+
</ClCompile>
146+
<Link>
147+
<SubSystem>Console</SubSystem>
148+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
149+
<OptimizeReferences>true</OptimizeReferences>
150+
<GenerateDebugInformation>true</GenerateDebugInformation>
151+
<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>
152+
</Link>
153+
</ItemDefinitionGroup>
154+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
155+
<ClCompile>
156+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
157+
<WarningLevel>Level3</WarningLevel>
158+
<Optimization>Disabled</Optimization>
159+
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
160+
<SDLCheck>true</SDLCheck>
161+
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
162+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
163+
</ClCompile>
164+
<Link>
165+
<SubSystem>Console</SubSystem>
166+
<GenerateDebugInformation>true</GenerateDebugInformation>
167+
<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>
168+
</Link>
169+
</ItemDefinitionGroup>
170+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
171+
<ClCompile>
172+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
173+
<WarningLevel>Level3</WarningLevel>
174+
<Optimization>Disabled</Optimization>
175+
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
176+
<SDLCheck>true</SDLCheck>
177+
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
178+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
179+
</ClCompile>
180+
<Link>
181+
<SubSystem>Console</SubSystem>
182+
<GenerateDebugInformation>true</GenerateDebugInformation>
183+
<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>
184+
</Link>
185+
</ItemDefinitionGroup>
186+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
187+
<ClCompile>
188+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
189+
<WarningLevel>Level3</WarningLevel>
190+
<Optimization>MaxSpeed</Optimization>
191+
<FunctionLevelLinking>true</FunctionLevelLinking>
192+
<IntrinsicFunctions>true</IntrinsicFunctions>
193+
<PreprocessorDefinitions>NOMINMAX;HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
194+
<SDLCheck>true</SDLCheck>
195+
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
196+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
197+
</ClCompile>
198+
<Link>
199+
<SubSystem>Console</SubSystem>
200+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
201+
<OptimizeReferences>true</OptimizeReferences>
202+
<GenerateDebugInformation>true</GenerateDebugInformation>
203+
<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>
204+
</Link>
205+
</ItemDefinitionGroup>
206+
<Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild">
207+
<PropertyGroup>
208+
<ErrorText>There was an error executing the raw bench header generation task.</ErrorText>
209+
</PropertyGroup>
210+
<ItemGroup>
211+
<RawBenchFile Include="..\..\src\bench\data\*.raw" />
212+
</ItemGroup>
213+
<HeaderFromHexdump RawFilePath="%(RawBenchFile.FullPath)" HeaderFilePath="%(RawBenchFile.FullPath).h" SourceHeader="static unsigned const char %(RawBenchFile.Filename)[] = {" SourceFooter="};" />
214+
</Target>
215+
<Import Label="configTarget" Project="..\common.vcxproj" />
216+
<Import Label="hexdumpTarget" Project="..\msbuild\tasks\hexdump.targets" />
217+
</Project>

0 commit comments

Comments
 (0)