auto generate MSVC project files

This commit is contained in:
Chun Kuan Lee 2018-08-26 00:15:51 +08:00
parent 55c18a4530
commit 0b16f679d5
11 changed files with 80 additions and 131 deletions

View file

@ -6,6 +6,8 @@ platform: x64
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
cache: C:\tools\vcpkg\installed\
init:
- cmd: set PATH=C:\Python36-x64;%PATH%
before_build:
- ps: >-
$packages = @(
@ -28,6 +30,7 @@ before_build:
git -C C:\Tools\vcpkg pull # This is a temporary fix, can be removed after appveyor update its image to include Microsoft/vcpkg#4046
Invoke-Expression -Command "vcpkg install $all_packages"
- cmd: python build_msvc\msvc-autogen.py
build:
project: build_msvc\bitcoin.sln
parallel: true

View file

@ -8,3 +8,4 @@ packages/*
*/Release
*/x64
*.vcxproj.user
*.vcxproj

View file

@ -47,4 +47,10 @@ The instructions below use vcpkg to install the dependencies.
leveldb:x64-windows-static
```
- Use Python to generate *.vcxproj from Makefile
```
PS >python msvc-autogen.py
```
- Build in Visual Studio.

View file

@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\rpc\client.cpp" />
@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -165,43 +165,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\src\base58.h" />
<ClInclude Include="..\..\src\bech32.h" />
<ClInclude Include="..\..\src\chainparams.h" />
<ClInclude Include="..\..\src\coins.h" />
<ClInclude Include="..\..\src\compressor.h" />
<ClInclude Include="..\..\src\key.h" />
<ClInclude Include="..\..\src\keystore.h" />
<ClInclude Include="..\..\src\netaddress.h" />
<ClInclude Include="..\..\src\netbase.h" />
<ClInclude Include="..\..\src\policy\feerate.h" />
<ClInclude Include="..\..\src\protocol.h" />
<ClInclude Include="..\..\src\scheduler.h" />
<ClInclude Include="..\..\src\script\sign.h" />
<ClInclude Include="..\..\src\script\standard.h" />
<ClInclude Include="..\..\src\warnings.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\base58.cpp" />
<ClCompile Include="..\..\src\bech32.cpp" />
<ClCompile Include="..\..\src\chainparams.cpp" />
<ClCompile Include="..\..\src\coins.cpp" />
<ClCompile Include="..\..\src\compressor.cpp" />
<ClCompile Include="..\..\src\core_read.cpp" />
<ClCompile Include="..\..\src\core_write.cpp" />
<ClCompile Include="..\..\src\key.cpp" />
<ClCompile Include="..\..\src\key_io.cpp" />
<ClCompile Include="..\..\src\keystore.cpp" />
<ClCompile Include="..\..\src\netaddress.cpp" />
<ClCompile Include="..\..\src\netbase.cpp" />
<ClCompile Include="..\..\src\policy\feerate.cpp" />
<ClCompile Include="..\..\src\protocol.cpp" />
<ClCompile Include="..\..\src\scheduler.cpp" />
<ClCompile Include="..\..\src\script\descriptor.cpp" />
<ClCompile Include="..\..\src\script\sign.cpp" />
<ClCompile Include="..\..\src\script\ismine.cpp" />
<ClCompile Include="..\..\src\script\standard.cpp" />
<ClCompile Include="..\..\src\warnings.cpp" />
@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -151,25 +151,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\src\crypto\aes.h" />
<ClInclude Include="..\..\src\crypto\chacha20.h" />
<ClInclude Include="..\..\src\crypto\common.h" />
<ClInclude Include="..\..\src\crypto\hmac_sha256.h" />
<ClInclude Include="..\..\src\crypto\hmac_sha512.h" />
<ClInclude Include="..\..\src\crypto\ripemd160.h" />
<ClInclude Include="..\..\src\crypto\sha1.h" />
<ClInclude Include="..\..\src\crypto\sha256.h" />
<ClInclude Include="..\..\src\crypto\sha512.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\crypto\aes.cpp" />
<ClCompile Include="..\..\src\crypto\chacha20.cpp" />
<ClCompile Include="..\..\src\crypto\hmac_sha256.cpp" />
<ClCompile Include="..\..\src\crypto\hmac_sha512.cpp" />
<ClCompile Include="..\..\src\crypto\ripemd160.cpp" />
<ClCompile Include="..\..\src\crypto\sha1.cpp" />
<ClCompile Include="..\..\src\crypto\sha256.cpp" />
<ClCompile Include="..\..\src\crypto\sha512.cpp" />
@SOURCE_FILES@
</ItemGroup>
<Import Label="configTarget" Project="..\common.vcxproj" />
</Project>

View file

@ -154,53 +154,13 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\addrdb.cpp" />
<ClCompile Include="..\..\src\addrman.cpp" />
<ClCompile Include="..\..\src\blockencodings.cpp" />
<ClCompile Include="..\..\src\bloom.cpp" />
<ClCompile Include="..\..\src\chain.cpp" />
<ClCompile Include="..\..\src\checkpoints.cpp" />
<ClCompile Include="..\..\src\consensus\tx_verify.cpp" />
<ClCompile Include="..\..\src\dbwrapper.cpp" />
<ClCompile Include="..\..\src\httprpc.cpp" />
<ClCompile Include="..\..\src\httpserver.cpp" />
<ClCompile Include="..\..\src\index\base.cpp" />
<ClCompile Include="..\..\src\init.cpp" />
<ClCompile Include="..\..\src\merkleblock.cpp" />
<ClCompile Include="..\..\src\miner.cpp" />
<ClCompile Include="..\..\src\net.cpp" />
<ClCompile Include="..\..\src\net_processing.cpp" />
<ClCompile Include="..\..\src\noui.cpp" />
<ClCompile Include="..\..\src\outputtype.cpp" />
<ClCompile Include="..\..\src\policy\fees.cpp" />
<ClCompile Include="..\..\src\policy\policy.cpp" />
<ClCompile Include="..\..\src\policy\rbf.cpp" />
<ClCompile Include="..\..\src\pow.cpp" />
<ClCompile Include="..\..\src\rest.cpp" />
<ClCompile Include="..\..\src\shutdown.cpp" />
<ClCompile Include="..\..\src\rpc\blockchain.cpp" />
<ClCompile Include="..\..\src\rpc\mining.cpp" />
<ClCompile Include="..\..\src\rpc\misc.cpp" />
<ClCompile Include="..\..\src\rpc\net.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\netrpc.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\netrpc.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)\netrpc.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)\netrpc.obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\rpc\rawtransaction.cpp" />
<ClCompile Include="..\..\src\rpc\server.cpp" />
<ClCompile Include="..\..\src\rpc\util.cpp" />
<ClCompile Include="..\..\src\script\ismine.cpp" />
<ClCompile Include="..\..\src\script\sigcache.cpp" />
<ClCompile Include="..\..\src\timedata.cpp" />
<ClCompile Include="..\..\src\torcontrol.cpp" />
<ClCompile Include="..\..\src\txdb.cpp" />
<ClCompile Include="..\..\src\txmempool.cpp" />
<ClCompile Include="..\..\src\ui_interface.cpp" />
<ClCompile Include="..\..\src\validation.cpp" />
<ClCompile Include="..\..\src\validationinterface.cpp" />
<ClCompile Include="..\..\src\versionbits.cpp" />
<ClCompile Include="..\..\src\index\txindex.cpp" />
@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -174,23 +174,7 @@
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\chainparamsbase.cpp" />
<ClCompile Include="..\..\src\clientversion.cpp" />
<ClCompile Include="..\..\src\compat\glibcxx_sanity.cpp" />
<ClCompile Include="..\..\src\compat\glibc_sanity.cpp" />
<ClCompile Include="..\..\src\compat\strnlen.cpp" />
<ClCompile Include="..\..\src\fs.cpp" />
<ClCompile Include="..\..\src\logging.cpp" />
<ClCompile Include="..\..\src\random.cpp" />
<ClCompile Include="..\..\src\rpc\protocol.cpp" />
<ClCompile Include="..\..\src\support\cleanse.cpp" />
<ClCompile Include="..\..\src\support\lockedpool.cpp" />
<ClCompile Include="..\..\src\sync.cpp" />
<ClCompile Include="..\..\src\threadinterrupt.cpp" />
<ClCompile Include="..\..\src\util.cpp" />
<ClCompile Include="..\..\src\utilmoneystr.cpp" />
<ClCompile Include="..\..\src\utilstrencodings.cpp" />
<ClCompile Include="..\..\src\utiltime.cpp" />
@SOURCE_FILES@
</ItemGroup>
<Import Label="configTarget" Project="..\common.vcxproj" />
</Project>

View file

@ -20,18 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\wallet\coinselection.cpp" />
<ClCompile Include="..\..\src\wallet\coincontrol.cpp" />
<ClCompile Include="..\..\src\wallet\crypter.cpp" />
<ClCompile Include="..\..\src\wallet\db.cpp" />
<ClCompile Include="..\..\src\wallet\feebumper.cpp" />
<ClCompile Include="..\..\src\wallet\fees.cpp" />
<ClCompile Include="..\..\src\wallet\init.cpp" />
<ClCompile Include="..\..\src\wallet\rpcdump.cpp" />
<ClCompile Include="..\..\src\wallet\rpcwallet.cpp" />
<ClCompile Include="..\..\src\wallet\wallet.cpp" />
<ClCompile Include="..\..\src\wallet\walletdb.cpp" />
<ClCompile Include="..\..\src\wallet\walletutil.cpp" />
@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -20,10 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\zmq\zmqabstractnotifier.cpp" />
<ClCompile Include="..\..\src\zmq\zmqnotificationinterface.cpp" />
<ClCompile Include="..\..\src\zmq\zmqpublishnotifier.cpp" />
<ClCompile Include="..\..\src\zmq\zmqrpc.cpp" />
@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -0,0 +1,63 @@
#!/usr/bin/env python3
import os
import re
SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))
libs = [
'libbitcoin_cli',
'libbitcoin_common',
'libbitcoin_crypto',
'libbitcoin_server',
'libbitcoin_util',
'libbitcoin_wallet',
'libbitcoin_zmq',
]
ignore_list = [
'rpc/net.cpp',
'interfaces/handler.cpp',
'interfaces/node.cpp',
'interfaces/wallet.cpp',
]
lib_sources = {}
def parse_makefile(makefile):
with open(makefile, 'r', encoding='utf-8') as file:
current_lib = ''
for line in file.read().splitlines():
if current_lib:
source = line.split()[0]
if source.endswith('.cpp') and not source.startswith('$') and source not in ignore_list:
lib_sources[current_lib].append(source.replace('/', '\\'))
if not line.endswith('\\'):
current_lib = ''
continue
for lib in libs:
_lib = lib.replace('-', '_')
if re.search(_lib + '.*_SOURCES \\= \\\\', line):
current_lib = lib
lib_sources[current_lib] = []
break
def main():
for makefile_name in os.listdir(SOURCE_DIR):
if 'Makefile' in makefile_name:
parse_makefile(os.path.join(SOURCE_DIR, makefile_name))
for key, value in lib_sources.items():
vcxproj_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), key, key + '.vcxproj'))
content = ''
for source_filename in value:
content += ' <ClCompile Include="..\\..\\src\\' + source_filename + '" />\n'
with open(vcxproj_filename + '.in', 'r', encoding='utf-8') as vcxproj_in_file:
with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file:
vcxproj_file.write(vcxproj_in_file.read().replace(
'@SOURCE_FILES@\n', content))
if __name__ == '__main__':
main()