windows/msvc: Support freezing modules.
Support freezing modules via manifest.py for consistency with the other ports. In essence this comes down to calling makemanifest.py and adding the resulting .c file to the build. Note the file with preprocessed qstrs has been renamed to match what makemanifest.py expects and which is also the name all other ports use.
This commit is contained in:
parent
4b35aa5730
commit
2a9ea69fa9
@ -104,7 +104,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="msvc/genhdr.targets" />
|
<Import Project="msvc/genhdr.targets" />
|
||||||
<Import Project="$(CustomPropsFile)" Condition="exists('$(CustomPropsFile)')" />
|
<Import Project="$(CustomPropsFile)" Condition="exists('$(CustomPropsFile)')" />
|
||||||
<Target Name="GenHeaders" BeforeTargets="BuildGenerateSources" DependsOnTargets="GenerateHeaders">
|
<Target Name="GenerateMicroPythonSources" BeforeTargets="BuildGenerateSources" DependsOnTargets="GenerateHeaders;FreezeModules">
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -55,7 +55,7 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PyIncDirs Include="$(PyIncDirs)"/>
|
<PyIncDirs Include="$(PyIncDirs)"/>
|
||||||
<PreProcDefs Include="%(ClCompile.PreProcessorDefinitions);NO_QSTR"/>
|
<PreProcDefs Include="%(ClCompile.PreProcessorDefinitions);NO_QSTR"/>
|
||||||
<PyQstrSourceFiles Include="@(ClCompile)">
|
<PyQstrSourceFiles Include="@(ClCompile)" Exclude="$(PyBuildDir)\frozen_content.c">
|
||||||
<OutFile>$([System.String]::new('%(FullPath)').Replace('$(PyBaseDir)', '$(DestDir)qstr\'))</OutFile>
|
<OutFile>$([System.String]::new('%(FullPath)').Replace('$(PyBaseDir)', '$(DestDir)qstr\'))</OutFile>
|
||||||
</PyQstrSourceFiles>
|
</PyQstrSourceFiles>
|
||||||
<PyQstrSourceFiles>
|
<PyQstrSourceFiles>
|
||||||
@ -101,8 +101,8 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TmpFile>$(QstrGen).tmp</TmpFile>
|
<TmpFile>$(QstrGen).tmp</TmpFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Exec Command="$(PyClTool) /nologo /I@(PyIncDirs, ' /I') /D@(PreProcDefs, ' /D') /E $(PyQstrDefs) $(QstrDefs) > $(DestDir)qstrdefspreprocessed.h"/>
|
<Exec Command="$(PyClTool) /nologo /I@(PyIncDirs, ' /I') /D@(PreProcDefs, ' /D') /E $(PyQstrDefs) $(QstrDefs) > $(DestDir)qstrdefs.preprocessed.h"/>
|
||||||
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdata.py $(DestDir)qstrdefspreprocessed.h $(QstrDefsCollected) > $(TmpFile)"/>
|
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdata.py $(DestDir)qstrdefs.preprocessed.h $(QstrDefsCollected) > $(TmpFile)"/>
|
||||||
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(QstrGen)"/>
|
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(QstrGen)"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
@ -115,6 +115,17 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
|
|||||||
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(DestFile)"/>
|
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(DestFile)"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="FreezeModules" Condition="'$(FrozenManifest)' != ''" DependsOnTargets="MakeQstrData" Inputs="$(FrozenManifest)" Outputs="$(PyBuildDir)frozen_content.c">
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="$(PyBuildDir)frozen_content.c"/>
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>MICROPY_MODULE_FROZEN_MPY=1;MICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Exec Command="$(PyPython) $(PyBaseDir)tools\makemanifest.py -v MPY_DIR=$(PyBaseDir) -v MPY_LIB_DIR=$(PyBaseDir)../micropython-lib -v PORT_DIR=$(PyWinDir) -f"-mcache-lookup-bc" -o $(PyBuildDir)frozen_content.c -b $(PyBuildDir) $(FrozenManifest)"/>
|
||||||
|
<WriteLinesToFile File="$(TLogLocation)frozen.read.1.tlog" Lines="$(FrozenManifest)" Overwrite="True"/>
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="RemoveGeneratedFiles" AfterTargets="Clean">
|
<Target Name="RemoveGeneratedFiles" AfterTargets="Clean">
|
||||||
<RemoveDir Directories="$(DestDir)"/>
|
<RemoveDir Directories="$(DestDir)"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user