build: Move versioning to CMake file. (#2752)

This commit is contained in:
squidbus 2025-04-07 02:22:51 -07:00 committed by GitHub
parent 0c6f2b470f
commit 9d2175180e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 37 additions and 56 deletions

View file

@ -24,7 +24,6 @@
#include <common/config.h>
#include <common/path_util.h>
#include <common/scm_rev.h>
#include <common/version.h>
#include "check_update.h"
using namespace Common::FS;
@ -52,7 +51,7 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
url = QUrl("https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest");
checkName = false;
} else {
if (Common::isRelease) {
if (Common::g_is_release) {
Config::setUpdateChannel("Release");
} else {
Config::setUpdateChannel("Nightly");
@ -162,7 +161,7 @@ tr("The Auto Updater allows up to 60 update checks per hour.\\nYou have reached
QString currentRev = (updateChannel == "Nightly")
? QString::fromStdString(Common::g_scm_rev)
: "v." + QString::fromStdString(Common::VERSION);
: "v." + QString::fromStdString(Common::g_version);
QString currentDate = Common::g_scm_date;
QDateTime dateTime = QDateTime::fromString(latestDate, Qt::ISODate);

View file

@ -13,7 +13,7 @@
#include "cheats_patches.h"
#include "common/config.h"
#include "common/path_util.h"
#include "common/version.h"
#include "common/scm_rev.h"
#include "compatibility_info.h"
#include "game_info.h"
#include "trophy_viewer.h"
@ -115,7 +115,7 @@ public:
compatibilityMenu->addAction(updateCompatibility);
compatibilityMenu->addAction(viewCompatibilityReport);
if (Common::isRelease) {
if (Common::g_is_release) {
compatibilityMenu->addAction(submitCompatibilityReport);
}
@ -571,7 +571,7 @@ public:
query.addQueryItem("game-name", QString::fromStdString(m_games[itemID].name));
query.addQueryItem("game-serial", QString::fromStdString(m_games[itemID].serial));
query.addQueryItem("game-version", QString::fromStdString(m_games[itemID].version));
query.addQueryItem("emulator-version", QString(Common::VERSION));
query.addQueryItem("emulator-version", QString(Common::g_version));
url.setQuery(query);
QDesktopServices::openUrl(url);

View file

@ -18,7 +18,6 @@
#include "common/path_util.h"
#include "common/scm_rev.h"
#include "common/string_util.h"
#include "common/version.h"
#include "control_settings.h"
#include "game_install_dialog.h"
#include "kbm_gui.h"
@ -58,8 +57,8 @@ bool MainWindow::Init() {
// show ui
setMinimumSize(720, 405);
std::string window_title = "";
if (Common::isRelease) {
window_title = fmt::format("shadPS4 v{}", Common::VERSION);
if (Common::g_is_release) {
window_title = fmt::format("shadPS4 v{}", Common::g_version);
} else {
std::string remote_url(Common::g_scm_remote_url);
std::string remote_host;
@ -69,10 +68,10 @@ bool MainWindow::Init() {
remote_host = "unknown";
}
if (remote_host == "shadps4-emu" || remote_url.length() == 0) {
window_title = fmt::format("shadPS4 v{} {} {}", Common::VERSION, Common::g_scm_branch,
window_title = fmt::format("shadPS4 v{} {} {}", Common::g_version, Common::g_scm_branch,
Common::g_scm_desc);
} else {
window_title = fmt::format("shadPS4 v{} {}/{} {}", Common::VERSION, remote_host,
window_title = fmt::format("shadPS4 v{} {}/{} {}", Common::g_version, remote_host,
Common::g_scm_branch, Common::g_scm_desc);
}
}

View file

@ -9,7 +9,7 @@
#include <fmt/format.h>
#include "common/config.h"
#include "common/version.h"
#include "common/scm_rev.h"
#include "qt_gui/compatibility_info.h"
#ifdef ENABLE_DISCORD_RPC
#include "common/discord_rpc_handler.h"
@ -491,7 +491,7 @@ void SettingsDialog::LoadValuesFromConfig() {
QString updateChannel = QString::fromStdString(Config::getUpdateChannel());
ui->updateComboBox->setCurrentText(
channelMap.key(updateChannel != "Release" && updateChannel != "Nightly"
? (Common::isRelease ? "Release" : "Nightly")
? (Common::g_is_release ? "Release" : "Nightly")
: updateChannel));
#endif