Move flatpak utils into common

This commit is contained in:
Patrick Nicolas
2024-11-07 19:41:33 +01:00
parent 4123b35175
commit 19a399640a
12 changed files with 69 additions and 67 deletions
+1 -16
View File
@@ -1,18 +1,3 @@
if (GIT_DESC)
configure_file(version.cpp.in version.cpp)
else ()
add_custom_target(wivrn-dashboard-version ALL
COMMAND ${CMAKE_COMMAND}
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
-D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in
-D OUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.cpp
-D CMAKE_PROJECT_VERSION=${CMAKE_PROJECT_VERSION}
-P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in
)
endif()
# Qt 6.7 changed qt_add_translations()
try_compile(AT_LEAST_QT67 SOURCE_FROM_CONTENT check-qt-version.cpp "
#include <QtGlobal>
@@ -43,7 +28,6 @@ qt_add_executable(wivrn-dashboard
steam_app.h
adb.cpp
adb.h
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/wivrn.png
@@ -81,6 +65,7 @@ target_link_libraries(wivrn-dashboard PRIVATE
Qt6::DBus
Qt6::Network
nlohmann_json
wivrn-common-base
)
if (WIVRN_CHECK_CAPSYSNICE)
+3 -1
View File
@@ -18,6 +18,8 @@
#include "adb.h"
#include "utils/flatpak.h"
#include <QDebug>
#include <QProcess>
#include <chrono>
@@ -31,7 +33,7 @@ std::unique_ptr<QProcess> escape_sandbox(const std::string & executable, Args &&
auto process = std::make_unique<QProcess>();
QStringList args;
if (std::filesystem::exists("/.flatpak-info"))
if (wivrn::is_flatpak())
{
process->setProgram("flatpak-spawn");
args.push_back("--host");
+2 -1
View File
@@ -17,6 +17,7 @@
*/
#include "steam_app.h"
#include "utils/flatpak.h"
#include <QProcess>
#include <algorithm>
#include <cassert>
@@ -34,7 +35,7 @@ std::string read_vr_manifest()
std::filesystem::path vrmanifest = std::string{home ? home : ""} + "/.steam/steam/config/steamapps.vrmanifest";
if (std::filesystem::exists("/.flatpak-info"))
if (wivrn::is_flatpak())
{
QProcess flatpak_spawn;
flatpak_spawn.start("flatpak-spawn", {"--host", "cat", QString::fromStdString(vrmanifest)});
-26
View File
@@ -1,26 +0,0 @@
/*
* WiVRn VR streaming
* Copyright (C) 2022 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2022 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "version.h"
namespace wivrn
{
const char git_version[] = "@GIT_DESC@";
const char git_commit[] = "@GIT_COMMIT@";
} // namespace wivrn
-26
View File
@@ -1,26 +0,0 @@
/*
* WiVRn VR streaming
* Copyright (C) 2022 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2022 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
namespace wivrn
{
extern const char git_version[];
extern const char git_commit[];
} // namespace wivrn