相关资料:
https://blog.csdn.net/yousss/article/details/82218475 VS开发中自动版本号的设置-SubWCRev命令
https://blog.csdn.net/foruok/article/details/22665353 Qt Creator自动使用svn源代码版本号编译
https://blog.csdn.net/foruok/article/details/19920681 Windows下Qt for Android 编译安卓C语言可执行程序
https://download.csdn.net/download/zhujianqiangqq/21572072 代码包下载
实例:
.pro(重点)
1 # 相关资料: 2 # https://blog.csdn.net/yousss/article/details/82218475 VS开发中自动版本号的设置-SubWCRev命令 3 # https://blog.csdn.net/foruok/article/details/22665353 Qt Creator自动使用svn源代码版本号编译 4 # https://blog.csdn.net/foruok/article/details/19920681 Windows下Qt for Android 编译安卓C语言可执行程序 5 # **************CMD命令******************* 6 # SubWcRev "D:\QtDemo\QtVersionInfo\QtVersionInfo" -f | findstr "Updated to revision" 7 # SubWcRev "D:\QtDemo\QtVersionInfo\QtVersionInfo" -f | findstr "Mixed revision range" 8 # SubWcRev "D:\QtDemo\QtVersionInfo\QtVersionInfo" -f | findstr "Last committed at revision" 9 # SubWcRev.exe ../QtVersionInfo "../QtVersionInfo/version.temp.h" "../QtVersionInfo/version.h" 10 # svn info --show-item last-changed-revision D:\QtDemo\QtVersionInfo\QtVersionInfo 11 # **************版本号说明************************* 12 # MAJAR_NUMBER 为大版本号,当出现新旧版本无法兼容时,递增。(比如旧版本与服务器版本完全无法兼容。) 13 # MINOR_NUMBER 为中版本号,当大版本号递增时,归零。否则,当增加新功能时,递增。 14 # CHANGE_NUMBER 为小版本号,当大版本号或小版本号递增时,归零。否则,每次发布,递增。(一般是BUG修复、优化,遗漏等) 15 # BUILD_NUMBER 为构建版本号,每次发布增加,但不一定每次+1,因为我们使用了提交次数统计来作为构建版本号的。 16 17 QT += core gui 18 19 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 20 21 CONFIG += c++11 22 23 # The following define makes your compiler emit warnings if you use 24 # any Qt feature that has been marked deprecated (the exact warnings 25 # depend on your compiler). Please consult the documentation of the 26 # deprecated API in order to know how to port your code away from it. 27 DEFINES += QT_DEPRECATED_WARNINGS 28 29 # You can also make your code fail to compile if it uses deprecated APIs. 30 # In order to do so, uncomment the following line. 31 # You can also select to disable deprecated APIs only up to a certain version of Qt. 32 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 33 34 SOURCES += \ 35 main.cpp \ 36 mainwindow.cpp 37 38 HEADERS += \ 39 mainwindow.h \ 40 version.h 41 42 FORMS += \ 43 mainwindow.ui 44 45 46 # 如果含有中文,记得将pro文件的编码格式设置为GBK,否则中文将会是乱码 47 # 版本号 48 VERSION = 2.0.1.9 49 QMAKE_TARGET_PRODUCT = 客户端 50 QMAKE_TARGET_COMPANY = LWJR 51 QMAKE_TARGET_DESCRIPTION = 数据空战应用程序 52 QMAKE_TARGET_COPYRIGHT = Copyright @2020 LWJR,All rights reserved. 53 # 本程序使用两个图标,这样其快捷方式可以有更多选择,也可以给关联文件提供图标选择 54 RC_ICONS += icon1.ico \ 55 icon2.ico 56 # 语言 0x0004 表示 简体中文 57 # 详见 https://msdn.microsoft.com/en-us/library/dd318693%28vs.85%29.aspx 58 RC_LANG = 0x0004 59 60 61 # Default rules for deployment. 62 qnx: target.path = /tmp/$${TARGET}/bin 63 else: unix:!android: target.path = /opt/$${TARGET}/bin 64 !isEmpty(target.path): INSTALLS += target