Skip to content

Commit

Permalink
Minor build stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 9, 2024
1 parent 1810143 commit 3c010d8
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 38 deletions.
20 changes: 12 additions & 8 deletions src/app/GUI/aboutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ AboutWidget::AboutWidget(QWidget *parent)

const auto mTopLabel = new QLabel(this);

mTopLabel->setText(QString::fromUtf8("<div style=\"margin: 0; padding: 0; text-align: center; font-weight: normal;\">"
"<img src=\":/icons/hicolor/%2x%2/apps/%4.png\" width=\"%2\" height=\"%2\">"
"<h1 style=\"font-weight: normal; margin-top: 0; padding-top: 0;\">%3<br><span style=\"font-size: large;\">%1</span></h1>"
"</div>")
.arg(AppSupport::getAppVersion(true),
QString::number(96),
AppSupport::getAppDisplayName(),
AppSupport::getAppName()));
QString label = QString::fromUtf8("<div style=\"margin: 0; padding: 0; text-align: center; font-weight: normal;\">"
"<img src=\":/icons/hicolor/%2x%2/apps/%4.png\" width=\"%2\" height=\"%2\">"
"<h1 style=\"font-weight: normal; margin-top: 0; padding-top: 0;\">%3<br><span style=\"font-size: large;\">%1</span></h1>"
"</div>").arg(AppSupport::getAppVersion(),
QString::number(96),
AppSupport::getAppDisplayName(),
AppSupport::getAppName());
const auto buildInfo = AppSupport::getAppBuildInfo(true);
if (!buildInfo.isEmpty()) {
label.append(buildInfo);
}
mTopLabel->setText(label);

mTopLayout->addStretch();
mTopLayout->addWidget(mTopLabel);
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/welcomedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ WelcomeDialog::WelcomeDialog(QMenu *recentMenu,
"<p style=\"margin: 0; padding: 0;\"><img src=\":/icons/hicolor/%2x%2/apps/%4.png\" width=\"%2\" height=\"%2\"></p>"
"<h1 style=\"font-weight: normal; margin-top: 0; padding-top: 0;\">%3<br><span style=\"font-size: large;\">%1</span></h1>"
"</div>")
.arg(AppSupport::getAppVersion(false),
.arg(AppSupport::getAppVersion(),
QString::number(logoSize),
AppSupport::getAppDisplayName(),
AppSupport::getAppName()));
Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message("-- ffmpeg libraries: ${FFMPEG_LIBRARIES_DIRS} ${FFMPEG_LIBRARIES}")
message("-- skia libraries: ${SKIA_LIBRARIES}")

add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
add_definitions(-DPROJECT_GIT="${GIT_COMMIT}")
add_definitions(-DPROJECT_COMMIT="${GIT_COMMIT}")
add_definitions(-DPROJECT_BRANCH="${GIT_BRANCH}")

add_definitions(-DCORE_LIBRARY)
Expand Down
55 changes: 33 additions & 22 deletions src/core/appsupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,35 +150,41 @@ const QString AppSupport::getAppUrl()
return QString::fromUtf8("https://friction.graphics");
}

const QString AppSupport::getAppVersion(bool html)
const QString AppSupport::getAppVersion()
{
QString version = QString::fromUtf8("0.9.6"); // fallback, should not happen
#ifdef PROJECT_VERSION
version = QString::fromUtf8(PROJECT_VERSION);
#endif
QString version = QString::fromUtf8(PROJECT_VERSION);
#ifndef PROJECT_OFFICIAL
version.append("-dev");
#endif
QString git;
#ifdef PROJECT_GIT
git = QString::fromUtf8(PROJECT_GIT);
#endif
QString branch;
#ifdef PROJECT_BRANCH
branch = QString::fromUtf8(PROJECT_BRANCH);
#endif
if (!branch.isEmpty()) {
version.append(QString::fromUtf8(" %1").arg(branch));
}
if (!git.isEmpty()) {
if (branch.isEmpty()) { version.append(QString::fromUtf8(" ")); }
else { version.append(QString::fromUtf8("/")); }
version.append(html ? QString::fromUtf8("<a href=\"%2/%1\">%1</a>").arg(git,
getAppCommitUrl()) : git);
}
return version;
}

const QString AppSupport::getAppBuildInfo(bool html)
{
#if defined(PROJECT_COMMIT) && defined(PROJECT_BRANCH)
const auto commit = QString::fromUtf8(PROJECT_COMMIT);
const auto branch = QString::fromUtf8(PROJECT_BRANCH);
if (commit.isEmpty() || branch.isEmpty()) { return QString(); }
if (!html) {
return QString("%1 %2 %3 %4.").arg(tr("Built from"),
commit,
tr("on"),
branch);
} else {
return QString("%1 <a href=\"%5/%2\">%2</a> %3 <a href=\"%6/%4\">%4</a>.")
.arg(tr("Built from"),
commit,
tr("on"),
branch,
getAppCommitUrl(),
getAppBranchUrl());
}
#else
Q_UNUSED(html)
#endif
return QString();
}

const QString AppSupport::getAppDesc()
{
return QString::fromUtf8("Motion Graphics");
Expand Down Expand Up @@ -209,6 +215,11 @@ const QString AppSupport::getAppCommitUrl()
return QString::fromUtf8("https://github.com/friction2d/friction/commit");
}

const QString AppSupport::getAppBranchUrl()
{
return QString::fromUtf8("https://github.com/friction2d/friction/tree");
}

const QString AppSupport::getAppConfigPath()
{
QString path = QString::fromUtf8("%1/%2")
Expand Down
4 changes: 3 additions & 1 deletion src/core/appsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ class CORE_EXPORT AppSupport : public QObject
static const QString getAppDomain();
static const QString getAppID();
static const QString getAppUrl();
static const QString getAppVersion(bool html = false);
static const QString getAppVersion();
static const QString getAppBuildInfo(bool html = false);
static const QString getAppDesc();
static const QString getAppCompany();
static const QString getAppContributorsUrl();
static const QString getAppIssuesUrl();
static const QString getAppLatestReleaseUrl();
static const QString getAppCommitUrl();
static const QString getAppBranchUrl();
static const QString getAppConfigPath();
static const QString getAppOutputProfilesPath();
static const QString getAppPathEffectsPath();
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clan
if [ "${REL}" = 1 ]; then
cmake -G Ninja \
-DFRICTION_OFFICIAL_RELEASE=ON \
-DGIT_COMMIT=${COMMIT} \
-DGIT_BRANCH=${BRANCH} \
${CMAKE_EXTRA} ..
VERSION=`cat version.txt`
else
Expand Down
8 changes: 3 additions & 5 deletions src/scripts/build_vfxplatform_friction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ CMAKE_EXTRA=""
GIT_COMMIT=`git rev-parse --short=8 HEAD`
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`

if [ "${REL}" != 1 ]; then
CMAKE_EXTRA="-DGIT_COMMIT=${GIT_COMMIT} -DGIT_BRANCH=${GIT_BRANCH}"
fi

cmake -GNinja \
-DCMAKE_INSTALL_PREFIX=${SDK} \
-DCMAKE_PREFIX_PATH=${SDK} \
Expand All @@ -97,7 +93,9 @@ cmake -GNinja \
-DQSCINTILLA_LIBRARIES=qscintilla2_friction_qt5 \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
${CMAKE_EXTRA} ..
-DGIT_COMMIT=${GIT_COMMIT} \
-DGIT_BRANCH=${GIT_BRANCH} \
..

VERSION=`cat version.txt`
if [ "${REL}" != 1 ]; then
Expand Down

0 comments on commit 3c010d8

Please sign in to comment.