#include "global.h" // also pulls in config.h
#include "ProductInfo.h"
-/* XXX: workaround until the Windows build can pull Git versioning. */
-#if !defined(HAVE_CONFIG_H)
- #define BUILD_VERSION "beta3 DEV"
- #define BUILD_DATE "unknown date"
- #define BUILD_REVISION_TAG "unknown revision"
+#if defined(HAVE_CONFIG_H)
+ /* included in global.h */
+#elif defined(WIN32)
+#include "verinfo.h"
+#else
+#define BUILD_VERSION "unknown version"
+#define BUILD_REV_DATE "unknown date"
+#define BUILD_REV_TAG "unknown revision"
+#warning No build information is available.
#endif
/*
--- /dev/null
+@echo off\r
+\r
+:: Written by vyhd for OpenITG\r
+:: Do whatever you'd like with this! I just hacked it together.\r
+:: Appropriately, I make no guarantees to it functioning properly.\r
+\r
+:: This is required to at least output a header with versioning info.\r
+:: If it doesn't, the build will (correctly) fail to complete.\r
+\r
+set BUILD_VERSION=unknown version\r
+set BUILD_REV_DATE=unknown date\r
+set BUILD_REV_TAG=unknown revision\r
+\r
+:: Why I hate Windows, part 1: we have to use this incredibly ugly\r
+:: and, frankly, nonsensical 'for' hack to assign output to variables\r
+:: without using an intermediate temp file.\r
+\r
+:: Why I hate Windows, part 2: we don't know if 'git' is an exe or\r
+:: a bat, and if it's a bat, we'll never return from the initial call\r
+:: unless we invoke it through 'call'. Compatibility!\r
+\r
+:: Why I hate Windows, part 3: it's silently stripping out the = signs\r
+:: in each invocation, so I spent at least half an hour trying to find\r
+:: an alternative way to call --pretty="format:%ad" in a way that it\r
+:: would accept. It turns out, if you use "--format=%%ad", the sign is\r
+:: preserved. Go figure.\r
+\r
+for /f %%i in ('call git tag') do set BUILD_VERSION=%%i\r
+for /f %%i in ('call git log -1 "--format=%%ad" --date=short') do set BUILD_REV_DATE=%%i\r
+for /f %%i in ('call git describe') do set BUILD_REV_TAG=%%i\r
+\r
+if NOT "%BUILD_VERSION%" == "unknown version" (\r
+ if NOT "%BUILD_VERSION%" == "%BUILD_REV_TAG%" (\r
+ set BUILD_VERSION=%BUILD_VERSION% DEV\r
+ )\r
+)\r
+\r
+echo Build version: %BUILD_VERSION%\r
+echo Build revision date: %BUILD_REV_DATE%\r
+echo Build revision tag: %BUILD_REV_TAG%\r
+\r
+( \r
+echo /* Autogenerated by src/archutils/Win32/gen-git-verinfo.bat */\r
+echo.\r
+echo #define BUILD_VERSION "%BUILD_VERSION%"\r
+echo #define BUILD_DATE "%BUILD_REV_DATE%"\r
+echo #define BUILD_REVISION_TAG "%BUILD_REV_TAG%"\r
+) > verinfo.h
\ No newline at end of file