Compare commits

..

1 Commits

Author SHA1 Message Date
dijunkun
a006eacf0b [feat] add daemon support with automatic restart on crash 2025-11-19 16:20:36 +08:00
6 changed files with 6 additions and 54 deletions

View File

@@ -55,7 +55,7 @@ jobs:
XMAKE_GLOBALDIR: /data
run: |
ls -la $XMAKE_GLOBALDIR
xmake f --CROSSDESK_VERSION=${LEGAL_VERSION} --USE_CUDA=true --root -y
xmake f --CROSSDESK_VERSION=${LEGAL_VERSION} --root -y
xmake b -vy --root crossdesk
- name: Decode and save certificate
@@ -120,7 +120,7 @@ jobs:
CUDA_PATH: /usr/local/cuda
XMAKE_GLOBALDIR: /data
run: |
xmake f --CROSSDESK_VERSION=${LEGAL_VERSION} --USE_CUDA=true --root -y
xmake f --CROSSDESK_VERSION=${LEGAL_VERSION} --root -y
xmake b -vy --root crossdesk
- name: Decode and save certificate
@@ -189,7 +189,7 @@ jobs:
- name: Build CrossDesk
run: |
xmake f --CROSSDESK_VERSION=${VERSION_NUM} --USE_CUDA=true -y
xmake f --CROSSDESK_VERSION=${VERSION_NUM} -y
xmake b -vy crossdesk
- name: Decode and save certificate
@@ -298,7 +298,7 @@ jobs:
- name: Build CrossDesk
run: |
xmake f --CROSSDESK_VERSION=${{ env.VERSION_NUM }} --USE_CUDA=true -y
xmake f --CROSSDESK_VERSION=${{ env.VERSION_NUM }} -y
xmake b -vy crossdesk
- name: Decode and save certificate

View File

@@ -11,18 +11,9 @@
#include <process.h>
#include <tchar.h>
#include <windows.h>
#elif __APPLE__
#include <fcntl.h>
#include <limits.h>
#include <mach-o/dyld.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#else
Daemon* Daemon::instance_ = nullptr;
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -32,10 +23,6 @@
#include <cstring>
#endif
#ifndef _WIN32
Daemon* Daemon::instance_ = nullptr;
#endif
// get executable file path
static std::string GetExecutablePath() {
#ifdef _WIN32
@@ -44,16 +31,6 @@ static std::string GetExecutablePath() {
if (length > 0 && length < sizeof(path)) {
return std::string(path);
}
#elif __APPLE__
char path[PATH_MAX];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0) {
char resolved_path[PATH_MAX];
if (realpath(path, resolved_path) != nullptr) {
return std::string(resolved_path);
}
return std::string(path);
}
#else
char path[PATH_MAX];
ssize_t count = readlink("/proc/self/exe", path, sizeof(path) - 1);
@@ -97,12 +74,7 @@ bool Daemon::start(MainLoopFunc loop) {
#ifdef _WIN32
running_ = true;
return runWithRestart(loop);
#elif __APPLE__
// macOS: Use child process monitoring (like Windows) to preserve GUI
running_ = true;
return runWithRestart(loop);
#else
// Linux: Use traditional daemonization
instance_ = this;
runUnix(loop);
return true;

View File

@@ -20,7 +20,6 @@
#define INPUT_WINDOW_PADDING_EN 96
#define SETTINGS_WINDOW_WIDTH_CN 202
#define SETTINGS_WINDOW_WIDTH_EN 248
#if USE_CUDA
#if _WIN32
#define SETTINGS_WINDOW_HEIGHT_CN 405
#define SETTINGS_WINDOW_HEIGHT_EN 405
@@ -28,15 +27,6 @@
#define SETTINGS_WINDOW_HEIGHT_CN 375
#define SETTINGS_WINDOW_HEIGHT_EN 375
#endif
#else
#if _WIN32
#define SETTINGS_WINDOW_HEIGHT_CN 375
#define SETTINGS_WINDOW_HEIGHT_EN 375
#else
#define SETTINGS_WINDOW_HEIGHT_CN 345
#define SETTINGS_WINDOW_HEIGHT_EN 345
#endif
#endif
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_CN 228
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_EN 275
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_CN 195

View File

@@ -158,7 +158,6 @@ int Render::SettingWindow() {
video_encode_format_items, IM_ARRAYSIZE(video_encode_format_items));
}
#if USE_CUDA && !defined(__aarch64__) && !defined(__arm__)
ImGui::Separator();
{
@@ -177,7 +176,6 @@ int Render::SettingWindow() {
ImGui::Checkbox("##enable_hardware_video_codec",
&enable_hardware_video_codec_);
}
#endif
ImGui::Separator();

View File

@@ -7,12 +7,6 @@ option("CROSSDESK_VERSION")
set_description("Set CROSSDESK_VERSION for build")
option_end()
option("USE_CUDA")
set_default(false)
set_showmenu(true)
set_description("Use CUDA for hardware codec acceleration")
option_end()
add_rules("mode.release", "mode.debug")
set_languages("c++17")
set_encodings("utf-8")
@@ -22,8 +16,6 @@ set_encodings("utf-8")
-- add_cxxflags("/W4", "/WX")
add_defines("UNICODE")
add_defines("USE_CUDA=" .. (is_config("USE_CUDA", true) and "1" or "0"))
if is_mode("debug") then
add_defines("CROSSDESK_DEBUG")
end