version.bat 1.0 KB

1234567891011121314151617181920212223242526272829
  1. :: version.bat
  2. :: Writes version numbers from B&I into version.h for use by version.rc.
  3. @ECHO OFF
  4. :: Set default values for environment variables if not set by B&I
  5. IF "%OBJROOT%"=="" SET OBJROOT=.
  6. IF "%RC_PROJECTSOURCEVERSION%"=="" SET RC_PROJECTSOURCEVERSION=0.0
  7. IF "%RC_PROJECTBUILDVERSION%"=="" SET RC_PROJECTBUILDVERSION=0
  8. :: Get version numbers from environment variables
  9. SET major=1
  10. SET patch=0
  11. FOR /F "tokens=1* eol= delims=." %%i IN ("%RC_PROJECTSOURCEVERSION%") DO (
  12. SET minor=%%i
  13. IF NOT "%%j"=="" SET patch=%%j
  14. )
  15. SET build=%RC_PROJECTBUILDVERSION%
  16. ECHO version %major% . %minor% . %patch% . %build%
  17. :: Write version.h
  18. ECHO // This file is automatically generated by version.bat. > "%OBJROOT%\version.h"
  19. ECHO // DO NOT EDIT >> "%OBJROOT%\version.h"
  20. ECHO #define major %major% >> "%OBJROOT%\version.h"
  21. ECHO #define minor %minor% >> "%OBJROOT%\version.h"
  22. ECHO #define patch %patch% >> "%OBJROOT%\version.h"
  23. ECHO #define build %build% >> "%OBJROOT%\version.h"
  24. ECHO #define string "%major%,%minor%,%patch%,%build%" >> "%OBJROOT%\version.h"