Commit db9c2e31 authored by stijn's avatar stijn Committed by Paul Sokolovsky
Browse files

msvc: Rebuild all qstrs when mpconfig headers are modified

Make qstr generation depend on modifications in mpconfigport.h, mpconfig.h
and makeqstrdata.py and if any of those change scan all source files for
qstrs again since they might have changed (for example typcially when
enabling new features in mpconfig.h).
This fixes #2982 for msvc builds.
parent 8d865fa7
...@@ -43,8 +43,13 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) { ...@@ -43,8 +43,13 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
</Task> </Task>
</UsingTask> </UsingTask>
<!-- If any of these changed we'll force all qstrs to be generated again-->
<ItemGroup>
<QstrDependencies Include="$(PyWinDir)mpconfigport.h;$(PySrcDir)mpconfig.h;$(PySrcDir)makeqstrdata.py"/>
</ItemGroup>
<!-- Preprocess changed files, concatenate and feed into makeqstrdefs.py split/cat--> <!-- Preprocess changed files, concatenate and feed into makeqstrdefs.py split/cat-->
<Target Name="MakeQstrDefs" DependsOnTargets="MakeDestDir" Inputs="@(ClCompile)" Outputs="$(QstrDefsCollected)"> <Target Name="MakeQstrDefs" DependsOnTargets="MakeDestDir" Inputs="@(ClCompile);@(QstrDependencies)" Outputs="$(QstrDefsCollected)">
<ItemGroup> <ItemGroup>
<PyIncDirs Include="$(PyIncDirs)"/> <PyIncDirs Include="$(PyIncDirs)"/>
<PreProcDefs Include="%(ClCompile.PreProcessorDefinitions);NO_QSTR;N_X64;N_X86;N_THUMB;N_ARM"/> <PreProcDefs Include="%(ClCompile.PreProcessorDefinitions);NO_QSTR;N_X64;N_X86;N_THUMB;N_ARM"/>
...@@ -56,15 +61,21 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) { ...@@ -56,15 +61,21 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
<OutDir>$([System.IO.Path]::GetDirectoryName('%(OutFile)'))</OutDir> <OutDir>$([System.IO.Path]::GetDirectoryName('%(OutFile)'))</OutDir>
</PyQstrSourceFiles> </PyQstrSourceFiles>
<PyQstrSourceFiles> <PyQstrSourceFiles>
<Changed>$([System.DateTime]::Compare($([System.IO.File]::GetLastWriteTime('%(FullPath)')), $([System.IO.File]::GetLastWriteTime('%(OutFile)'))))</Changed> <Changed Condition="$([System.DateTime]::Compare($([System.IO.File]::GetLastWriteTime('%(FullPath)')), $([System.IO.File]::GetLastWriteTime('%(OutFile)')))) &gt; 0">True</Changed>
</PyQstrSourceFiles> </PyQstrSourceFiles>
<QstrDependencies>
<Changed Condition="$([System.DateTime]::Compare($([System.IO.File]::GetLastWriteTime('%(FullPath)')), $([System.IO.File]::GetLastWriteTime('$(DestDir)qstr.i.last')))) &gt; 0">True</Changed>
</QstrDependencies>
</ItemGroup> </ItemGroup>
<PropertyGroup>
<ForceQstrRebuild>@(QstrDependencies->AnyHaveMetadataValue('Changed', 'True'))</ForceQstrRebuild>
</PropertyGroup>
<MakeDir Directories="@(PyQstrSourceFiles->'%(OutDir)')"/> <MakeDir Directories="@(PyQstrSourceFiles->'%(OutDir)')"/>
<Exec Command="cl /nologo /I@(PyIncDirs, ' /I') /D@(PreProcDefs, ' /D') /Fi%(PyQstrSourceFiles.OutFile) /P %(PyQstrSourceFiles.Identity)" <Exec Command="cl /nologo /I@(PyIncDirs, ' /I') /D@(PreProcDefs, ' /D') /Fi%(PyQstrSourceFiles.OutFile) /P %(PyQstrSourceFiles.Identity)"
Condition="%(PyQstrSourceFiles.Changed) &gt; 0"/> Condition="'%(PyQstrSourceFiles.Changed)' == 'True' Or '$(ForceQstrRebuild)' == 'True'"/>
<ConcatPreProcFiles InputFiles="@(PyQstrSourceFiles->'%(OutFile)')" OutputFile="$(DestDir)qstr.i.last" <ConcatPreProcFiles InputFiles="@(PyQstrSourceFiles->'%(OutFile)')" OutputFile="$(DestDir)qstr.i.last"
Condition="%(PyQstrSourceFiles.Changed) &gt; 0"/> Condition="@(PyQstrSourceFiles->AnyHaveMetadataValue('Changed', 'True')) Or '$(ForceQstrRebuild)' == 'True'"/>
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdefs.py split $(DestDir)qstr.i.last $(DestDir)qstr $(QstrDefsCollected)"/> <Exec Command="$(PyPython) $(PySrcDir)makeqstrdefs.py split $(DestDir)qstr.i.last $(DestDir)qstr $(QstrDefsCollected)"/>
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdefs.py cat $(DestDir)qstr.i.last $(DestDir)qstr $(QstrDefsCollected)"/> <Exec Command="$(PyPython) $(PySrcDir)makeqstrdefs.py cat $(DestDir)qstr.i.last $(DestDir)qstr $(QstrDefsCollected)"/>
</Target> </Target>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment