Made executable names of miner and daemon settable via CMake parameters.
This commit is contained in:
parent
67220c8d3d
commit
fa0d1e2d0e
3 changed files with 14 additions and 3 deletions
|
@ -11,6 +11,8 @@ option(WITH_HTTPD "HTTP REST API" OFF)
|
|||
option(WITH_CC_CLIENT "CC Client" ON)
|
||||
option(WITH_CC_SERVER "CC Server" ON)
|
||||
option(WITH_TLS "TLS support" ON)
|
||||
set(MINER_EXECUTABLE_NAME "xmrigMiner" CACHE STRING "Miner executable file name")
|
||||
set(DAEMON_EXECUTABLE_NAME "xmrigDaemon" CACHE STRING "Daemon executable file name")
|
||||
|
||||
include (CheckIncludeFile)
|
||||
include (cmake/cpu.cmake)
|
||||
|
@ -104,6 +106,7 @@ endif()
|
|||
|
||||
add_definitions(/D__STDC_FORMAT_MACROS)
|
||||
add_definitions(/DUNICODE)
|
||||
add_definitions(/DMINER_EXECUTABLE_NAME=${MINER_EXECUTABLE_NAME})
|
||||
#add_definitions(/DAPP_DEBUG)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
@ -217,6 +220,7 @@ if (WITH_CC_SERVER OR WITH_CC_CLIENT)
|
|||
endif (WITH_CC_SERVER OR WITH_CC_CLIENT)
|
||||
|
||||
add_executable(xmrigMiner ${SOURCES} ${SOURCES_CRYPTO} ${HTTPD_SOURCES} ${SOURCES_CC_CLIENT} res/app.rc)
|
||||
set_target_properties(xmrigMiner PROPERTIES OUTPUT_NAME ${MINER_EXECUTABLE_NAME})
|
||||
|
||||
target_link_libraries(xmrigMiner xmrig_tls xmrig_common xmrig_os_dependencies xmrig_cpuid
|
||||
${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB} ${OPENSSL_LIBRARIES})
|
||||
|
@ -226,6 +230,7 @@ if (WITH_CC_CLIENT)
|
|||
endif (WITH_CC_CLIENT)
|
||||
|
||||
add_executable(xmrigDaemon src/cc/XMRigd.cpp res/app.rc)
|
||||
set_target_properties(xmrigDaemon PROPERTIES OUTPUT_NAME ${DAEMON_EXECUTABLE_NAME})
|
||||
|
||||
if (WITH_CC_SERVER AND MHD_FOUND)
|
||||
add_library(xmrig_common_cc STATIC ${SOURCES_COMMON})
|
||||
|
|
|
@ -36,16 +36,22 @@
|
|||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifndef MINER_EXECUTABLE_NAME
|
||||
#define MINER_EXECUTABLE_NAME xmrigMiner
|
||||
#endif
|
||||
#define VALUE_TO_STRING(x) #x
|
||||
#define VALUE(x) VALUE_TO_STRING(x)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
std::string ownPath(argv[0]);
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
int pos = ownPath.rfind('\\');
|
||||
std::string xmrigMiner("xmrigMiner.exe");
|
||||
std::string xmrigMiner( VALUE(MINER_EXECUTABLE_NAME) ".exe");
|
||||
#else
|
||||
int pos = ownPath.rfind('/');
|
||||
std::string xmrigMiner("xmrigMiner");
|
||||
std::string xmrigMiner( VALUE(MINER_EXECUTABLE_NAME) );
|
||||
#endif
|
||||
|
||||
std::string xmrigMinerPath = ownPath.substr(0, pos+1) + xmrigMiner;
|
||||
|
|
|
@ -282,7 +282,7 @@ void Client::onRead(net_t *net, size_t size, char *buf)
|
|||
{
|
||||
auto client = getClient(net->data);
|
||||
|
||||
if (size < 0) {
|
||||
if (size == 0) {
|
||||
if (size != UV_EOF && !client->m_quiet) {
|
||||
LOG_ERR("[%s:%u] read error: \"%s\"", client->m_url.host(), client->m_url.port(), uv_strerror((int) size));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue