summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2015-04-22 12:03:52 +0200
committerstijn <stinos@zoho.com>2015-04-22 12:07:30 +0200
commitc52f1258a8ececbaf25331c6cbfc373e6ed133b4 (patch)
treeec0b31db214b478e91758549d244d1f25014616b
parentdea853d3a334ce5def51e803112d66b5dc8ecc3f (diff)
downloadmicropython-c52f1258a8ececbaf25331c6cbfc373e6ed133b4.tar.gz
micropython-c52f1258a8ececbaf25331c6cbfc373e6ed133b4.zip
msvc: Update genhdr script to emit MicroPython version numbers
-rw-r--r--windows/msvc/genhdr.targets12
1 files changed, 12 insertions, 0 deletions
diff --git a/windows/msvc/genhdr.targets b/windows/msvc/genhdr.targets
index 8001985b77..5d88394161 100644
--- a/windows/msvc/genhdr.targets
+++ b/windows/msvc/genhdr.targets
@@ -55,11 +55,23 @@
<DestFile>$(DestDir)py-version.h</DestFile>
<TmpFile>$(DestFile).tmp</TmpFile>
</PropertyGroup>
+ <PropertyGroup>
+ <Ver>$([System.Text.RegularExpressions.Regex]::Match($(GitTag), `^v[0-9\.]{5}`))</Ver>
+ <Ver Condition="'$(Ver)'==''">v0.0.1</Ver>
+ <Ver>$(Ver.Remove(0, 1))</Ver>
+ <VerMajor>$(Ver.Split(`.`)[0])</VerMajor>
+ <VerMinor>$(Ver.Split(`.`)[1])</VerMinor>
+ <VerMicro>$(Ver.Split(`.`)[2])</VerMicro>
+ </PropertyGroup>
<ItemGroup>
<Lines Include="// This file was generated by $([System.IO.Path]::GetFileName(`$(MsBuildThisFile)`))"/>
<Lines Include="#define MICROPY_GIT_TAG &quot;$(GitTag)&quot;"/>
<Lines Include="#define MICROPY_GIT_HASH &quot;$(GitHash)&quot;"/>
<Lines Include="#define MICROPY_BUILD_DATE &quot;$([System.DateTime]::Now.ToString(`yyyy-MM-dd`))&quot;"/>
+ <Lines Include="#define MICROPY_VERSION_MAJOR ($(VerMajor))"/>
+ <Lines Include="#define MICROPY_VERSION_MINOR ($(VerMinor))"/>
+ <Lines Include="#define MICROPY_VERSION_MICRO ($(VerMicro))"/>
+ <Lines Include="#define MICROPY_VERSION_STRING &quot;$(Ver)&quot;"/>
</ItemGroup>
<WriteLinesToFile Lines="@(Lines)" File="$(TmpFile)" Overwrite="true"/>
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(DestFile)"/>