aboutsummaryrefslogtreecommitdiff
path: root/build_msvc
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-05 18:58:05 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-05 19:06:03 +0200
commitba0bf79a224d92e122f98fda94cb9f77092fea1f (patch)
tree80ecc773f3f39dc0d99d6e21b006e57038cf0ff9 /build_msvc
parent2391fb785063b8914738ef16dc8d9294ca251253 (diff)
build: Do not modify `common.init.vcxproj` directly
Diffstat (limited to 'build_msvc')
-rw-r--r--build_msvc/.gitignore1
-rw-r--r--build_msvc/common.init.vcxproj.in (renamed from build_msvc/common.init.vcxproj)4
-rwxr-xr-xbuild_msvc/msvc-autogen.py15
3 files changed, 7 insertions, 13 deletions
diff --git a/build_msvc/.gitignore b/build_msvc/.gitignore
index b0e557bc0c..b2eb9313a0 100644
--- a/build_msvc/.gitignore
+++ b/build_msvc/.gitignore
@@ -22,6 +22,7 @@ bench_bitcoin/bench_bitcoin.vcxproj
libtest_util/libtest_util.vcxproj
/bitcoin_config.h
+/common.init.vcxproj
*/Win32
libbitcoin_qt/QtGeneratedFiles/*
diff --git a/build_msvc/common.init.vcxproj b/build_msvc/common.init.vcxproj.in
index 0cbe2effd5..182efff233 100644
--- a/build_msvc/common.init.vcxproj
+++ b/build_msvc/common.init.vcxproj.in
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<LinkIncremental>false</LinkIncremental>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>@TOOLSET@</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<GenerateManifest>No</GenerateManifest>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
@@ -49,7 +49,7 @@
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<LinkIncremental>true</LinkIncremental>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>@TOOLSET@</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py
index ad705f733d..819fe1b7ae 100755
--- a/build_msvc/msvc-autogen.py
+++ b/build_msvc/msvc-autogen.py
@@ -50,13 +50,6 @@ 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 parse_config_into_btc_config():
def find_between( s, first, last ):
try:
@@ -99,11 +92,11 @@ def set_properties(vcxproj_filename, 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.'
+ parser.add_argument('-toolset', nargs='?', default=DEFAULT_PLATFORM_TOOLSET,
+ 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)
+ set_properties(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), '@TOOLSET@', args.toolset)
for makefile_name in os.listdir(SOURCE_DIR):
if 'Makefile' in makefile_name:
@@ -115,7 +108,7 @@ def main():
content += ' <ClCompile Include="..\\..\\src\\' + source_filename + '">\n'
content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n'
content += ' </ClCompile>\n'
- set_properties(vcxproj_filename, '@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'))