Skip to content

Commit

Permalink
Merge pull request #44 from Artanidos/issue_42_manage_version_number
Browse files Browse the repository at this point in the history
Closes #42 - store version number in single header file.
  • Loading branch information
Lavigne958 authored Jan 14, 2021
2 parents 15e50ae + 669ae61 commit 8c60315
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
13 changes: 12 additions & 1 deletion build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ then
echo "Plugin folder not found, build package without plugins"
fi

_extract_version()
{
local seg="$1"
echo "$(grep "VERSION_${seg}" ./src/App/version.h | cut -d" " -f 3)"
}

major=$(_extract_version "MAJOR")
minor=$(_extract_version "MINOR")
build=$(_extract_version "BUILD")
VERSION="${major}.${minor}.${build}"

# rename the binary to lowercase letter to comply with deb packages
mv ${SOURCE_DIR}/AnimationMaker ${SOURCE_DIR}/animationmaker

Expand Down Expand Up @@ -67,6 +78,6 @@ fpm \
-m "Alexandre LAVIGNE" \
--description "${PACKAGE_DESCRIPTION}" \
--url "https://github.com/Artanidos/AnimationMaker" \
--version 1.9 \
--version ${VERSION} \
${deps[@]} \
animationmaker plugins
5 changes: 4 additions & 1 deletion src/App/App.pro
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ LIBS += -L$$OUT_PWD/../AnimationItems -lAnimationItems
SOURCES += main.cpp \
mainwindow.cpp \


HEADERS += \
mainwindow.h \
version.h \

RESOURCES += ../images.qrc

VERSION = VERSION_MAJOR.VERSION_MINOR.VERSION_BUILD

5 changes: 4 additions & 1 deletion src/App/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
****************************************************************************/
#include <QApplication>
#include <QStyleFactory>
#include <QVersionNumber>

#include "mainwindow.h"
#include "version.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QCoreApplication::setApplicationName("AnimationMaker");
QCoreApplication::setApplicationVersion("1.8.4");
QVersionNumber version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
QCoreApplication::setApplicationVersion(version.toString());
QCoreApplication::setOrganizationName("Artanidos");

QFont newFont("Sans Serif", 10);
Expand Down
8 changes: 8 additions & 0 deletions src/App/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef VERSION_H
#define VERSION_H

#define VERSION_MAJOR 1
#define VERSION_MINOR 9
#define VERSION_BUILD 0

#endif // VERSION_H

0 comments on commit 8c60315

Please sign in to comment.