mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-10 11:33:46 +02:00
Cleaned up and consolidated msvc build files to allow faster builds and easier migration to vs2019.
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user