Merge #14062: build: generate MSVC project files via python script
0b16f679d5
auto generate MSVC project files (Chun Kuan Lee)
Pull request description:
The reason that I move from original `*.vcxproj` to template `*.vcxproj.in` file:
- There are many developers does not know how to edit .vcxproj file
- To keep consistency, don't need to edit file at two different places
Now the devs do not have to update two seperate files.
Tree-SHA512: ab06dbec588cab57f16c1993ea80ed25a49b0b129884634512a8bcd8a21a1a55d38636922489bcf9120d504cfc2cbe4d2b888a217c4e65a50555b41fcd3b7004
This commit is contained in:
commit
427253cf7e
11 changed files with 80 additions and 131 deletions
|
@ -6,6 +6,8 @@ platform: x64
|
||||||
environment:
|
environment:
|
||||||
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
||||||
cache: C:\tools\vcpkg\installed\
|
cache: C:\tools\vcpkg\installed\
|
||||||
|
init:
|
||||||
|
- cmd: set PATH=C:\Python36-x64;%PATH%
|
||||||
before_build:
|
before_build:
|
||||||
- ps: >-
|
- ps: >-
|
||||||
$packages = @(
|
$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
|
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"
|
Invoke-Expression -Command "vcpkg install $all_packages"
|
||||||
|
- cmd: python build_msvc\msvc-autogen.py
|
||||||
build:
|
build:
|
||||||
project: build_msvc\bitcoin.sln
|
project: build_msvc\bitcoin.sln
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
1
build_msvc/.gitignore
vendored
1
build_msvc/.gitignore
vendored
|
@ -8,3 +8,4 @@ packages/*
|
||||||
*/Release
|
*/Release
|
||||||
*/x64
|
*/x64
|
||||||
*.vcxproj.user
|
*.vcxproj.user
|
||||||
|
*.vcxproj
|
||||||
|
|
|
@ -47,4 +47,10 @@ The instructions below use vcpkg to install the dependencies.
|
||||||
leveldb:x64-windows-static
|
leveldb:x64-windows-static
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Use Python to generate *.vcxproj from Makefile
|
||||||
|
|
||||||
|
```
|
||||||
|
PS >python msvc-autogen.py
|
||||||
|
```
|
||||||
|
|
||||||
- Build in Visual Studio.
|
- Build in Visual Studio.
|
|
@ -20,7 +20,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\rpc\client.cpp" />
|
@SOURCE_FILES@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
|
@ -165,43 +165,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\base58.h" />
|
@SOURCE_FILES@
|
||||||
<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" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
|
@ -151,25 +151,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\crypto\aes.h" />
|
@SOURCE_FILES@
|
||||||
<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" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Label="configTarget" Project="..\common.vcxproj" />
|
<Import Label="configTarget" Project="..\common.vcxproj" />
|
||||||
</Project>
|
</Project>
|
|
@ -154,53 +154,13 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<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">
|
<ClCompile Include="..\..\src\rpc\net.cpp">
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\netrpc.obj</ObjectFileName>
|
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\netrpc.obj</ObjectFileName>
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|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)'=='Debug|x64'">$(IntDir)\netrpc.obj</ObjectFileName>
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)\netrpc.obj</ObjectFileName>
|
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)\netrpc.obj</ObjectFileName>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\rpc\rawtransaction.cpp" />
|
@SOURCE_FILES@
|
||||||
<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" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
|
@ -174,23 +174,7 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\chainparamsbase.cpp" />
|
@SOURCE_FILES@
|
||||||
<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" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Label="configTarget" Project="..\common.vcxproj" />
|
<Import Label="configTarget" Project="..\common.vcxproj" />
|
||||||
</Project>
|
</Project>
|
|
@ -20,18 +20,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\wallet\coinselection.cpp" />
|
@SOURCE_FILES@
|
||||||
<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" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
|
@ -20,10 +20,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\zmq\zmqabstractnotifier.cpp" />
|
@SOURCE_FILES@
|
||||||
<ClCompile Include="..\..\src\zmq\zmqnotificationinterface.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\zmq\zmqpublishnotifier.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\zmq\zmqrpc.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
63
build_msvc/msvc-autogen.py
Normal file
63
build_msvc/msvc-autogen.py
Normal 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()
|
Loading…
Reference in a new issue