Fix tagged version download

This commit is contained in:
Patrick Nicolas
2025-09-24 07:53:21 +02:00
parent a193b4084c
commit 66ca73981d
6 changed files with 17 additions and 8 deletions
-1
View File
@@ -13,7 +13,6 @@ execute_process(
if (GIT_DESC)
string(STRIP ${GIT_DESC} GIT_DESC)
string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC})
message(STATUS "Setting version to ${GIT_DESC} from git")
else()
set(GIT_DESC v${CMAKE_PROJECT_VERSION})
-1
View File
@@ -7,7 +7,6 @@ else()
endif()
if (GIT_DESC)
string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC})
configure_file(version.cpp.in version.cpp)
else ()
add_custom_target(wivrn-version ALL
+11
View File
@@ -17,6 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <cctype>
#include <iterator>
namespace wivrn
{
extern const char git_version[];
@@ -24,4 +27,12 @@ namespace wivrn
extern const char git_commit[];
const char git_commit[] = "@GIT_COMMIT@";
const char* display_version()
{
if (std::size(git_version) > 2 and git_version[0] == 'v' and isdigit(git_version[1]))
return git_version + 1;
else
return git_version;
}
}
+2
View File
@@ -4,4 +4,6 @@ namespace wivrn
{
extern const char git_version[];
extern const char git_commit[];
const char * display_version();
} // namespace wivrn
+1 -3
View File
@@ -42,9 +42,7 @@ bool apk_installer::isTagged() const
QString apk_installer::currentVersion() const
{
if (wivrn::git_version[0] == 'v')
return &wivrn::git_version[1];
return wivrn::git_version;
return wivrn::display_version();
}
QCoro::Task<> apk_installer::doRefreshLatestVersion()
+3 -3
View File
@@ -354,7 +354,7 @@ void start_publishing()
sprintf(protocol_string, "%016" PRIx64, wivrn::protocol_version);
std::map<std::string, std::string> TXT = {
{"protocol", protocol_string},
{"version", wivrn::git_version},
{"version", wivrn::display_version()},
{"cookie", server_cookie()},
};
publisher.emplace(poll_api, hostname(), "_wivrn._tcp", wivrn::default_port, TXT);
@@ -889,7 +889,7 @@ auto create_dbus_connection()
int inner_main(int argc, char * argv[], bool show_instructions)
{
std::cerr << "WiVRn " << wivrn::git_version << " starting" << std::endl;
std::cerr << "WiVRn " << wivrn::display_version() << " starting" << std::endl;
if (show_instructions)
{
if (auto command = steam_command(); not command.empty())
@@ -998,7 +998,7 @@ int main(int argc, char * argv[])
if (*version_flag)
{
std::cout << "WiVRn version " << wivrn::git_version << std::endl;
std::cout << "WiVRn version " << wivrn::display_version() << std::endl;
return 0;
}