build: rm SERVER_BINARY_NAME define

This commit is contained in:
sithlord48 2024-10-28 21:31:33 -04:00 committed by Nick Bolton
parent 078ec61e9a
commit e52ce58541
11 changed files with 22 additions and 23 deletions

View file

@ -97,7 +97,7 @@ macro(post_config_all)
run_post_build run_post_build
deskflow deskflow
${CLIENT_BINARY_NAME} ${CLIENT_BINARY_NAME}
${SERVER_BINARY_NAME} deskflow-server
${DAEMON_BINARY_NAME}) ${DAEMON_BINARY_NAME})
endif() endif()

View file

@ -73,10 +73,6 @@ endmacro()
macro(configure_bin_names) macro(configure_bin_names)
set(SERVER_BINARY_NAME
"deskflow-server"
CACHE STRING "Filename of the server binary")
set(CLIENT_BINARY_NAME set(CLIENT_BINARY_NAME
"deskflow-client" "deskflow-client"
CACHE STRING "Filename of the client binary") CACHE STRING "Filename of the client binary")
@ -90,13 +86,11 @@ macro(configure_bin_names)
CACHE STRING "Filename of the daemon binary") CACHE STRING "Filename of the daemon binary")
message(VERBOSE "Server binary: ${SERVER_BINARY_NAME}")
message(VERBOSE "Client binary: ${CLIENT_BINARY_NAME}") message(VERBOSE "Client binary: ${CLIENT_BINARY_NAME}")
message(VERBOSE "Core binary: ${CORE_BINARY_NAME}") message(VERBOSE "Core binary: ${CORE_BINARY_NAME}")
message(VERBOSE "Daemon binary: ${DAEMON_BINARY_NAME}") message(VERBOSE "Daemon binary: ${DAEMON_BINARY_NAME}")
add_definitions(-DSERVER_BINARY_NAME="${SERVER_BINARY_NAME}")
add_definitions(-DCLIENT_BINARY_NAME="${CLIENT_BINARY_NAME}") add_definitions(-DCLIENT_BINARY_NAME="${CLIENT_BINARY_NAME}")
add_definitions(-DCORE_BINARY_NAME="${CORE_BINARY_NAME}") add_definitions(-DCORE_BINARY_NAME="${CORE_BINARY_NAME}")
add_definitions(-DDAEMON_BINARY_NAME="${DAEMON_BINARY_NAME}") add_definitions(-DDAEMON_BINARY_NAME="${DAEMON_BINARY_NAME}")

View file

@ -22,7 +22,7 @@
<?define OpenSslExeDir="@OPENSSL_EXE_DIR@"?> <?define OpenSslExeDir="@OPENSSL_EXE_DIR@"?>
<?define OpenSslDllDir="@OPENSSL_ROOT_DIR@/bin"?> <?define OpenSslDllDir="@OPENSSL_ROOT_DIR@/bin"?>
<?define GuiBin="deskflow.exe"?> <?define GuiBin="deskflow.exe"?>
<?define ServerBin="@SERVER_BINARY_NAME@.exe"?> <?define ServerBin="deskflow-server.exe"?>
<?define ClientBin="@CLIENT_BINARY_NAME@.exe"?> <?define ClientBin="@CLIENT_BINARY_NAME@.exe"?>
<?define CoreBin="@CORE_BINARY_NAME@.exe"?> <?define CoreBin="@CORE_BINARY_NAME@.exe"?>
<?define DaemonBin="@DAEMON_BINARY_NAME@.exe"?> <?define DaemonBin="@DAEMON_BINARY_NAME@.exe"?>

View file

@ -29,7 +29,7 @@
void showHelp() void showHelp()
{ {
std::cout << "Usage: " CORE_BINARY_NAME " <server | client> [...options]" << std::endl; std::cout << "Usage: " CORE_BINARY_NAME " <server | client> [...options]" << std::endl;
std::cout << "server - start as a server (" << SERVER_BINARY_NAME << ")" << std::endl; std::cout << "server - start as a server ( deskflow-server)" << std::endl;
std::cout << "client - start as a client (" << CLIENT_BINARY_NAME << ")" << std::endl; std::cout << "client - start as a client (" << CLIENT_BINARY_NAME << ")" << std::endl;
std::cout << "use " CORE_BINARY_NAME " <server|client> --help for more information." << std::endl; std::cout << "use " CORE_BINARY_NAME " <server|client> --help for more information." << std::endl;
} }

View file

