From d7a6aaadeac6a0ff07d5abef40851e18c32c57eb Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 3 Sep 2021 23:34:53 +0700 Subject: [PATCH] Update for new Entry class. --- res/app.rc | 2 +- src/backend/opencl/wrappers/OclPlatform.cpp | 30 ++++++++++++++------- src/backend/opencl/wrappers/OclPlatform.h | 11 +++----- src/base | 2 +- src/core/config/usage.h | 13 ++------- src/version.h | 24 ++--------------- src/xmrig.cpp | 21 ++++++++++++--- 7 files changed, 48 insertions(+), 55 deletions(-) diff --git a/res/app.rc b/res/app.rc index fb41b8b1..0330b39d 100644 --- a/res/app.rc +++ b/res/app.rc @@ -20,7 +20,7 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "000004b0" BEGIN - VALUE "CompanyName", APP_SITE + VALUE "CompanyName", APP_DOMAIN VALUE "FileDescription", APP_DESC VALUE "FileVersion", APP_VERSION VALUE "LegalCopyright", APP_COPYRIGHT diff --git a/src/backend/opencl/wrappers/OclPlatform.cpp b/src/backend/opencl/wrappers/OclPlatform.cpp index 6c3509f0..ceba247e 100644 --- a/src/backend/opencl/wrappers/OclPlatform.cpp +++ b/src/backend/opencl/wrappers/OclPlatform.cpp @@ -1,12 +1,6 @@ /* 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 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 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 @@ -22,10 +16,28 @@ * along with this program. If not, see . */ - #include "backend/opencl/wrappers/OclPlatform.h" #include "3rdparty/rapidjson/document.h" #include "backend/opencl/wrappers/OclLib.h" +#include "base/kernel/Process.h" +#include "base/tools/Arguments.h" + + +bool xmrig::OclPlatform::printPlatforms(int &rc) +{ + if (Process::arguments().contains("--print-platforms")) { + if (OclLib::init()) { + OclPlatform::print(); + } + else { + rc = 1; + } + + return true; + } + + return false; +} std::vector xmrig::OclPlatform::get() diff --git a/src/backend/opencl/wrappers/OclPlatform.h b/src/backend/opencl/wrappers/OclPlatform.h index dc9bd24e..5ac410f9 100644 --- a/src/backend/opencl/wrappers/OclPlatform.h +++ b/src/backend/opencl/wrappers/OclPlatform.h @@ -1,12 +1,6 @@ /* 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 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 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 @@ -45,6 +39,7 @@ public: OclPlatform() = default; OclPlatform(size_t index, cl_platform_id id) : m_id(id), m_index(index) {} + static bool printPlatforms(int &rc); static std::vector get(); static void print(); diff --git a/src/base b/src/base index 8cd9a654..eecf9776 160000 --- a/src/base +++ b/src/base @@ -1 +1 @@ -Subproject commit 8cd9a654debe3c9b6b46ef65c538c04325c4c509 +Subproject commit eecf97769a019ef2266e51b5ca2172a1834eef78 diff --git a/src/core/config/usage.h b/src/core/config/usage.h index 3a5f0afd..9beb4cda 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -25,16 +25,13 @@ #define XMRIG_USAGE_H -#include "../version.h" - - #include namespace xmrig { -static inline const std::string &usage() +static const std::string &usage() { static std::string u; @@ -42,7 +39,7 @@ static inline const std::string &usage() return u; } - u += "Usage: " APP_ID " [OPTIONS]\n\nNetwork:\n"; + u += "\nNetwork:\n"; u += " -o, --url=URL URL of mining server\n"; u += " -a, --algo=ALGO mining algorithm https://xmrig.com/docs/algorithms\n"; u += " --coin=COIN specify coin instead of algorithm\n"; @@ -174,14 +171,8 @@ static inline const std::string &usage() u += " -c, --config=FILE load a JSON-format configuration file\n"; u += " -B, --background run the miner in the background\n"; - u += " -V, --version output version information and exit\n"; - u += " -h, --help display this help and exit\n"; u += " --dry-run test configuration and exit\n"; -# ifdef XMRIG_FEATURE_HWLOC - u += " --export-topology export hwloc topology to a XML file and exit\n"; -# endif - # ifdef XMRIG_OS_WIN u += " --title set custom console window title\n"; u += " --no-title disable setting console window title\n"; diff --git a/src/version.h b/src/version.h index f3be8a79..d28f43f5 100644 --- a/src/version.h +++ b/src/version.h @@ -22,32 +22,12 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig miner" -#define APP_VERSION "6.15.0-dev" -#define APP_DOMAIN "xmrig.com" -#define APP_SITE "www.xmrig.com" -#define APP_COPYRIGHT "Copyright (C) 2016-2021 xmrig.com" #define APP_KIND "miner" #define APP_VER_MAJOR 6 -#define APP_VER_MINOR 15 +#define APP_VER_MINOR 99 #define APP_VER_PATCH 0 -#ifdef _MSC_VER -# if (_MSC_VER >= 1920) -# define MSVC_VERSION 2019 -# elif (_MSC_VER >= 1910 && _MSC_VER < 1920) -# define MSVC_VERSION 2017 -# elif _MSC_VER == 1900 -# define MSVC_VERSION 2015 -# elif _MSC_VER == 1800 -# define MSVC_VERSION 2013 -# elif _MSC_VER == 1700 -# define MSVC_VERSION 2012 -# elif _MSC_VER == 1600 -# define MSVC_VERSION 2010 -# else -# define MSVC_VERSION 0 -# endif -#endif +#include "base/kernel/base-version.h" #endif /* XMRIG_VERSION_H */ diff --git a/src/xmrig.cpp b/src/xmrig.cpp index fb82ad3b..ff1eb24d 100644 --- a/src/xmrig.cpp +++ b/src/xmrig.cpp @@ -19,6 +19,12 @@ #include "App.h" #include "base/kernel/Entry.h" #include "base/kernel/Process.h" +#include "core/config/usage.h" + + +#ifdef XMRIG_FEATURE_OPENCL +# include "backend/opencl/wrappers/OclPlatform.h" +#endif int main(int argc, char **argv) @@ -26,9 +32,18 @@ int main(int argc, char **argv) using namespace xmrig; Process process(argc, argv); - const auto entry = Entry::get(); - if (entry) { - return Entry::exec(entry); + + { + int rc = 0; + auto entry = std::make_unique(usage); + +# ifdef XMRIG_FEATURE_OPENCL + entry->add(OclPlatform::printPlatforms); +# endif + + if (entry->exec(rc)) { + return rc; + } } App app;