@@ -92,6 +92,11 @@ def find_between( s, first, last ):
92
92
with open (os .path .join (SOURCE_DIR ,'../build_msvc/bitcoin_config.h' ), "w" , encoding = "utf8" ) as btc_config :
93
93
btc_config .writelines (template )
94
94
95
+ def set_properties (vcxproj_filename , placeholder , content ):
96
+ with open (vcxproj_filename + '.in' , 'r' , encoding = 'utf-8' ) as vcxproj_in_file :
97
+ with open (vcxproj_filename , 'w' , encoding = 'utf-8' ) as vcxproj_file :
98
+ vcxproj_file .write (vcxproj_in_file .read ().replace (placeholder , content ))
99
+
95
100
def main ():
96
101
parser = argparse .ArgumentParser (description = 'Bitcoin-core msbuild configuration initialiser.' )
97
102
parser .add_argument ('-toolset' , nargs = '?' ,help = 'Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.'
@@ -110,10 +115,7 @@ def main():
110
115
content += ' <ClCompile Include="..\\ ..\\ src\\ ' + source_filename + '">\n '
111
116
content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n '
112
117
content += ' </ClCompile>\n '
113
- with open (vcxproj_filename + '.in' , 'r' , encoding = 'utf-8' ) as vcxproj_in_file :
114
- with open (vcxproj_filename , 'w' , encoding = 'utf-8' ) as vcxproj_file :
115
- vcxproj_file .write (vcxproj_in_file .read ().replace (
116
- '@SOURCE_FILES@\n ' , content ))
118
+ set_properties (vcxproj_filename , '@SOURCE_FILES@\n ' , content ):
117
119
parse_config_into_btc_config ()
118
120
copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/bitcoin_config.h' ), os .path .join (SOURCE_DIR , 'config/bitcoin-config.h' ))
119
121
copyfile (os .path .join (SOURCE_DIR ,'../build_msvc/libsecp256k1_config.h' ), os .path .join (SOURCE_DIR , 'secp256k1/src/libsecp256k1-config.h' ))
0 commit comments