From 0d86e53a32fb62e6fa177b2bc67094d0fa92b26b Mon Sep 17 00:00:00 2001 From: XMRig Date: Sat, 16 Mar 2019 02:07:26 +0700 Subject: [PATCH] Move files. --- CMakeLists.txt | 58 ++---------------- cmake/OpenSSL.cmake | 4 ++ src/App.cpp | 2 +- src/App.h | 2 +- src/base/base.cmake | 60 +++++++++++++++++++ src/{common => base/io}/Console.cpp | 4 +- src/{common => base/io}/Console.h | 0 .../kernel}/interfaces/IConsoleListener.h | 0 src/common/utils/c_str.h | 39 ------------ src/common/utils/timestamp.h | 55 ----------------- 10 files changed, 74 insertions(+), 150 deletions(-) create mode 100644 src/base/base.cmake rename src/{common => base/io}/Console.cpp (96%) rename src/{common => base/io}/Console.h (100%) rename src/{common => base/kernel}/interfaces/IConsoleListener.h (100%) delete mode 100644 src/common/utils/c_str.h delete mode 100644 src/common/utils/timestamp.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f87a85df..c8e68648a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,50 +16,21 @@ option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF) include (CheckIncludeFile) include (cmake/cpu.cmake) +include (src/base/base.cmake) set(HEADERS + "${HEADERS_BASE}" src/api/NetworkState.h src/App.h - src/base/io/Json.h - src/base/io/Watcher.h - src/base/kernel/Entry.h - src/base/kernel/interfaces/IClientListener.h - src/base/kernel/interfaces/IConfigListener.h - src/base/kernel/interfaces/IDnsListener.h - src/base/kernel/interfaces/ILineListener.h - src/base/kernel/interfaces/ISignalListener.h - src/base/kernel/interfaces/IStrategy.h - src/base/kernel/interfaces/IStrategyListener.h - src/base/kernel/interfaces/IWatcherListener.h - src/base/kernel/Process.h - src/base/kernel/Signals.h - src/base/net/dns/Dns.h - src/base/net/dns/DnsRecord.h - src/base/net/stratum/Client.h - src/base/net/stratum/Job.h - src/base/net/stratum/Pool.h - src/base/net/stratum/Pools.h - src/base/net/stratum/strategies/FailoverStrategy.h - src/base/net/stratum/strategies/SinglePoolStrategy.h - src/base/net/stratum/SubmitResult.h - src/base/net/tools/RecvBuf.h - src/base/net/tools/Storage.h - src/base/tools/Arguments.h - src/base/tools/Buffer.h - src/base/tools/Chrono.h - src/base/tools/Handle.h - src/base/tools/String.h src/common/config/CommonConfig.h src/common/config/ConfigLoader.h src/common/config/ConfigWatcher.h - src/common/Console.h src/common/cpu/Cpu.h src/common/crypto/Algorithm.h src/common/crypto/keccak.h src/common/interfaces/IConfig.h src/common/interfaces/IConfigCreator.h - src/common/interfaces/IConsoleListener.h src/common/interfaces/IControllerListener.h src/common/interfaces/ICpuInfo.h src/common/interfaces/ILogBackend.h @@ -68,7 +39,6 @@ set(HEADERS src/common/log/FileLog.h src/common/log/Log.h src/common/Platform.h - src/common/utils/c_str.h src/common/utils/mm_malloc.h src/common/xmrig.h src/core/ConfigLoader_default.h @@ -114,28 +84,12 @@ else() endif() set(SOURCES + "${SOURCES_BASE}" src/api/NetworkState.cpp src/App.cpp - src/base/io/Json.cpp - src/base/io/Watcher.cpp - src/base/kernel/Entry.cpp - src/base/kernel/Process.cpp - src/base/kernel/Signals.cpp - src/base/net/dns/Dns.cpp - src/base/net/dns/DnsRecord.cpp - src/base/net/stratum/Client.cpp - src/base/net/stratum/Job.cpp - src/base/net/stratum/Pool.cpp - src/base/net/stratum/Pools.cpp - src/base/net/stratum/strategies/FailoverStrategy.cpp - src/base/net/stratum/strategies/SinglePoolStrategy.cpp - src/base/tools/Arguments.cpp - src/base/tools/Buffer.cpp - src/base/tools/String.cpp src/common/config/CommonConfig.cpp src/common/config/ConfigLoader.cpp src/common/config/ConfigWatcher.cpp - src/common/Console.cpp src/common/crypto/Algorithm.cpp src/common/crypto/keccak.cpp src/common/log/BasicLog.cpp @@ -167,9 +121,9 @@ set(SOURCES_CRYPTO if (WIN32) set(SOURCES_OS + "${SOURCES_OS}" res/app.rc src/App_win.cpp - src/base/io/Json_win.cpp src/common/Platform_win.cpp src/Mem_win.cpp ) @@ -178,15 +132,15 @@ if (WIN32) set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv) elseif (APPLE) set(SOURCES_OS + "${SOURCES_OS}" src/App_unix.cpp - src/base/io/Json_unix.cpp src/common/Platform_mac.cpp src/Mem_unix.cpp ) else() set(SOURCES_OS + "${SOURCES_OS}" src/App_unix.cpp - src/base/io/Json_unix.cpp src/common/Platform_unix.cpp src/Mem_unix.cpp ) diff --git a/cmake/OpenSSL.cmake b/cmake/OpenSSL.cmake index 5761f99f4..219d50b9d 100644 --- a/cmake/OpenSSL.cmake +++ b/cmake/OpenSSL.cmake @@ -16,9 +16,13 @@ if (WITH_TLS) else() message(FATAL_ERROR "OpenSSL NOT found: use `-DWITH_TLS=OFF` to build without TLS support") endif() + + add_definitions(/DXMRIG_FEATURE_TLS) + remove_definitions(/DXMRIG_NO_TLS) else() set(TLS_SOURCES "") set(OPENSSL_LIBRARIES "") + remove_definitions(/DXMRIG_FEATURE_TLS) add_definitions(/DXMRIG_NO_TLS) set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls") diff --git a/src/App.cpp b/src/App.cpp index 62dd38144..500a521d6 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -30,8 +30,8 @@ #include "api/Api.h" #include "App.h" +#include "base/io/Console.h" #include "base/kernel/Signals.h" -#include "common/Console.h" #include "common/cpu/Cpu.h" #include "common/log/Log.h" #include "common/Platform.h" diff --git a/src/App.h b/src/App.h index 02cc61a22..21e57725f 100644 --- a/src/App.h +++ b/src/App.h @@ -27,8 +27,8 @@ #define XMRIG_APP_H +#include "base/kernel/interfaces/IConsoleListener.h" #include "base/kernel/interfaces/ISignalListener.h" -#include "common/interfaces/IConsoleListener.h" class Httpd; diff --git a/src/base/base.cmake b/src/base/base.cmake new file mode 100644 index 000000000..79181f05f --- /dev/null +++ b/src/base/base.cmake @@ -0,0 +1,60 @@ +set(HEADERS_BASE + src/base/io/Console.h + src/base/io/Json.h + src/base/io/Watcher.h + src/base/kernel/Entry.h + src/base/kernel/interfaces/IClientListener.h + src/base/kernel/interfaces/IConfigListener.h + src/base/kernel/interfaces/IConsoleListener.h + src/base/kernel/interfaces/IDnsListener.h + src/base/kernel/interfaces/ILineListener.h + src/base/kernel/interfaces/ISignalListener.h + src/base/kernel/interfaces/IStrategy.h + src/base/kernel/interfaces/IStrategyListener.h + src/base/kernel/interfaces/IWatcherListener.h + src/base/kernel/Process.h + src/base/kernel/Signals.h + src/base/net/dns/Dns.h + src/base/net/dns/DnsRecord.h + src/base/net/stratum/Client.h + src/base/net/stratum/Job.h + src/base/net/stratum/Pool.h + src/base/net/stratum/Pools.h + src/base/net/stratum/strategies/FailoverStrategy.h + src/base/net/stratum/strategies/SinglePoolStrategy.h + src/base/net/stratum/SubmitResult.h + src/base/net/tools/RecvBuf.h + src/base/net/tools/Storage.h + src/base/tools/Arguments.h + src/base/tools/Buffer.h + src/base/tools/Chrono.h + src/base/tools/Handle.h + src/base/tools/String.h + ) + +set(SOURCES_BASE + src/base/io/Console.cpp + src/base/io/Json.cpp + src/base/io/Watcher.cpp + src/base/kernel/Entry.cpp + src/base/kernel/Process.cpp + src/base/kernel/Signals.cpp + src/base/net/dns/Dns.cpp + src/base/net/dns/DnsRecord.cpp + src/base/net/stratum/Client.cpp + src/base/net/stratum/Job.cpp + src/base/net/stratum/Pool.cpp + src/base/net/stratum/Pools.cpp + src/base/net/stratum/strategies/FailoverStrategy.cpp + src/base/net/stratum/strategies/SinglePoolStrategy.cpp + src/base/tools/Arguments.cpp + src/base/tools/Buffer.cpp + src/base/tools/String.cpp + ) + + +if (WIN32) + set(SOURCES_OS src/base/io/Json_win.cpp) +else() + set(SOURCES_OS src/base/io/Json_unix.cpp) +endif() diff --git a/src/common/Console.cpp b/src/base/io/Console.cpp similarity index 96% rename from src/common/Console.cpp rename to src/base/io/Console.cpp index 8e5d7285d..cb23c4b08 100644 --- a/src/common/Console.cpp +++ b/src/base/io/Console.cpp @@ -23,9 +23,9 @@ */ +#include "base/io/Console.h" +#include "base/kernel/interfaces/IConsoleListener.h" #include "base/tools/Handle.h" -#include "common/Console.h" -#include "interfaces/IConsoleListener.h" xmrig::Console::Console(IConsoleListener *listener) diff --git a/src/common/Console.h b/src/base/io/Console.h similarity index 100% rename from src/common/Console.h rename to src/base/io/Console.h diff --git a/src/common/interfaces/IConsoleListener.h b/src/base/kernel/interfaces/IConsoleListener.h similarity index 100% rename from src/common/interfaces/IConsoleListener.h rename to src/base/kernel/interfaces/IConsoleListener.h diff --git a/src/common/utils/c_str.h b/src/common/utils/c_str.h deleted file mode 100644 index fe0164b9e..000000000 --- a/src/common/utils/c_str.h +++ /dev/null @@ -1,39 +0,0 @@ -/* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2016-2018 XMRig , - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef XMRIG_C_STR_H -#define XMRIG_C_STR_H - - -#include "base/tools/String.h" - - -namespace xmrig { - - -typedef String c_str; - - -} /* namespace xmrig */ - -#endif /* XMRIG_C_STR_H */ diff --git a/src/common/utils/timestamp.h b/src/common/utils/timestamp.h deleted file mode 100644 index 7fc4ab503..000000000 --- a/src/common/utils/timestamp.h +++ /dev/null @@ -1,55 +0,0 @@ -/* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2016-2018 XMRig , - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef XMRIG_TIMESTAMP_H -#define XMRIG_TIMESTAMP_H - - -#include - - -namespace xmrig { - - -static inline int64_t steadyTimestamp() -{ - using namespace std::chrono; - if (high_resolution_clock::is_steady) { - return time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); - } - - return time_point_cast(steady_clock::now()).time_since_epoch().count(); -} - - -static inline int64_t currentMSecsSinceEpoch() -{ - using namespace std::chrono; - - return time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); -} - - -} /* namespace xmrig */ - -#endif /* XMRIG_TIMESTAMP_H */