feat: Switch to deskflow-core instead of split binaries

This commit is contained in:
sithlord48
2025-08-19 11:58:21 -04:00
committed by Nick Bolton
parent 7cac145500
commit 3b2d7fc0b3
13 changed files with 17 additions and 282 deletions

View File

@ -20,12 +20,9 @@
<RemoveFile Id="RmOldLog" On="install" Name="deskflow-daemon.log"/>
</CPackWiXFragment>
<CPackWiXFragment Id="CM_CP_deskflow_server.exe">
<firewall:FirewallException Id="ServerFirewallException" Name="Deskflow Server" Program="[INSTALL_ROOT]deskflow-server.exe" Scope="any"/>
</CPackWiXFragment>
<CPackWiXFragment Id="CM_CP_deskflow_client.exe">
<firewall:FirewallException Id="ClientFirewallException" Name="Deskflow Client" Program="[INSTALL_ROOT]deskflow-client.exe" Scope="any"/>
<CPackWiXFragment Id="CM_CP_deskflow_core.exe">
<firewall:FirewallException Id="ServerFirewallException" Name="Deskflow Server" Program="[INSTALL_ROOT]deskflow-core.exe" Scope="any"/>
<firewall:FirewallException Id="ClientFirewallException" Name="Deskflow Client" Program="[INSTALL_ROOT]deskflow-core.exe" Scope="any"/>
</CPackWiXFragment>
<CPackWiXFragment Id="#PRODUCT">

View File

@ -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 | |

View File

@ -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)

View File

@ -1,65 +0,0 @@
# SPDX-FileCopyrightText: 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
# 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 $<TARGET_BUNDLE_CONTENT_DIR:${CMAKE_PROJECT_PROPER_NAME}>/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()

View File

@ -1,40 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* 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 <QCoreApplication>
#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);
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
</assembly>

View File

@ -1,64 +0,0 @@
# SPDX-FileCopyrightText: 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
# 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 $<TARGET_BUNDLE_CONTENT_DIR:${CMAKE_PROJECT_PROPER_NAME}>/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()

View File

@ -1,40 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* 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 <QCoreApplication>
#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);
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
</assembly>

View File

@ -1,17 +1,9 @@
# SPDX-FileCopyrightText: (C) 2024 - 2025 Chris Rizzitello <sithlord48@gmail.com>
# 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)

View File

@ -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;

View File

@ -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();

View File

@ -376,15 +376,13 @@ void CoreProcess::start(std::optional<ProcessMode> 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();