@ -15,14 +15,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
set(server_source_name "deskflows") set(target deskflow-server)
set(target ${SERVER_BINARY_NAME})
if(WIN32) if(WIN32)
set(PLATFORM_SOURCES set(PLATFORM_SOURCES
${server_source_name}.exe.manifest deskflows.exe.manifest
${server_source_name}.ico deskflows.ico
${server_source_name}.rc deskflows.rc
MSWindowsServerTaskBarReceiver.cpp MSWindowsServerTaskBarReceiver.cpp
MSWindowsServerTaskBarReceiver.h MSWindowsServerTaskBarReceiver.h
resource.h resource.h
@ -44,7 +43,7 @@ elseif(UNIX)
) )
endif() endif()
add_executable(${target} ${PLATFORM_SOURCES} "${server_source_name}.cpp") add_executable(${target} ${PLATFORM_SOURCES} deskflows.cpp)
target_link_libraries( target_link_libraries(
${target} ${target}

View file

@ -78,7 +78,7 @@ bool isServerCommandLine(const std::vector<String> &cmd)
auto isServer = false; auto isServer = false;
if (cmd.size() > 1) { if (cmd.size() > 1) {
isServer = (cmd[0].find(SERVER_BINARY_NAME) != String::npos) || isServer = (cmd[0].find("deskflow-server") != String::npos) ||
(cmd[0].find(CORE_BINARY_NAME) != String::npos && cmd[1] == "server"); (cmd[0].find(CORE_BINARY_NAME) != String::npos && cmd[1] == "server");
} }

View file

@ -847,7 +847,7 @@ const char *ServerApp::daemonName() const
#if SYSAPI_WIN32 #if SYSAPI_WIN32
return "Deskflow Server"; return "Deskflow Server";
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
return SERVER_BINARY_NAME; return "deskflow-server";
#endif #endif
} }

View file

@ -35,11 +35,9 @@ const int kWizardVersion = 8;
static const char *const kLogLevelNames[] = {"INFO", "DEBUG", "DEBUG1", "DEBUG2"}; static const char *const kLogLevelNames[] = {"INFO", "DEBUG", "DEBUG1", "DEBUG2"};
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const char AppConfig::m_CoreServerName[] = SERVER_BINARY_NAME ".exe";
const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME ".exe"; const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME ".exe";
const char AppConfig::m_LogDir[] = "log/"; const char AppConfig::m_LogDir[] = "log/";
#else #else
const char AppConfig::m_CoreServerName[] = SERVER_BINARY_NAME;
const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME; const char AppConfig::m_CoreClientName[] = CLIENT_BINARY_NAME;
const char AppConfig::m_LogDir[] = "/var/log/"; const char AppConfig::m_LogDir[] = "/var/log/";
#endif #endif
@ -469,7 +467,11 @@ QString AppConfig::lastVersion() const
QString AppConfig::coreServerName() const QString AppConfig::coreServerName() const
{ {
return m_CoreServerName; #ifdef Q_OS_WIN
return s_winExeTemplate.arg(s_CoreServerName);
#else
return s_CoreServerName;
#endif
} }
QString AppConfig::coreClientName() const QString AppConfig::coreClientName() const

View file

@ -289,7 +289,11 @@ private:
*/ */
QString defaultTlsCertPath() const; QString defaultTlsCertPath() const;
static const char m_CoreServerName[]; // Used to make the server and client names on windows.
#ifdef Q_OS_WIN
inline static const auto s_winExeTemplate = QStringLiteral("%1.exe");
#endif
inline static const auto s_CoreServerName = QStringLiteral("deskflow-server");
static const char m_CoreClientName[]; static const char m_CoreClientName[];
static const char m_LogDir[]; static const char m_LogDir[];

View file

@ -571,7 +571,7 @@ void MSWindowsWatchdog::shutdownExistingProcesses()
if (entry.th32ProcessID != 0) { if (entry.th32ProcessID != 0) {
if (_stricmp(entry.szExeFile, CLIENT_BINARY_NAME ".exe") == 0 || if (_stricmp(entry.szExeFile, CLIENT_BINARY_NAME ".exe") == 0 ||
_stricmp(entry.szExeFile, SERVER_BINARY_NAME ".exe") == 0 || _stricmp(entry.szExeFile, "deskflow-server.exe") == 0 ||
_stricmp(entry.szExeFile, CORE_BINARY_NAME ".exe") == 0) { _stricmp(entry.szExeFile, CORE_BINARY_NAME ".exe") == 0) {
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID); HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);

View file

@ -40,7 +40,7 @@ TEST(ServerAppTests, runInner_will_handle_configuration_lifetime)
EXPECT_FALSE(app.args().m_config); EXPECT_FALSE(app.args().m_config);
const char *argv[]{SERVER_BINARY_NAME}; const char *argv[]{"deskflow-server"};
app.runInner(1, const_cast<char **>(argv), nullptr, [](int, char **) { return 0; }); app.runInner(1, const_cast<char **>(argv), nullptr, [](int, char **) { return 0; });
EXPECT_TRUE(app.args().m_config); EXPECT_TRUE(app.args().m_config);