diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3808b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Xmake cache +.xmake/ +build/ + +# MacOS Cache +.DS_Store + +# VSCode cache +.vscode +continuous-desk.code-workspace \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9880b19 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "thirdparty/projectx"] + path = thirdparty/projectx + url = git@github.com:dijunkun/projectx.git diff --git a/config/config.ini b/config/config.ini new file mode 100644 index 0000000..79ad05f --- /dev/null +++ b/config/config.ini @@ -0,0 +1,16 @@ +[signal server] +ip = 120.77.216.215 +port = 9099 + +[stun server] +ip = 120.77.216.215 +port = 3478 + +[turn server] +ip = 120.77.216.215 +port = 3478 +username = dijunkun +password = dijunkunpw + +[hardware acceleration] +turn_on = true \ No newline at end of file diff --git a/src/log/log.h b/src/log/log.h new file mode 100644 index 0000000..c8d7280 --- /dev/null +++ b/src/log/log.h @@ -0,0 +1,127 @@ +#ifndef _LOG_H_ +#define _LOG_H_ + +#include +#include +#include +#include +#include + +#include "spdlog/common.h" +#include "spdlog/logger.h" +#include "spdlog/sinks/base_sink.h" +#include "spdlog/sinks/rotating_file_sink.h" +#include "spdlog/sinks/stdout_color_sinks.h" +#include "spdlog/spdlog.h" + +using namespace std::chrono; + +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO + +// SPDLOG_TRACE(...) +// SPDLOG_DEBUG(...) +// SPDLOG_INFO(...) +// SPDLOG_WARN(...) +// SPDLOG_ERROR(...) +// SPDLOG_CRITICAL(...) + +#ifdef SIGNAL_LOGGER +constexpr auto LOGGER_NAME = "siganl_server"; +#else +constexpr auto LOGGER_NAME = "remote_desk"; +#endif + +#define LOG_INFO(...) \ + if (nullptr == spdlog::get(LOGGER_NAME)) { \ + auto now = std::chrono::system_clock::now() + std::chrono::hours(8); \ + auto timet = std::chrono::system_clock::to_time_t(now); \ + auto localTime = *std::gmtime(&timet); \ + std::stringstream ss; \ + std::string filename; \ + ss << LOGGER_NAME; \ + ss << std::put_time(&localTime, "-%Y%m%d-%H%M%S.log"); \ + ss >> filename; \ + std::string path = "logs/" + filename; \ + std::vector sinks; \ + sinks.push_back(std::make_shared()); \ + sinks.push_back(std::make_shared( \ + path, 1048576 * 5, 3)); \ + auto combined_logger = std::make_shared( \ + LOGGER_NAME, begin(sinks), end(sinks)); \ + combined_logger->flush_on(spdlog::level::info); \ + spdlog::register_logger(combined_logger); \ + SPDLOG_LOGGER_INFO(combined_logger, __VA_ARGS__); \ + } else { \ + SPDLOG_LOGGER_INFO(spdlog::get(LOGGER_NAME), __VA_ARGS__); \ + } + +#define LOG_WARN(...) \ + if (nullptr == spdlog::get(LOGGER_NAME)) { \ + auto now = std::chrono::system_clock::now() + std::chrono::hours(8); \ + auto timet = std::chrono::system_clock::to_time_t(now); \ + auto localTime = *std::gmtime(&timet); \ + std::stringstream ss; \ + std::string filename; \ + ss << LOGGER_NAME; \ + ss << std::put_time(&localTime, "-%Y%m%d-%H%M%S.log"); \ + ss >> filename; \ + std::string path = "logs/" + filename; \ + std::vector sinks; \ + sinks.push_back(std::make_shared()); \ + sinks.push_back(std::make_shared( \ + path, 1048576 * 5, 3)); \ + auto combined_logger = std::make_shared( \ + LOGGER_NAME, begin(sinks), end(sinks)); \ + spdlog::register_logger(combined_logger); \ + SPDLOG_LOGGER_WARN(combined_logger, __VA_ARGS__); \ + } else { \ + SPDLOG_LOGGER_WARN(spdlog::get(LOGGER_NAME), __VA_ARGS__); \ + } + +#define LOG_ERROR(...) \ + if (nullptr == spdlog::get(LOGGER_NAME)) { \ + auto now = std::chrono::system_clock::now() + std::chrono::hours(8); \ + auto timet = std::chrono::system_clock::to_time_t(now); \ + auto localTime = *std::gmtime(&timet); \ + std::stringstream ss; \ + std::string filename; \ + ss << LOGGER_NAME; \ + ss << std::put_time(&localTime, "-%Y%m%d-%H%M%S.log"); \ + ss >> filename; \ + std::string path = "logs/" + filename; \ + std::vector sinks; \ + sinks.push_back(std::make_shared()); \ + sinks.push_back(std::make_shared( \ + path, 1048576 * 5, 3)); \ + auto combined_logger = std::make_shared( \ + LOGGER_NAME, begin(sinks), end(sinks)); \ + spdlog::register_logger(combined_logger); \ + SPDLOG_LOGGER_ERROR(combined_logger, __VA_ARGS__); \ + } else { \ + SPDLOG_LOGGER_ERROR(spdlog::get(LOGGER_NAME), __VA_ARGS__); \ + } + +#define LOG_FATAL(...) \ + if (nullptr == spdlog::get(LOGGER_NAME)) { \ + auto now = std::chrono::system_clock::now() + std::chrono::hours(8); \ + auto timet = std::chrono::system_clock::to_time_t(now); \ + auto localTime = *std::gmtime(&timet); \ + std::stringstream ss; \ + std::string filename; \ + ss << LOGGER_NAME; \ + ss << std::put_time(&localTime, "-%Y%m%d-%H%M%S.log"); \ + ss >> filename; \ + std::string path = "logs/" + filename; \ + std::vector sinks; \ + sinks.push_back(std::make_shared()); \ + sinks.push_back(std::make_shared( \ + path, 1048576 * 5, 3)); \ + auto combined_logger = std::make_shared( \ + LOGGER_NAME, begin(sinks), end(sinks)); \ + spdlog::register_logger(combined_logger); \ + SPDLOG_LOGGER_CRITICAL(combined_logger, __VA_ARGS__); \ + } else { \ + SPDLOG_LOGGER_CRITICAL(spdlog::get(LOGGER_NAME), __VA_ARGS__); \ + } + +#endif diff --git a/remote_desk_gui/linux_capture.cpp b/src/remote_desk_gui/linux_capture.cpp similarity index 100% rename from remote_desk_gui/linux_capture.cpp rename to src/remote_desk_gui/linux_capture.cpp diff --git a/remote_desk_gui/main.cpp b/src/remote_desk_gui/main.cpp similarity index 70% rename from remote_desk_gui/main.cpp rename to src/remote_desk_gui/main.cpp index a1a28c3..2b2ca15 100644 --- a/remote_desk_gui/main.cpp +++ b/src/remote_desk_gui/main.cpp @@ -43,7 +43,7 @@ extern "C" { #elif __linux__ #include "screen_capture_x11.h" #endif -#include "x.h" +#include "../../thirdparty/projectx/src/interface/x.h" #define NV12_BUFFER_SIZE 1280 * 720 * 3 / 2 @@ -54,6 +54,7 @@ extern "C" { #endif int screen_w = 1280, screen_h = 720; +int window_w = 1280, window_h = 720; const int pixel_w = 1280, pixel_h = 720; unsigned char dst_buffer[pixel_w * pixel_h * 3 / 2]; @@ -118,7 +119,7 @@ typedef struct { } RemoteAction; inline int ProcessMouseKeyEven(SDL_Event &ev) { - float ratio = 1280.0 / screen_w; + float ratio = 1280.0 / window_w; RemoteAction remote_action; @@ -427,6 +428,67 @@ int main() { std::string client_user_id = "C-" + std::string(GetMac(mac_addr)); Init(peer_client, client_user_id.c_str()); + { + static char server_password[20] = ""; + std::string user_id = "S-" + std::string(GetMac(mac_addr)); + CreateConnection(peer_server, mac_addr, server_password); + + nv12_buffer = new char[NV12_BUFFER_SIZE]; +#ifdef _WIN32 + screen_capture = new ScreenCaptureWgc(); + + RECORD_DESKTOP_RECT rect; + rect.left = 0; + rect.top = 0; + rect.right = GetSystemMetrics(SM_CXSCREEN); + rect.bottom = GetSystemMetrics(SM_CYSCREEN); + + last_frame_time_ = std::chrono::high_resolution_clock::now(); + screen_capture->Init( + rect, 60, + [](unsigned char *data, int size, int width, int height) -> void { + auto now_time = std::chrono::high_resolution_clock::now(); + std::chrono::duration duration = now_time - last_frame_time_; + auto tc = duration.count() * 1000; + + if (tc >= 0) { + BGRAToNV12FFmpeg(data, width, height, (unsigned char *)nv12_buffer); + SendData(peer_server, DATA_TYPE::VIDEO, (const char *)nv12_buffer, + NV12_BUFFER_SIZE); + // std::cout << "Send" << std::endl; + last_frame_time_ = now_time; + } + }); + + screen_capture->Start(); + +#elif __linux__ + screen_capture = new ScreenCaptureX11(); + + RECORD_DESKTOP_RECT rect; + rect.left = 0; + rect.top = 0; + rect.right = 0; + rect.bottom = 0; + + last_frame_time_ = std::chrono::high_resolution_clock::now(); + screen_capture->Init( + rect, 60, + [](unsigned char *data, int size, int width, int height) -> void { + auto now_time = std::chrono::high_resolution_clock::now(); + std::chrono::duration duration = now_time - last_frame_time_; + auto tc = duration.count() * 1000; + + if (tc >= 0) { + SendData(peer_server, DATA_TYPE::VIDEO, (const char *)data, + NV12_BUFFER_SIZE); + last_frame_time_ = now_time; + } + }); + screen_capture->Start(); +#endif + } + // Setup SDL if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) { @@ -443,21 +505,13 @@ int main() { SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); window = SDL_CreateWindow("Remote Desk", SDL_WINDOWPOS_CENTERED, - SDL_WINDOWPOS_CENTERED, screen_w, screen_h, + SDL_WINDOWPOS_CENTERED, window_w, window_h, window_flags); - // int new_screen_w = 0; - // int new_screen_h = 0; - // SDL_GetWindowSize(window, &new_screen_w, &new_screen_h); - - // if (new_screen_w != screen_w) { - // screen_w = new_screen_w; - // screen_h = new_screen_w * 9 / 16; - // } else if (new_screen_h != screen_h) { - // screen_w = new_screen_h * 16 / 9; - // screen_h = new_screen_h; - // } - // SDL_SetWindowSize(window, screen_w, screen_h); + SDL_DisplayMode DM; + SDL_GetCurrentDisplayMode(0, &DM); + screen_w = DM.w; + screen_h = DM.h; sdlRenderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); @@ -509,108 +563,117 @@ int main() { const ImGuiViewport *main_viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Once); - ImGui::SetNextWindowSize(ImVec2(180, 225)); + ImGui::SetNextWindowSize(ImVec2(180, 130)); ImGui::Begin("Menu", nullptr, ImGuiWindowFlags_NoResize); { - ImGui::Text("LOCAL ID: "); - ImGui::SameLine(); + // ImGui::Text("LOCAL ID: "); + // ImGui::SameLine(); - ImGui::Selectable(mac_addr, false, - ImGuiSelectableFlags_AllowDoubleClick); + // ImGui::Selectable(mac_addr, false, + // ImGuiSelectableFlags_AllowDoubleClick); - if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) { - ImGui::SetClipboardText(mac_addr); - } + // if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) { + // ImGui::SetClipboardText(mac_addr); + // } - ImGui::Spacing(); + // ImGui::Spacing(); - ImGui::Text("PASSWORD: "); - ImGui::SameLine(); - ImGui::SetNextItemWidth(110); - static char server_password[20] = ""; - ImGui::InputTextWithHint("server_password", "000001", server_password, - IM_ARRAYSIZE(server_password), - ImGuiInputTextFlags_AllowTabInput); + // ImGui::Text("PASSWORD: "); + // ImGui::SameLine(); + // ImGui::SetNextItemWidth(110); + // static char server_password[20] = ""; + // ImGui::InputTextWithHint("server_password", "000001", + // server_password, + // IM_ARRAYSIZE(server_password), + // ImGuiInputTextFlags_AllowTabInput); - ImGui::Spacing(); - { - static bool online_button_pressed = false; - static const char *online_label = "Online"; + // ImGui::Spacing(); + // { + // static bool online_button_pressed = false; + // static const char *online_label = "Online"; - if (ImGui::Button(online_label)) { - std::string user_id = "S-" + std::string(GetMac(mac_addr)); + // if (ImGui::Button(online_label)) { + // std::string user_id = "S-" + + // std::string(GetMac(mac_addr)); - if (strcmp(online_label, "Online") == 0) { - CreateConnection(peer_server, mac_addr, server_password); + // if (strcmp(online_label, "Online") == 0) { + // CreateConnection(peer_server, mac_addr, + // server_password); - nv12_buffer = new char[NV12_BUFFER_SIZE]; -#ifdef _WIN32 - screen_capture = new ScreenCaptureWgc(); + // nv12_buffer = new char[NV12_BUFFER_SIZE]; + // #ifdef _WIN32 + // screen_capture = new ScreenCaptureWgc(); - RECORD_DESKTOP_RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = GetSystemMetrics(SM_CXSCREEN); - rect.bottom = GetSystemMetrics(SM_CYSCREEN); + // RECORD_DESKTOP_RECT rect; + // rect.left = 0; + // rect.top = 0; + // rect.right = GetSystemMetrics(SM_CXSCREEN); + // rect.bottom = GetSystemMetrics(SM_CYSCREEN); - last_frame_time_ = std::chrono::high_resolution_clock::now(); - screen_capture->Init( - rect, 60, - [](unsigned char *data, int size, int width, - int height) -> void { - auto now_time = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = - now_time - last_frame_time_; - auto tc = duration.count() * 1000; + // last_frame_time_ = + // std::chrono::high_resolution_clock::now(); + // screen_capture->Init( + // rect, 60, + // [](unsigned char *data, int size, int width, + // int height) -> void { + // auto now_time = + // std::chrono::high_resolution_clock::now(); + // std::chrono::duration duration = + // now_time - last_frame_time_; + // auto tc = duration.count() * 1000; - if (tc >= 0) { - BGRAToNV12FFmpeg(data, width, height, - (unsigned char *)nv12_buffer); - SendData(peer_server, DATA_TYPE::VIDEO, - (const char *)nv12_buffer, NV12_BUFFER_SIZE); - // std::cout << "Send" << std::endl; - last_frame_time_ = now_time; - } - }); + // if (tc >= 0) { + // BGRAToNV12FFmpeg(data, width, height, + // (unsigned char *)nv12_buffer); + // SendData(peer_server, DATA_TYPE::VIDEO, + // (const char *)nv12_buffer, + // NV12_BUFFER_SIZE); + // // std::cout << "Send" << std::endl; + // last_frame_time_ = now_time; + // } + // }); - screen_capture->Start(); + // screen_capture->Start(); -#elif __linux__ - screen_capture = new ScreenCaptureX11(); + // #elif __linux__ + // screen_capture = new ScreenCaptureX11(); - RECORD_DESKTOP_RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = 0; - rect.bottom = 0; + // RECORD_DESKTOP_RECT rect; + // rect.left = 0; + // rect.top = 0; + // rect.right = 0; + // rect.bottom = 0; - last_frame_time_ = std::chrono::high_resolution_clock::now(); - screen_capture->Init( - rect, 60, - [](unsigned char *data, int size, int width, - int height) -> void { - auto now_time = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = - now_time - last_frame_time_; - auto tc = duration.count() * 1000; + // last_frame_time_ = + // std::chrono::high_resolution_clock::now(); + // screen_capture->Init( + // rect, 60, + // [](unsigned char *data, int size, int width, + // int height) -> void { + // auto now_time = + // std::chrono::high_resolution_clock::now(); + // std::chrono::duration duration = + // now_time - last_frame_time_; + // auto tc = duration.count() * 1000; - if (tc >= 0) { - SendData(peer_server, DATA_TYPE::VIDEO, - (const char *)data, NV12_BUFFER_SIZE); - last_frame_time_ = now_time; - } - }); - screen_capture->Start(); -#endif - } else { - LeaveConnection(peer_server); - } - online_button_pressed = !online_button_pressed; - online_label = online_button_pressed ? "Offline" : "Online"; - } - } + // if (tc >= 0) { + // SendData(peer_server, DATA_TYPE::VIDEO, + // (const char *)data, NV12_BUFFER_SIZE); + // last_frame_time_ = now_time; + // } + // }); + // screen_capture->Start(); + // #endif + // } else { + // LeaveConnection(peer_server); + // } + // online_button_pressed = !online_button_pressed; + // online_label = online_button_pressed ? "Offline" : + // "Online"; + // } + // } ImGui::Spacing(); @@ -632,14 +695,14 @@ int main() { ImGui::Spacing(); - ImGui::Text("PASSWORD: "); - ImGui::SameLine(); - ImGui::SetNextItemWidth(110); + // ImGui::Text("PASSWORD: "); + // ImGui::SameLine(); + // ImGui::SetNextItemWidth(110); static char client_password[20] = ""; - ImGui::InputTextWithHint("client_password", "000003", - client_password, - IM_ARRAYSIZE(client_password), - ImGuiInputTextFlags_AllowTabInput); + // ImGui::InputTextWithHint("client_password", "000003", + // client_password, + // IM_ARRAYSIZE(client_password), + // ImGuiInputTextFlags_AllowTabInput); if (ImGui::Button(connect_label)) { if (strcmp(connect_label, "Connect") == 0 && !joined) { @@ -667,13 +730,13 @@ int main() { { if (ImGui::Button("Fix ratio")) { - SDL_GetWindowSize(window, &screen_w, &screen_h); + SDL_GetWindowSize(window, &window_w, &window_h); - if (screen_h != screen_w * 9 / 16) { - screen_w = screen_h * 16 / 9; + if (window_h != window_w * 9 / 16) { + window_w = window_h * 16 / 9; } - SDL_SetWindowSize(window, screen_w, screen_h); + SDL_SetWindowSize(window, window_w, window_h); } } @@ -692,9 +755,9 @@ int main() { done = true; } else if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED) { - SDL_GetWindowSize(window, &screen_w, &screen_h); - SDL_SetWindowSize(window, screen_w, screen_h); - // printf("Resize windows: %dx%d\n", screen_w, screen_h); + SDL_GetWindowSize(window, &window_w, &window_h); + SDL_SetWindowSize(window, window_w, window_h); + // printf("Resize windows: %dx%d\n", window_w, window_h); } else if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) { @@ -702,13 +765,13 @@ int main() { } else if (event.type == REFRESH_EVENT) { sdlRect.x = 0; sdlRect.y = 0; - sdlRect.w = screen_w; - sdlRect.h = screen_h; + sdlRect.w = window_w; + sdlRect.h = window_h; SDL_UpdateTexture(sdlTexture, NULL, dst_buffer, pixel_w); } else { if (joined) { - // ProcessMouseKeyEven(event); + ProcessMouseKeyEven(event); } } } @@ -741,6 +804,8 @@ int main() { } // Cleanup + LeaveConnection(peer_server); + ImGui_ImplSDLRenderer2_Shutdown(); ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); diff --git a/screen_capture/linux/screen_capture_x11.cpp b/src/screen_capture/linux/screen_capture_x11.cpp similarity index 100% rename from screen_capture/linux/screen_capture_x11.cpp rename to src/screen_capture/linux/screen_capture_x11.cpp diff --git a/screen_capture/linux/screen_capture_x11.h b/src/screen_capture/linux/screen_capture_x11.h similarity index 100% rename from screen_capture/linux/screen_capture_x11.h rename to src/screen_capture/linux/screen_capture_x11.h diff --git a/screen_capture/linux/x11_session.h b/src/screen_capture/linux/x11_session.h similarity index 100% rename from screen_capture/linux/x11_session.h rename to src/screen_capture/linux/x11_session.h diff --git a/screen_capture/linux/x11_session_impl.cpp b/src/screen_capture/linux/x11_session_impl.cpp similarity index 100% rename from screen_capture/linux/x11_session_impl.cpp rename to src/screen_capture/linux/x11_session_impl.cpp diff --git a/screen_capture/linux/x11_session_impl.h b/src/screen_capture/linux/x11_session_impl.h similarity index 100% rename from screen_capture/linux/x11_session_impl.h rename to src/screen_capture/linux/x11_session_impl.h diff --git a/screen_capture/macosx/screen_capture_wgc.cpp b/src/screen_capture/macosx/screen_capture_wgc.cpp similarity index 100% rename from screen_capture/macosx/screen_capture_wgc.cpp rename to src/screen_capture/macosx/screen_capture_wgc.cpp diff --git a/screen_capture/macosx/screen_capture_wgc.h b/src/screen_capture/macosx/screen_capture_wgc.h similarity index 100% rename from screen_capture/macosx/screen_capture_wgc.h rename to src/screen_capture/macosx/screen_capture_wgc.h diff --git a/screen_capture/windows/screen_capture_wgc.cpp b/src/screen_capture/windows/screen_capture_wgc.cpp similarity index 100% rename from screen_capture/windows/screen_capture_wgc.cpp rename to src/screen_capture/windows/screen_capture_wgc.cpp diff --git a/screen_capture/windows/screen_capture_wgc.h b/src/screen_capture/windows/screen_capture_wgc.h similarity index 100% rename from screen_capture/windows/screen_capture_wgc.h rename to src/screen_capture/windows/screen_capture_wgc.h diff --git a/screen_capture/windows/wgc_session.h b/src/screen_capture/windows/wgc_session.h similarity index 100% rename from screen_capture/windows/wgc_session.h rename to src/screen_capture/windows/wgc_session.h diff --git a/screen_capture/windows/wgc_session_impl.cpp b/src/screen_capture/windows/wgc_session_impl.cpp similarity index 100% rename from screen_capture/windows/wgc_session_impl.cpp rename to src/screen_capture/windows/wgc_session_impl.cpp diff --git a/screen_capture/windows/wgc_session_impl.h b/src/screen_capture/windows/wgc_session_impl.h similarity index 100% rename from screen_capture/windows/wgc_session_impl.h rename to src/screen_capture/windows/wgc_session_impl.h diff --git a/thirdparty/projectx b/thirdparty/projectx new file mode 160000 index 0000000..19506af --- /dev/null +++ b/thirdparty/projectx @@ -0,0 +1 @@ +Subproject commit 19506af8315cc636f8d9e639cbc392ec574464ed diff --git a/thirdparty/xmake.lua b/thirdparty/xmake.lua index 107552a..b798a04 100644 --- a/thirdparty/xmake.lua +++ b/thirdparty/xmake.lua @@ -1,4 +1,4 @@ -includes("sdl2") +includes("sdl2", "projectx") if is_plat("windows") then elseif is_plat("linux") then includes("ffmpeg") diff --git a/xmake.lua b/xmake.lua index e5c977e..2e1eb89 100644 --- a/xmake.lua +++ b/xmake.lua @@ -10,6 +10,7 @@ add_requires("imgui 1.89.9", {configs = {sdl2 = true, sdl2_renderer = true}}) add_defines("UNICODE") add_requires("sdl2", {system = false}) +add_requires("projectx") if is_os("windows") then add_links("Shell32", "windowsapp", "dwmapi", "User32", "kernel32") @@ -32,29 +33,28 @@ includes("thirdparty") target("log") set_kind("headeronly") add_packages("spdlog") - add_headerfiles("../utils/log/log.h") - add_includedirs("../utils/log", {public = true}) + add_headerfiles("src/log/log.h") + add_includedirs("src/log", {public = true}) target("screen_capture") set_kind("static") add_packages("log", "ffmpeg") if is_os("windows") then - add_files("screen_capture/windows/*.cpp") - add_includedirs("screen_capture/windows", {public = true}) + add_files("src/screen_capture/windows/*.cpp") + add_includedirs("src/screen_capture/windows", {public = true}) elseif is_os("macosx") then - add_files("screen_capture/macosx/*.cpp") - add_includedirs("screen_capture/macosx", {public = true}) + add_files("src/screen_capture/macosx/*.cpp") + add_includedirs("ssrc/creen_capture/macosx", {public = true}) elseif is_os("linux") then - add_files("screen_capture/linux/*.cpp") - add_includedirs("screen_capture/linux", {public = true}) + add_files("src/screen_capture/linux/*.cpp") + add_includedirs("src/screen_capture/linux", {public = true}) end target("remote_desk") set_kind("binary") - add_deps("projectx", "screen_capture") - add_packages("log", "sdl2", "imgui", "ffmpeg") - add_files("remote_desk_gui/main.cpp") - add_includedirs("../../src/interface") + add_deps("log", "screen_capture") + add_packages("sdl2", "imgui", "ffmpeg", "projectx") + add_files("src/remote_desk_gui/main.cpp") if is_os("windows") then add_links("SDL2-static", "SDL2main", "gdi32", "winmm", "setupapi", "version", "Imm32", "iphlpapi")