-
Notifications
You must be signed in to change notification settings - Fork 3
/
version.bat
executable file
·29 lines (24 loc) · 1.03 KB
/
version.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
:: version.bat
:: Writes version numbers from B&I into version.h for use by version.rc.
@ECHO OFF
:: Set default values for environment variables if not set by B&I
IF "%OBJROOT%"=="" SET OBJROOT=.
IF "%RC_PROJECTSOURCEVERSION%"=="" SET RC_PROJECTSOURCEVERSION=0.0
IF "%RC_PROJECTBUILDVERSION%"=="" SET RC_PROJECTBUILDVERSION=0
:: Get version numbers from environment variables
SET major=1
SET patch=0
FOR /F "tokens=1* eol= delims=." %%i IN ("%RC_PROJECTSOURCEVERSION%") DO (
SET minor=%%i
IF NOT "%%j"=="" SET patch=%%j
)
SET build=%RC_PROJECTBUILDVERSION%
ECHO version %major% . %minor% . %patch% . %build%
:: Write version.h
ECHO // This file is automatically generated by version.bat. > "%OBJROOT%\version.h"
ECHO // DO NOT EDIT >> "%OBJROOT%\version.h"
ECHO #define major %major% >> "%OBJROOT%\version.h"
ECHO #define minor %minor% >> "%OBJROOT%\version.h"
ECHO #define patch %patch% >> "%OBJROOT%\version.h"
ECHO #define build %build% >> "%OBJROOT%\version.h"
ECHO #define string "%major%,%minor%,%patch%,%build%" >> "%OBJROOT%\version.h"