Skip to content

Commit ba0bf79

Browse files
committed
build: Do not modify common.init.vcxproj directly
1 parent 2391fb7 commit ba0bf79

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

build_msvc/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ bench_bitcoin/bench_bitcoin.vcxproj
2222
libtest_util/libtest_util.vcxproj
2323

2424
/bitcoin_config.h
25+
/common.init.vcxproj
2526

2627
*/Win32
2728
libbitcoin_qt/QtGeneratedFiles/*

build_msvc/common.init.vcxproj renamed to build_msvc/common.init.vcxproj.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
4040
<LinkIncremental>false</LinkIncremental>
4141
<UseDebugLibraries>false</UseDebugLibraries>
42-
<PlatformToolset>v142</PlatformToolset>
42+
<PlatformToolset>@TOOLSET@</PlatformToolset>
4343
<CharacterSet>Unicode</CharacterSet>
4444
<GenerateManifest>No</GenerateManifest>
4545
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
@@ -49,7 +49,7 @@
4949
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
5050
<LinkIncremental>true</LinkIncremental>
5151
<UseDebugLibraries>true</UseDebugLibraries>
52-
<PlatformToolset>v142</PlatformToolset>
52+
<PlatformToolset>@TOOLSET@</PlatformToolset>
5353
<CharacterSet>Unicode</CharacterSet>
5454
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
5555
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>

build_msvc/msvc-autogen.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -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-
6053
def 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

10093
def 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

Comments
 (0)