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

@ -7,10 +7,10 @@
#include <fmt/xchar.h> // for wstring support
#include <toml.hpp>
#include "common/config.h"
#include "common/logging/formatter.h"
#include "common/path_util.h"
#include "config.h"
#include "logging/formatter.h"
#include "version.h"
#include "common/scm_rev.h"
namespace toml {
template <typename TC, typename K>
@ -763,7 +763,7 @@ void load(const std::filesystem::path& path) {
logFilter = toml::find_or<std::string>(general, "logFilter", "");
logType = toml::find_or<std::string>(general, "logType", "sync");
userName = toml::find_or<std::string>(general, "userName", "shadPS4");
if (Common::isRelease) {
if (Common::g_is_release) {
updateChannel = toml::find_or<std::string>(general, "updateChannel", "Release");
} else {
updateChannel = toml::find_or<std::string>(general, "updateChannel", "Nightly");
@ -1108,7 +1108,7 @@ void setDefaultValues() {
logFilter = "";
logType = "sync";
userName = "shadPS4";
if (Common::isRelease) {
if (Common::g_is_release) {
updateChannel = "Release";
} else {
updateChannel = "Nightly";

View file

@ -3,21 +3,17 @@
#include "common/scm_rev.h"
#define GIT_REV "@GIT_REV@"
#define GIT_BRANCH "@GIT_BRANCH@"
#define GIT_DESC "@GIT_DESC@"
#define GIT_REMOTE_NAME "@GIT_REMOTE_NAME@"
#define GIT_REMOTE_URL "@GIT_REMOTE_URL@"
#define BUILD_DATE "@BUILD_DATE@"
namespace Common {
const char g_scm_rev[] = GIT_REV;
const char g_scm_branch[] = GIT_BRANCH;
const char g_scm_desc[] = GIT_DESC;
const char g_scm_remote_name[] = GIT_REMOTE_NAME;
const char g_scm_remote_url[] = GIT_REMOTE_URL;
const char g_scm_date[] = BUILD_DATE;
constexpr char g_version[] = "@APP_VERSION@";
constexpr bool g_is_release = @APP_IS_RELEASE@;
constexpr char g_scm_rev[] = "@GIT_REV@";
constexpr char g_scm_branch[] = "@GIT_BRANCH@";
constexpr char g_scm_desc[] = "@GIT_DESC@";
constexpr char g_scm_remote_name[] = "@GIT_REMOTE_NAME@";
constexpr char g_scm_remote_url[] = "@GIT_REMOTE_URL@";
constexpr char g_scm_date[] = "@BUILD_DATE@";
} // namespace

View file

@ -5,6 +5,9 @@
namespace Common {
extern const char g_version[];
extern const bool g_is_release;
extern const char g_scm_rev[];
extern const char g_scm_branch[];
extern const char g_scm_desc[];

View file

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include <string_view>
namespace Common {
constexpr char VERSION[] = "0.7.1 WIP";
constexpr bool isRelease = false;
} // namespace Common