summaryrefslogtreecommitdiff
path: root/printHash.bat
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-02-12 01:49:09 +0300
committererorcun <erorcunerorcun@hotmail.com.tr>2021-02-12 21:09:23 +0300
commit2c784d979a88035176082edf986a2c02b9073338 (patch)
treec44455912d2de60f4c0381c035d44b997c525cbc /printHash.bat
parente98164ec41c3629c592bb31d8b110d85626c5e3c (diff)
Remove version text, add toggleable debug info(with commit hash!)
Diffstat (limited to 'printHash.bat')
-rw-r--r--printHash.bat26
1 files changed, 26 insertions, 0 deletions
diff --git a/printHash.bat b/printHash.bat
new file mode 100644
index 00000000..ef1cd9d6
--- /dev/null
+++ b/printHash.bat
@@ -0,0 +1,26 @@
+@echo off
+
+REM creates version.h with HEAD commit hash
+REM params: $1=full path to output file (usually points version.h)
+
+setlocal enableextensions enabledelayedexpansion
+
+cd /d "%~dp0"
+
+break> %1
+
+<nul set /p=^"#define GIT_SHA1 ^"^"> %1
+
+where git
+if "%errorlevel%" == "0" ( goto :havegit ) else ( goto :writeending )
+
+:havegit
+for /f %%v in ('git rev-parse --short HEAD') do set version=%%v
+<nul set /p="%version%" >> %1
+
+:writeending
+
+echo ^" >> %1
+echo const char* g_GIT_SHA1 = GIT_SHA1; >> %1
+
+EXIT /B \ No newline at end of file