@@ -50,13 +50,6 @@ def parse_makefile(makefile):
5050 lib_sources [current_lib ] = []
5151 break
5252
53- def set_common_properties (toolset ):
54- with open (os .path .join (SOURCE_DIR , '../build_msvc/common.init.vcxproj' ), 'r' , encoding = 'utf-8' ) as rfile :
55- s = rfile .read ()
56- s = re .sub ('<PlatformToolset>.*?</PlatformToolset>' , '<PlatformToolset>' + toolset + '</PlatformToolset>' , s )
57- with open (os .path .join (SOURCE_DIR , '../build_msvc/common.init.vcxproj' ), 'w' , encoding = 'utf-8' ,newline = '\n ' ) as wfile :
58- wfile .write (s )
59-
6053def parse_config_into_btc_config ():
6154 def find_between ( s , first , last ):
6255 try :
@@ -99,11 +92,11 @@ def set_properties(vcxproj_filename, placeholder, content):
9992
10093def main ():
10194 parser = argparse .ArgumentParser (description = 'Bitcoin-core msbuild configuration initialiser.' )
102- parser .add_argument ('-toolset' , nargs = '?' ,help = 'Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.'
95+ parser .add_argument ('-toolset' , nargs = '?' , default = DEFAULT_PLATFORM_TOOLSET ,
96+ help = 'Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.'
10397 ' default is %s.' % DEFAULT_PLATFORM_TOOLSET )
10498 args = parser .parse_args ()
105- if args .toolset :
106- set_common_properties (args .toolset )
99+ set_properties (os .path .join (SOURCE_DIR , '../build_msvc/common.init.vcxproj' ), '@TOOLSET@' , args .toolset )
107100
108101 for makefile_name in os .listdir (SOURCE_DIR ):
109102 if 'Makefile' in makefile_name :
@@ -115,7 +108,7 @@ def main():
115108 content += ' <ClCompile Include="..\\ ..\\ src\\ ' + source_filename + '">\n '
116109 content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n '
117110 content += ' </ClCompile>\n '
118- set_properties (vcxproj_filename , '@SOURCE_FILES@\n ' , content ):
111+ set_properties (vcxproj_filename , '@SOURCE_FILES@\n ' , content )
119112 parse_config_into_btc_config ()
120113 copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/bitcoin_config.h' ), os .path .join (SOURCE_DIR , 'config/bitcoin-config.h' ))
121114 copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/libsecp256k1_config.h' ), os .path .join (SOURCE_DIR , 'secp256k1/src/libsecp256k1-config.h' ))
0 commit comments