Permalink
Browse files

Prevent recompiling every build due to Version.h splatting

  • Loading branch information...
x1nixmzeng committed Dec 7, 2017
1 parent 6d961d2 commit a72034b78a145fb1e41c7383b3f6a42a09a4ce7c
Showing with 23 additions and 5 deletions.
  1. +3 −0 .gitignore
  2. +20 −5 build/win32/Version.bat
View
@@ -107,3 +107,6 @@ src/Version.h
*.ipch
*.db-shm
*.db-wal
# Last known git hash
LAST_GIT_VERSION
View
@@ -1,6 +1,21 @@
@ECHO OFF
SET GIT_VERSION=
@echo off
git describe --always > GIT_VERSION
for /f "delims=" %%x in (GIT_VERSION) do set GIT_VERSION=%%x
ECHO #define _GIT_VERSION "%GIT_VERSION%" > "%~1"
del GIT_VERSION
@if not exist %~1 (
@goto update
)
@if exist LAST_GIT_VERSION (
fc GIT_VERSION LAST_GIT_VERSION > nul
@if errorlevel 1 goto update
@del GIT_VERSION
@goto eof
)
:update
@for /f "delims=" %%x in (GIT_VERSION) do set GIT_VERSION=%%x
@echo #define _GIT_VERSION "%GIT_VERSION%" > "%~1"
echo Updated %~1 with latest git revision number
@move /Y GIT_VERSION LAST_GIT_VERSION > nul
:eof

0 comments on commit a72034b

Please sign in to comment.