aboutsummaryrefslogtreecommitdiff
path: root/build_msvc/msvc-autogen.py
diff options
context:
space:
mode:
authorAaron Clauson <aaron@sipsorcery.com>2019-06-19 09:20:20 +0200
committerAaron Clauson <aaron@sipsorcery.com>2019-06-19 09:20:20 +0200
commit750d1bc7df5ec6505a8fb92dabface887c23817c (patch)
tree990b69c0731984b2882dc0c4d2ebc91ed1f1d3c1 /build_msvc/msvc-autogen.py
parent0b68fca700713e8e4c843c982b6047dc04410bc0 (diff)
downloadbitcoin-750d1bc7df5ec6505a8fb92dabface887c23817c.tar.xz
Cleaned up and consolidated msvc build files to allow faster builds and easier migration to vs2019.
Diffstat (limited to 'build_msvc/msvc-autogen.py')
-rw-r--r--build_msvc/msvc-autogen.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py
index c8df29eecb..b612467bf3 100644
--- a/build_msvc/msvc-autogen.py
+++ b/build_msvc/msvc-autogen.py
@@ -2,8 +2,11 @@
import os
import re
+import argparse
+from shutil import copyfile
SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))
+DEFAULT_PLATFORM_TOOLSET = R'v141'
libs = [
'libbitcoin_cli',
@@ -42,8 +45,21 @@ def parse_makefile(makefile):
lib_sources[current_lib] = []
break
+def set_common_properties(toolset):
+ with open(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), 'r', encoding='utf-8') as rfile:
+ s = rfile.read()
+ s = re.sub('<PlatformToolset>.*?</PlatformToolset>', '<PlatformToolset>'+toolset+'</PlatformToolset>', s)
+ with open(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), 'w', encoding='utf-8',newline='\n') as wfile:
+ wfile.write(s)
def main():
+ parser = argparse.ArgumentParser(description='Bitcoin-core msbuild configuration initialiser.')
+ parser.add_argument('-toolset', nargs='?',help='Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.'
+ ' default is %s.'%DEFAULT_PLATFORM_TOOLSET)
+ args = parser.parse_args()
+ if args.toolset:
+ set_common_properties(args.toolset)
+
for makefile_name in os.listdir(SOURCE_DIR):
if 'Makefile' in makefile_name:
parse_makefile(os.path.join(SOURCE_DIR, makefile_name))
@@ -58,7 +74,8 @@ def main():
with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file:
vcxproj_file.write(vcxproj_in_file.read().replace(
'@SOURCE_FILES@\n', content))
-
+ copyfile(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), os.path.join(SOURCE_DIR, 'config/bitcoin-config.h'))
+ copyfile(os.path.join(SOURCE_DIR,'../build_msvc/libsecp256k1_config.h'), os.path.join(SOURCE_DIR, 'secp256k1/src/libsecp256k1-config.h'))
if __name__ == '__main__':
main()