一、git配置
* 打标签 git tag -a <commit-id>
* [查看版本号 git describe --tags --dirty]
二、windows脚本
* version.cmd
```
del version.h
echo #ifndef VERSION_H >>version.h
echo #define VERSION_H >>version.h
echo. >>version.h
echo. >>version.h
for /f "delims=" %%i in ('git describe --tags --dirty') do (set a=%%i)
echo #define GIT_VERSION "%a%" >>version.h
echo. >>version.h
echo. >>version.h
echo #endif // VERSION_H >>version.h
```
三、自定义构建步骤
* 在“项目-构建步骤”里添加一个步骤,移动到qmake之前

* 可用的工作目录
```
%{CurrentProject:Name}
%{CurrentKit:FileSystemName}
%{CurrentBuild:Name}
%{buildDir}
%{sourceDir}
```
本文介绍如何使用Git进行版本标签的创建与查询,并提供了一个Windows脚本用于自动化生成包含版本信息的头文件。此外,还介绍了如何在构建过程中加入自定义步骤。
1103

被折叠的 条评论
为什么被折叠?



