0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-03 12:04:05 +03:00

Automate version generation

Version is now generated automatically based on git tags.
Both cases are handled: building from git tree and building tarball downloaded from github.

Works for qmake and cmake
This commit is contained in:
Андрей Лухнов
2024-09-02 15:32:42 +03:00
parent a9126d51c6
commit b534c2bec0
12 changed files with 98 additions and 30 deletions

View File

@@ -213,3 +213,19 @@ FORMS += \
RESOURCES += \
$$REPORT_PATH/report.qrc \
$$REPORT_PATH/items/items.qrc
system("git --version") {
LR_VERSION = $$system("git --git-dir=$$PWD/../.git describe --tags --dirty")
} else {
LR_VERSION = "0.0.0-unknown"
}
VERSION_TEMPLATE = $$PWD/version.h.in
generateversion.depends = FORCE
generateversion.input = VERSION_TEMPLATE
generateversion.output = $$OUT_PWD/version.h
generateversion.commands = $$QMAKE_STREAM_EDITOR \'s/@GIT_VERSION@/$$LR_VERSION/\' ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT}
generateversion.CONFIG = no_link target_predeps
QMAKE_EXTRA_COMPILERS += generateversion

View File

@@ -27,9 +27,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifdef CMAKE_CONFIG
#include <config.h>
#endif
#include "version.h"
#include "lraboutdialog.h"
#include "ui_lraboutdialog.h"

9
limereport/version.h.in Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
// git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
#ifdef GIT_ARCHIVE
#define LIMEREPORT_VERSION_STR "$Format:%(describe:tags=true)$"
#else
#define LIMEREPORT_VERSION_STR "@GIT_VERSION@"
#endif