From 3b2d7fc0b3862ae3cc93c9cba913e81ccceb3549 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 19 Aug 2025 11:58:21 -0400 Subject: [PATCH] feat: Switch to deskflow-core instead of split binaries --- deploy/windows/wix-patch.xml.in | 9 +-- doc/dev/build.md | 4 +- src/apps/CMakeLists.txt | 8 +-- src/apps/deskflow-client/CMakeLists.txt | 65 ------------------- src/apps/deskflow-client/deskflow-client.cpp | 40 ------------ .../deskflow-client.exe.manifest | 17 ----- src/apps/deskflow-server/CMakeLists.txt | 64 ------------------ src/apps/deskflow-server/deskflow-server.cpp | 40 ------------ .../deskflow-server.exe.manifest | 17 ----- src/lib/common/CMakeLists.txt | 12 +--- src/lib/common/Constants.h.in | 3 +- src/lib/common/Settings.cpp | 4 +- src/lib/gui/core/CoreProcess.cpp | 16 ++--- 13 files changed, 17 insertions(+), 282 deletions(-) delete mode 100644 src/apps/deskflow-client/CMakeLists.txt delete mode 100644 src/apps/deskflow-client/deskflow-client.cpp delete mode 100644 src/apps/deskflow-client/deskflow-client.exe.manifest delete mode 100644 src/apps/deskflow-server/CMakeLists.txt delete mode 100644 src/apps/deskflow-server/deskflow-server.cpp delete mode 100644 src/apps/deskflow-server/deskflow-server.exe.manifest diff --git a/deploy/windows/wix-patch.xml.in b/deploy/windows/wix-patch.xml.in index e95865bd6..22cf616ff 100644 --- a/deploy/windows/wix-patch.xml.in +++ b/deploy/windows/wix-patch.xml.in @@ -20,12 +20,9 @@ - - - - - - + + + diff --git a/doc/dev/build.md b/doc/dev/build.md index 15e89af27..924dcf3d7 100644 --- a/doc/dev/build.md +++ b/doc/dev/build.md @@ -14,8 +14,7 @@ To build Deskflow you will a minimum of: By default a build of Deskflow will: - The GUI application deskflow - - The Client application deskflow-client - - The Server application deskflow-server + - The Core application deskflow-core - Documentation if [doxygen] was found on your system - Tests that will be run as part of the build process. @@ -30,7 +29,6 @@ CMake options: | BUILD_DEV_DOCS | Build development documentation | OFF | `Doxygen` | | BUILD_INSTALLER | Build installers/packages | ON | | | BUILD_TESTS | Build unit tests and legacy tests | ON | `gtest`| -| BUILD_UNIFIED | Build unified binary (client+server) | OFF | | | ENABLE_COVERAGE | Enable test coverage | OFF | `gcov` | | SKIP_BUILD_TESTS | Skip running of tests at build time | OFF | | | VCPKG_QT | Build Qt w/ vcpkg (windows only) | OFF | | diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index 2e55ecfe9..9d7ad20c8 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -28,13 +28,7 @@ function(generate_app_man TARGET NAME) endif() endfunction() -option(BUILD_UNIFIED "Build unified binary" OFF) -if(BUILD_UNIFIED) - add_subdirectory(deskflow-core) -else() - add_subdirectory(deskflow-client) - add_subdirectory(deskflow-server) -endif(BUILD_UNIFIED) +add_subdirectory(deskflow-core) ## Only used on windows add_subdirectory(deskflow-daemon) diff --git a/src/apps/deskflow-client/CMakeLists.txt b/src/apps/deskflow-client/CMakeLists.txt deleted file mode 100644 index 7d8ea85e7..000000000 --- a/src/apps/deskflow-client/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -# SPDX-FileCopyrightText: 2024 - 2025 Chris Rizzitello -# SPDX-FileCopyrightText: 2012 - 2024 Symless Ltd -# SPDX-FileCopyrightText: 2009 - 2012 Nick Bolton -# SPDX-License-Identifier: MIT - -set(target ${CMAKE_PROJECT_NAME}-client) - -if(WIN32) - # Generate rc file - set(EXE_DESCRIPTION "${CMAKE_PROJECT_PROPER_NAME} client application") - - set(EXE_ICON " - IDI_DESKFLOW ICON DISCARDABLE \"${CMAKE_SOURCE_DIR}/src/apps/res/deskflow.ico\" - ") - - configure_file(${CMAKE_SOURCE_DIR}/src/apps/res/windows.rc.in ${target}.rc) - - set(PLATFORM_SOURCES - ${target}.exe.manifest - ${PROJECT_SOURCE_DIR}/src/apps/res/deskflow.ico - ${CMAKE_CURRENT_BINARY_DIR}/${target}.rc - ) -endif() - -add_executable(${target} ${PLATFORM_SOURCES} ${target}.cpp) - -target_link_libraries( - ${target} - arch - base - client - io - mt - net - platform - server - app - ${libs}) - -if(APPLE) - set_target_properties(${target} PROPERTIES - BUILD_WITH_INSTALL_RPATH TRUE - INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks" - RUNTIME_OUTPUT_DIRECTORY $/MacOS - ) -elseif(UNIX) - install(TARGETS ${target} DESTINATION bin) - generate_app_man(${target} "${CMAKE_PROJECT_DESCRIPTION} \\(Client\\)") -elseif(WIN32) - install( - TARGETS ${target} - RUNTIME_DEPENDENCY_SET clientDeps - DESTINATION . - ) - install(RUNTIME_DEPENDENCY_SET clientDeps - PRE_EXCLUDE_REGEXES - "api-ms-win-.*" - "ext-ms-.*" - "^hvsifiletrust\\.dll$" - POST_EXCLUDE_REGEXES - ".*system32.*" - RUNTIME DESTINATION . - ) -endif() - diff --git a/src/apps/deskflow-client/deskflow-client.cpp b/src/apps/deskflow-client/deskflow-client.cpp deleted file mode 100644 index 68b374e82..000000000 --- a/src/apps/deskflow-client/deskflow-client.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello - * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. - * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#include "arch/Arch.h" -#include "base/EventQueue.h" -#include "base/Log.h" -#include "deskflow/ClientApp.h" - -#if SYSAPI_WIN32 -#include "arch/win32/ArchMiscWindows.h" -#include -#endif - -int main(int argc, char **argv) -{ -#if SYSAPI_WIN32 - // HACK to make sure settings gets the correct qApp path - QCoreApplication m(argc, argv); - m.deleteLater(); - - ArchMiscWindows::guardRuntimeVersion(); - - // record window instance for tray icon, etc - ArchMiscWindows::setInstanceWin32(GetModuleHandle(nullptr)); -#endif - - Arch arch; - arch.init(); - - Log log; - EventQueue events; - - ClientApp app(&events); - return app.run(argc, argv); -} diff --git a/src/apps/deskflow-client/deskflow-client.exe.manifest b/src/apps/deskflow-client/deskflow-client.exe.manifest deleted file mode 100644 index ecd2728a1..000000000 --- a/src/apps/deskflow-client/deskflow-client.exe.manifest +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - PerMonitor - true - - - \ No newline at end of file diff --git a/src/apps/deskflow-server/CMakeLists.txt b/src/apps/deskflow-server/CMakeLists.txt deleted file mode 100644 index 09fcc4fe9..000000000 --- a/src/apps/deskflow-server/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# SPDX-FileCopyrightText: 2024 - 2025 Chris Rizzitello -# SPDX-FileCopyrightText: 2012 - 2024 Symless Ltd -# SPDX-FileCopyrightText: 2009 - 2012 Nick Bolton -# SPDX-License-Identifier: MIT - -set(target ${CMAKE_PROJECT_NAME}-server) - -if(WIN32) - # Generate rc file - set(EXE_DESCRIPTION "${CMAKE_PROJECT_PROPER_NAME} server application") - - set(EXE_ICON " - IDI_DESKFLOW ICON DISCARDABLE \"${CMAKE_SOURCE_DIR}/src/apps/res/deskflow.ico\" - ") - - configure_file(${CMAKE_SOURCE_DIR}/src/apps/res/windows.rc.in ${target}.rc) - - set(PLATFORM_SOURCES - ${target}.exe.manifest - ${PROJECT_SOURCE_DIR}/src/apps/res/deskflow.ico - ${CMAKE_CURRENT_BINARY_DIR}/${target}.rc - ) -endif() - -add_executable(${target} ${PLATFORM_SOURCES} ${target}.cpp) - -target_link_libraries( - ${target} - arch - base - client - io - mt - net - platform - server - app - ${libs}) - -if(APPLE) - set_target_properties(${target} PROPERTIES - BUILD_WITH_INSTALL_RPATH TRUE - INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks" - RUNTIME_OUTPUT_DIRECTORY $/MacOS - ) -elseif(UNIX) - install(TARGETS ${target} DESTINATION bin) - generate_app_man(${target} "${CMAKE_PROJECT_DESCRIPTION} \\(Server\\)") -elseif(WIN32) - install( - TARGETS ${target} - RUNTIME_DEPENDENCY_SET serverDeps - DESTINATION . - ) - install(RUNTIME_DEPENDENCY_SET serverDeps - PRE_EXCLUDE_REGEXES - "api-ms-win-.*" - "ext-ms-.*" - "^hvsifiletrust\\.dll$" - POST_EXCLUDE_REGEXES - ".*system32.*" - RUNTIME DESTINATION . - ) -endif() diff --git a/src/apps/deskflow-server/deskflow-server.cpp b/src/apps/deskflow-server/deskflow-server.cpp deleted file mode 100644 index fc95a70fd..000000000 --- a/src/apps/deskflow-server/deskflow-server.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello - * SPDX-FileCopyrightText: (C) 2012-2016 Symless Ltd. - * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#include "arch/Arch.h" -#include "base/EventQueue.h" -#include "base/Log.h" -#include "deskflow/ServerApp.h" - -#if SYSAPI_WIN32 -#include "arch/win32/ArchMiscWindows.h" -#include -#endif - -int main(int argc, char **argv) -{ -#if SYSAPI_WIN32 - // HACK to make sure settings gets the correct qApp path - QCoreApplication m(argc, argv); - m.deleteLater(); - - ArchMiscWindows::guardRuntimeVersion(); - - // record window instance for tray icon, etc - ArchMiscWindows::setInstanceWin32(GetModuleHandle(nullptr)); -#endif - - Arch arch; - arch.init(); - - Log log; - EventQueue events; - - ServerApp app(&events); - return app.run(argc, argv); -} diff --git a/src/apps/deskflow-server/deskflow-server.exe.manifest b/src/apps/deskflow-server/deskflow-server.exe.manifest deleted file mode 100644 index ecd2728a1..000000000 --- a/src/apps/deskflow-server/deskflow-server.exe.manifest +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - PerMonitor - true - - - \ No newline at end of file diff --git a/src/lib/common/CMakeLists.txt b/src/lib/common/CMakeLists.txt index fb937a8eb..e9556cc24 100644 --- a/src/lib/common/CMakeLists.txt +++ b/src/lib/common/CMakeLists.txt @@ -1,17 +1,9 @@ # SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello # SPDX-License-Identifier: MIT -if(BUILD_UNIFIED) - set(CLIENT_BINARY "${CMAKE_PROJECT_NAME}-core") - set(SERVER_BINARY "${CMAKE_PROJECT_NAME}-core") -else() - set(CLIENT_BINARY "${CMAKE_PROJECT_NAME}-client") - set(SERVER_BINARY "${CMAKE_PROJECT_NAME}-server") -endif() - + set(CORE_BINARY "${CMAKE_PROJECT_NAME}-core") if(WIN32) - string(APPEND CLIENT_BINARY ".exe") - string(APPEND SERVER_BINARY ".exe") + string(APPEND CORE_BINARY ".exe") endif() configure_file(Constants.h.in Constants.h @ONLY) diff --git a/src/lib/common/Constants.h.in b/src/lib/common/Constants.h.in index 5e006de68..193495846 100644 --- a/src/lib/common/Constants.h.in +++ b/src/lib/common/Constants.h.in @@ -22,8 +22,7 @@ const auto kCopyright = // "Copyright (C) 2002-2009 Chris Schoeneman"; -const auto kClientBinName = "@CLIENT_BINARY@"; -const auto kServerBinName = "@SERVER_BINARY@"; +const auto kCoreBinName = "@CORE_BINARY@"; #ifndef NDEBUG const auto kDebugBuild = true; diff --git a/src/lib/common/Settings.cpp b/src/lib/common/Settings.cpp index ee9ffc94e..9658e998e 100644 --- a/src/lib/common/Settings.cpp +++ b/src/lib/common/Settings.cpp @@ -104,10 +104,10 @@ QVariant Settings::defaultValue(const QString &key) return 0; if (key == Client::Binary) - return kClientBinName; + return kCoreBinName; if (key == Server::Binary) - return kServerBinName; + return kCoreBinName; if (key == Daemon::Elevate) return Settings::isNativeMode(); diff --git a/src/lib/gui/core/CoreProcess.cpp b/src/lib/gui/core/CoreProcess.cpp index 4fb6c88df..8883e7223 100644 --- a/src/lib/gui/core/CoreProcess.cpp +++ b/src/lib/gui/core/CoreProcess.cpp @@ -376,15 +376,13 @@ void CoreProcess::start(std::optional processModeOption) return; } - if (app.endsWith("core") || app.endsWith("core.exe")) { - if (mode() == Server) { - args.prepend("server"); - } else if (mode() == Client) { - args.prepend("client"); - } else { - qFatal("core started without mode"); - return; - } + if (mode() == Server) { + args.prepend("server"); + } else if (mode() == Client) { + args.prepend("client"); + } else { + qFatal("core started without mode"); + return; } qDebug().noquote() << "log level:" << Settings::logLevelText();