@@ -50,13 +50,6 @@ def parse_makefile(makefile):
50
50
lib_sources [current_lib ] = []
51
51
break
52
52
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
-
60
53
def parse_config_into_btc_config ():
61
54
def find_between ( s , first , last ):
62
55
try :
@@ -99,11 +92,11 @@ def set_properties(vcxproj_filename, placeholder, content):
99
92
100
93
def main ():
101
94
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.'
103
97
' default is %s.' % DEFAULT_PLATFORM_TOOLSET )
104
98
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 )
107
100
108
101
for makefile_name in os .listdir (SOURCE_DIR ):
109
102
if 'Makefile' in makefile_name :
@@ -115,7 +108,7 @@ def main():
115
108
content += ' <ClCompile Include="..\\ ..\\ src\\ ' + source_filename + '">\n '
116
109
content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n '
117
110
content += ' </ClCompile>\n '
118
- set_properties (vcxproj_filename , '@SOURCE_FILES@\n ' , content ):
111
+ set_properties (vcxproj_filename , '@SOURCE_FILES@\n ' , content )
119
112
parse_config_into_btc_config ()
120
113
copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/bitcoin_config.h' ), os .path .join (SOURCE_DIR , 'config/bitcoin-config.h' ))
121
114
copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/libsecp256k1_config.h' ), os .path .join (SOURCE_DIR , 'secp256k1/src/libsecp256k1-config.h' ))
0 commit comments