Skip to content

Commit

Permalink
windows/msvc: Fix module freezing.
Browse files Browse the repository at this point in the history
Make this more generally useful and in line with what the mingw
and unix ports do: 16bit dig size to work on 32bit ports, a
self-contained qstrdefs.preprocessed.h because makemanifest.py
uses that, and a dev variant which effectively puts this to use:
previously the uasyncio module wasn't frozen but instead tests
ran by importing it from the extmod/ directory.
stijn authored and Damien George committed Feb 1, 2023
1 parent 7e9a159 commit 6abf03b
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ports/windows/.appveyor.yml
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ before_build:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<MsBuild BuildInParallel="True" Projects="mpy-cross\mpy-cross.vcxproj;ports\windows\micropython.vcxproj"/>
<MsBuild Projects="mpy-cross\mpy-cross.vcxproj;ports\windows\micropython.vcxproj"/>
</Target>
</Project>
"@ | Set-Content build.proj
6 changes: 4 additions & 2 deletions ports/windows/msvc/genhdr.targets
Original file line number Diff line number Diff line change
@@ -150,7 +150,9 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
<TmpFile>$(QstrGen).tmp</TmpFile>
</PropertyGroup>
<Exec Command="$(PyClTool) /nologo /I@(PyIncDirs, ' /I') /D@(PreProcDefs, ' /D') /E $(PyQstrDefs) $(QstrDefs) > $(DestDir)qstrdefs.preprocessed.h"/>
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdata.py $(DestDir)qstrdefs.preprocessed.h $(QstrDefsCollected) > $(TmpFile)"/>
<!--Because makemanifest.py relies on this file to have all Q() and QCFG() entries.-->
<Exec Command="type $(QstrDefsCollected) >> $(DestDir)qstrdefs.preprocessed.h"/>
<Exec Command="$(PyPython) $(PySrcDir)makeqstrdata.py $(DestDir)qstrdefs.preprocessed.h > $(TmpFile)"/>
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(QstrGen)"/>
</Target>

@@ -167,7 +169,7 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
<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>
<PreprocessorDefinitions>MICROPY_MODULE_FROZEN_MPY=1;MICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool;MPZ_DIG_SIZE=16;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<Exec Command="$(PyPython) $(PyBaseDir)tools\makemanifest.py -v MPY_DIR=$(PyBaseDir) -v MPY_LIB_DIR=$(PyBaseDir)/lib/micropython-lib -v PORT_DIR=$(PyWinDir) -o $(PyBuildDir)frozen_content.c -b $(PyBuildDir) $(FrozenManifest)"/>
3 changes: 3 additions & 0 deletions ports/windows/variants/dev/mpconfigvariant.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<FrozenManifest>$(PyVariantDir)manifest.py</FrozenManifest>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);MICROPY_ROM_TEXT_COMPRESSION=1</PreprocessorDefinitions>

0 comments on commit 6abf03b

Please sign in to comment.