Compare commits

..

2 Commits

6 changed files with 55 additions and 7 deletions

View File

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

View File

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

View File

@@ -20,6 +20,7 @@
#define INPUT_WINDOW_PADDING_EN 96 #define INPUT_WINDOW_PADDING_EN 96
#define SETTINGS_WINDOW_WIDTH_CN 202 #define SETTINGS_WINDOW_WIDTH_CN 202
#define SETTINGS_WINDOW_WIDTH_EN 248 #define SETTINGS_WINDOW_WIDTH_EN 248
#if USE_CUDA
#if _WIN32 #if _WIN32
#define SETTINGS_WINDOW_HEIGHT_CN 405 #define SETTINGS_WINDOW_HEIGHT_CN 405
#define SETTINGS_WINDOW_HEIGHT_EN 405 #define SETTINGS_WINDOW_HEIGHT_EN 405
@@ -27,6 +28,15 @@
#define SETTINGS_WINDOW_HEIGHT_CN 375 #define SETTINGS_WINDOW_HEIGHT_CN 375
#define SETTINGS_WINDOW_HEIGHT_EN 375 #define SETTINGS_WINDOW_HEIGHT_EN 375
#endif #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_CN 228
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_EN 275 #define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_EN 275
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_CN 195 #define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_CN 195

View File

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

View File

@@ -7,6 +7,12 @@ option("CROSSDESK_VERSION")
set_description("Set CROSSDESK_VERSION for build") set_description("Set CROSSDESK_VERSION for build")
option_end() 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") add_rules("mode.release", "mode.debug")
set_languages("c++17") set_languages("c++17")
set_encodings("utf-8") set_encodings("utf-8")
@@ -16,6 +22,8 @@ set_encodings("utf-8")
-- add_cxxflags("/W4", "/WX") -- add_cxxflags("/W4", "/WX")
add_defines("UNICODE") add_defines("UNICODE")
add_defines("USE_CUDA=" .. (is_config("USE_CUDA", true) and "1" or "0"))
if is_mode("debug") then if is_mode("debug") then
add_defines("CROSSDESK_DEBUG") add_defines("CROSSDESK_DEBUG")
end end