aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-08-26 12:40:38 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-08-26 12:40:46 -0400
commit427253cf7e19ed9ef86b45457de41e345676c88e (patch)
tree985b5ec638df3946d7f1219790e43ade6a60cc38
parentc775dc4a94ef1a90afa03269cba80398901bea17 (diff)
parent0b16f679d519370be9d2c10fb7e8f169770e5d29 (diff)
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
-rw-r--r--appveyor.yml3
-rw-r--r--build_msvc/.gitignore1
-rw-r--r--build_msvc/README.md6
-rw-r--r--build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj.in (renamed from build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj)2
-rw-r--r--build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in (renamed from build_msvc/libbitcoin_common/libbitcoin_common.vcxproj)38
-rw-r--r--build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj.in (renamed from build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj)20
-rw-r--r--build_msvc/libbitcoin_server/libbitcoin_server.vcxproj.in (renamed from build_msvc/libbitcoin_server/libbitcoin_server.vcxproj)42
-rw-r--r--build_msvc/libbitcoin_util/libbitcoin_util.vcxproj.in (renamed from build_msvc/libbitcoin_util/libbitcoin_util.vcxproj)18
-rw-r--r--build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj.in (renamed from build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj)13
-rw-r--r--build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj.in (renamed from build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj)5
-rw-r--r--build_msvc/msvc-autogen.py63
11 files changed, 80 insertions, 131 deletions
diff --git a/appveyor.yml b/appveyor.yml
index c6a5a91ba5..85b1a999d1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -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
diff --git a/build_msvc/.gitignore b/build_msvc/.gitignore
index fbcd1077b3..d5aa22c05e 100644
--- a/build_msvc/.gitignore
+++ b/build_msvc/.gitignore
@@ -8,3 +8,4 @@ packages/*
*/Release
*/x64
*.vcxproj.user
+*.vcxproj
diff --git a/build_msvc/README.md b/build_msvc/README.md
index 6de464e92f..5fb08df8d7 100644
--- a/build_msvc/README.md
+++ b/build_msvc/README.md
@@ -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. \ No newline at end of file
diff --git a/build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj b/build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj.in
index 623d24da10..b7265054fb 100644
--- a/build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj
+++ b/build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj.in
@@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\src\rpc\client.cpp" />
+@SOURCE_FILES@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
diff --git a/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj b/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in
index e6d95ed5f3..42145c15ad 100644
--- a/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj
+++ b/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in
@@ -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" />
diff --git a/build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj b/build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj.in
index 50519d045f..a05125723a 100644
--- a/build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj
+++ b/build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj.in
@@ -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>
diff --git a/build_msvc/libbitcoin_server/libbitcoin_server.vcxproj b/build_msvc/libbitcoin_server/libbitcoin_server.vcxproj.in
index 9d4ac1a7f7..0a165d0b75 100644
--- a/build_msvc/libbitcoin_server/libbitcoin_server.vcxproj
+++ b/build_msvc/libbitcoin_server/libbitcoin_server.vcxproj.in
@@ -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" />
diff --git a/build_msvc/libbitcoin_util/libbitcoin_util.vcxproj b/build_msvc/libbitcoin_util/libbitcoin_util.vcxproj.in
index 9e960682e5..dc17c98e98 100644
--- a/build_msvc/libbitcoin_util/libbitcoin_util.vcxproj
+++ b/build_msvc/libbitcoin_util/libbitcoin_util.vcxproj.in
@@ -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>
diff --git a/build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj b/build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj.in
index 64f3e16289..1bb7be6f7f 100644
--- a/build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj
+++ b/build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj.in
@@ -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" />
diff --git a/build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj b/build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj.in
index d7fbdd94b7..e396c1ad0c 100644
--- a/build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj
+++ b/build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj.in
@@ -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" />
diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py
new file mode 100644
index 0000000000..8888487e75
--- /dev/null
+++ b/build_msvc/msvc-autogen.py
@@ -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()