8dec62a1a4
- Use a single file env.props for defining the main directories used when building.
env.props resolves the base directory and defines overridable output directories,
and is used by all other build files.
- Fix the build currently failing, basically because the preprocessing command for generating
qstrdefs uses different include directories than the build itself does.
(specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for #1022
in 51dfcb4
, so we need to use the base directory as include directory, not the py dir itself).
So define a single variable containing the include directories instead and use it where needed.
73 lines
3.3 KiB
XML
73 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="GenerateHeaders">
|
|
|
|
<Import Project="env.props" Condition="$(PyEnvIncluded)!=True"/>
|
|
|
|
<Target Name="GenerateHeaders" DependsOnTargets="MakeQstrData;MakeVersionHeader">
|
|
</Target>
|
|
|
|
<PropertyGroup>
|
|
<SrcDir>$(PyBaseDir)py\</SrcDir>
|
|
<DestDir>$(PyBuildDir)genhdr\</DestDir>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="MakeDestDir">
|
|
<MakeDir Directories="$(DestDir)"/>
|
|
</Target>
|
|
|
|
<!--see py/py.mk under #qstr data-->
|
|
<Target Name="MakeQstrData" DependsOnTargets="MakeDestDir">
|
|
<PropertyGroup>
|
|
<PreProc>$(DestDir)qstrdefs.preprocessed.h</PreProc>
|
|
<QstrDefs>$(PyBaseDir)unix\qstrdefsport.h</QstrDefs>
|
|
<DestFile>$(DestDir)qstrdefs.generated.h</DestFile>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PyIncDirs Include="$(PyIncDirs)"/>
|
|
</ItemGroup>
|
|
<Exec Command="cl /nologo /I@(PyIncDirs, ' /I') /Fi$(PreProc) /P $(SrcDir)qstrdefs.h"/>
|
|
<Exec Command="python $(SrcDir)makeqstrdata.py $(PreProc) $(QstrDefs) > $(DestFile).tmp"/>
|
|
<Exec Command="fc /B $(DestFile).tmp $(DestFile) > NUL 2>&1" IgnoreExitCode="true">
|
|
<Output TaskParameter="ExitCode" PropertyName="FilesDiffer" />
|
|
</Exec>
|
|
<Copy SourceFiles="$(DestFile).tmp" DestinationFiles="$(DestFile)" Condition="'$(FilesDiffer)'!='0'"/>
|
|
</Target>
|
|
|
|
<!--see py/py-version.sh-->
|
|
<Target Name="GetGitState">
|
|
<Exec Command="git describe --dirty --always" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitTag" />
|
|
</Exec>
|
|
<Exec Command="git rev-parse --short HEAD 2>NUL || echo unknown" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitHash" />
|
|
</Exec>
|
|
<Exec Command="git diff --no-ext-diff --quiet --exit-code 2>NUL || echo 0" ConsoleToMSBuild="true" IgnoreExitCode="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitFilesAreClean" />
|
|
</Exec>
|
|
<Exec Command="git diff-index --cached --quiet HEAD -- 2>NUL || echo 0" ConsoleToMSBuild="true" IgnoreExitCode="true" Condition="'$(GitFilesAreClean)'==''">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitFilesAreClean" />
|
|
</Exec>
|
|
</Target>
|
|
|
|
<Target Name="MakeVersionHeader" DependsOnTargets="MakeDestDir;GetGitState">
|
|
<PropertyGroup Condition="'$(GitFilesAreClean)'=='0'">
|
|
<GitHash>$(GitHash)-dirty</GitHash>
|
|
</PropertyGroup>
|
|
<PropertyGroup>
|
|
<DestFile>$(DestDir)py-version.h</DestFile>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<Lines Include="// This file was generated by $([System.IO.Path]::GetFileName(`$(MsBuildThisFile)`))"/>
|
|
<Lines Include="#define MICROPY_GIT_TAG "$(GitTag)""/>
|
|
<Lines Include="#define MICROPY_GIT_HASH "$(GitHash)""/>
|
|
<Lines Include="#define MICROPY_BUILD_DATE "$([System.DateTime]::Now.ToString(`yyyy-MM-dd`))""/>
|
|
</ItemGroup>
|
|
<WriteLinesToFile Lines="@(Lines)" File="$(DestFile).tmp" Overwrite="true"/>
|
|
<Exec Command="fc /B $(DestFile).tmp $(DestFile) > NUL 2>&1" IgnoreExitCode="true">
|
|
<Output TaskParameter="ExitCode" PropertyName="FilesDiffer" />
|
|
</Exec>
|
|
<Copy SourceFiles="$(DestFile).tmp" DestinationFiles="$(DestFile)" Condition="'$(FilesDiffer)'!='0'"/>
|
|
</Target>
|
|
|
|
</Project>
|