aboutsummaryrefslogtreecommitdiff
path: root/build_msvc/msvc-autogen.py
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-05 18:38:22 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-05 18:38:22 +0200
commit2391fb785063b8914738ef16dc8d9294ca251253 (patch)
treefca45efa3b8c9277c62484c8ab42e7b3b4d6a3d8 /build_msvc/msvc-autogen.py
parent9ce1c506a3a5d20b1bf254235bfae48af592d86c (diff)
build, refactor: Add set_properties() to msvc-autogen.py
Diffstat (limited to 'build_msvc/msvc-autogen.py')
-rwxr-xr-xbuild_msvc/msvc-autogen.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py
index 2a70cd9332..ad705f733d 100755
--- a/build_msvc/msvc-autogen.py
+++ b/build_msvc/msvc-autogen.py
@@ -92,6 +92,11 @@ def parse_config_into_btc_config():
with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), "w", encoding="utf8") as btc_config:
btc_config.writelines(template)
+def set_properties(vcxproj_filename, placeholder, content):
+ with open(vcxproj_filename + '.in', 'r', encoding='utf-8') as vcxproj_in_file:
+ with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file:
+ vcxproj_file.write(vcxproj_in_file.read().replace(placeholder, content))
+
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.'
@@ -110,10 +115,7 @@ def main():
content += ' <ClCompile Include="..\\..\\src\\' + source_filename + '">\n'
content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n'
content += ' </ClCompile>\n'
- with open(vcxproj_filename + '.in', 'r', encoding='utf-8') as vcxproj_in_file:
- with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file:
- vcxproj_file.write(vcxproj_in_file.read().replace(
- '@SOURCE_FILES@\n', content))
+ set_properties(vcxproj_filename, '@SOURCE_FILES@\n', content):
parse_config_into_btc_config()
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'))