mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
@@ -0,0 +1 @@
|
||||
xmrstak/version.cpp export-subst
|
||||
+35
-1
@@ -74,7 +74,7 @@ if(CUDA_ENABLE)
|
||||
find_package(CUDA 7.5)
|
||||
|
||||
if(CUDA_FOUND)
|
||||
|
||||
list(APPEND BACKEND_TYPES "nvidia")
|
||||
option(XMR-STAK_LARGEGRID "Support large CUDA block count > 128" ON)
|
||||
if(XMR-STAK_LARGEGRID)
|
||||
add_definitions("-DXMR_STAK_LARGEGRID=${XMR-STAK_LARGEGRID}")
|
||||
@@ -244,6 +244,7 @@ if(OpenCL_ENABLE)
|
||||
# find package will use the previews searched path variables
|
||||
find_package(OpenCL)
|
||||
if(OpenCL_FOUND)
|
||||
list(APPEND BACKEND_TYPES "amd")
|
||||
include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})
|
||||
#set(LIBS ${LIBS} ${OpenCL_LIBRARY})
|
||||
link_directories(${OpenCL_LIBRARY})
|
||||
@@ -261,6 +262,8 @@ endif()
|
||||
option(CPU_ENABLE "Enable or disable CPU support" ON)
|
||||
if(NOT CPU_ENABLE)
|
||||
add_definitions("-DCONF_NO_CPU")
|
||||
else()
|
||||
list(APPEND BACKEND_TYPES "cpu")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@@ -369,6 +372,37 @@ if(WIN32)
|
||||
set(LIBS ${LIBS} wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Versioning
|
||||
################################################################################
|
||||
|
||||
# Get the current working branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%h
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(NOT "${GIT_COMMIT_HASH}" STREQUAL "")
|
||||
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
|
||||
endif()
|
||||
if(NOT "${GIT_BRANCH}" STREQUAL "")
|
||||
add_definitions("-DGIT_BRANCH=${GIT_BRANCH}")
|
||||
endif()
|
||||
|
||||
# generate backend string
|
||||
string(REPLACE ";" "-" STR_BACKEND_TYPES "${BACKEND_TYPES}")
|
||||
add_definitions("-DBACKEND_TYPE=${STR_BACKEND_TYPES}")
|
||||
|
||||
################################################################################
|
||||
# Compile & Link
|
||||
################################################################################
|
||||
|
||||
@@ -32,6 +32,8 @@ The miner allow to overwrite some of the settings via command line options.
|
||||
Usage: xmr-stak [OPTION]...
|
||||
|
||||
-h, --help show this help
|
||||
-v, --version show version number
|
||||
-V, --version-long show long version number
|
||||
-c, --config FILE common miner configuration file
|
||||
--currency NAME currency to mine: monero or aeon
|
||||
--noCPU disable the CPU miner backend
|
||||
|
||||
@@ -63,6 +63,8 @@ void help()
|
||||
cout<<"Usage: "<<params::inst().binaryName<<" [OPTION]..."<<endl;
|
||||
cout<<" "<<endl;
|
||||
cout<<" -h, --help show this help"<<endl;
|
||||
cout<<" -v, --version show version number"<<endl;
|
||||
cout<<" -V, --version-long show long version number"<<endl;
|
||||
cout<<" -c, --config FILE common miner configuration file"<<endl;
|
||||
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_MONERO))
|
||||
cout<<" --currency NAME currency to mine: monero or aeon"<<endl;
|
||||
@@ -85,7 +87,7 @@ void help()
|
||||
cout<<" -u, --user USERNAME pool user name or wallet address"<<endl;
|
||||
cout<<" -p, --pass PASSWD pool password, in the most cases x or empty \"\""<<endl;
|
||||
cout<<" \n"<<endl;
|
||||
cout<<XMR_STAK_NAME<<" "<<XMR_STAK_VERSION<<endl;
|
||||
cout<< "Version: " << get_version_str_short() << endl;
|
||||
cout<<"Brought to by fireice_uk and psychocrypt under GPLv3."<<endl;
|
||||
}
|
||||
|
||||
@@ -296,6 +298,16 @@ int main(int argc, char *argv[])
|
||||
//win_exit();
|
||||
return 0;
|
||||
}
|
||||
if(opName.compare("-v") == 0 || opName.compare("--version") == 0)
|
||||
{
|
||||
std::cout<< "Version: " << get_version_str_short() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else if(opName.compare("-V") == 0 || opName.compare("--version-long") == 0)
|
||||
{
|
||||
std::cout<< "Version: " << get_version_str() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else if(opName.compare("--noCPU") == 0)
|
||||
{
|
||||
params::inst().useCPU = false;
|
||||
@@ -433,17 +445,18 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
printer::inst()->print_str("-------------------------------------------------------------------\n");
|
||||
printer::inst()->print_str( XMR_STAK_NAME" " XMR_STAK_VERSION " mining software.\n");
|
||||
printer::inst()->print_str(get_version_str_short().c_str());
|
||||
printer::inst()->print_str("\n\n");
|
||||
printer::inst()->print_str("Brought to you by fireice_uk and psychocrypt under GPLv3.\n");
|
||||
printer::inst()->print_str("Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).\n");
|
||||
#ifndef CONF_NO_CUDA
|
||||
printer::inst()->print_str("NVIDIA mining code was written by KlausT and psychocrypt.\n");
|
||||
printer::inst()->print_str("Based on NVIDIA mining code by KlausT and psychocrypt.\n");
|
||||
#endif
|
||||
#ifndef CONF_NO_OPENCL
|
||||
printer::inst()->print_str("AMD mining code was written by wolf9466.\n");
|
||||
printer::inst()->print_str("Based on OpenCL mining code by wolf9466.\n");
|
||||
#endif
|
||||
printer::inst()->print_str("Brought to you by fireice_uk and psychocrypt under GPLv3.\n\n");
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n\n", fDevDonationLevel * 100.0);
|
||||
snprintf(buffer, sizeof(buffer), "\nConfigurable dev donation level is set to %.1f%%\n\n", fDevDonationLevel * 100.0);
|
||||
printer::inst()->print_str(buffer);
|
||||
printer::inst()->print_str("You can use following keys to display reports:\n");
|
||||
printer::inst()->print_str("'h' - hashrate\n");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
extern const char sHtmlCssEtag [] = "00000006";
|
||||
extern const char sHtmlCssEtag [] = "00000008";
|
||||
extern const char sHtmlCssFile [] =
|
||||
"body {"
|
||||
"font-family: Tahoma, Arial, sans-serif;"
|
||||
@@ -38,7 +38,13 @@ extern const char sHtmlCssFile [] =
|
||||
"color: white;"
|
||||
"padding: 10px;"
|
||||
"font-weight: bold;"
|
||||
"margin: 10px 0px;"
|
||||
"margin: 0px;"
|
||||
"margin-bottom: 10px;"
|
||||
"}"
|
||||
|
||||
".version {"
|
||||
"font-size: 75%;"
|
||||
"text-align: right;"
|
||||
"}"
|
||||
|
||||
".links {"
|
||||
@@ -108,6 +114,7 @@ extern const char sHtmlCommonHeader [] =
|
||||
"<link rel='stylesheet' href='style.css' /><title>%s</title></head>"
|
||||
"<body>"
|
||||
"<div class='all'>"
|
||||
"<div class='version'>%s</div>"
|
||||
"<div class='header'><span style='color: rgb(255, 160, 0)'>XMR</span>-Stak Monero Miner</div>"
|
||||
|
||||
"<div class='flex-container'>"
|
||||
@@ -192,6 +199,8 @@ extern const char sJsonApiConnectionError[] =
|
||||
|
||||
extern const char sJsonApiFormat [] =
|
||||
"{"
|
||||
"\"version\":\"%s\","
|
||||
|
||||
"\"hashrate\":{"
|
||||
"\"threads\":[%s],"
|
||||
"\"total\":%s,"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "xmrstak/jconf.hpp"
|
||||
#include "xmrstak/misc/console.hpp"
|
||||
#include "xmrstak/donate-level.hpp"
|
||||
#include "xmrstak/version.hpp"
|
||||
#include "xmrstak/http/webdesign.hpp"
|
||||
|
||||
#include <thread>
|
||||
@@ -44,6 +45,7 @@
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strncasecmp _strnicmp
|
||||
#endif // _WIN32
|
||||
@@ -848,7 +850,7 @@ void executor::http_hashrate_report(std::string& out)
|
||||
|
||||
out.reserve(4096);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Hashrate Report", "Hashrate Report");
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Hashrate Report", ver_html, "Hashrate Report");
|
||||
out.append(buffer);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), sHtmlHashrateBodyHigh, (unsigned int)nthd + 3);
|
||||
@@ -893,7 +895,7 @@ void executor::http_result_report(std::string& out)
|
||||
|
||||
out.reserve(4096);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Result Report", "Result Report");
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Result Report", ver_html, "Result Report");
|
||||
out.append(buffer);
|
||||
|
||||
size_t iGoodRes = vMineResults[0].count, iTotalRes = iGoodRes;
|
||||
@@ -939,7 +941,7 @@ void executor::http_connection_report(std::string& out)
|
||||
|
||||
out.reserve(4096);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Connection Report", "Connection Report");
|
||||
snprintf(buffer, sizeof(buffer), sHtmlCommonHeader, "Connection Report", ver_html, "Connection Report");
|
||||
out.append(buffer);
|
||||
|
||||
jpsock* pool = pick_pool_by_id(current_pool_id);
|
||||
@@ -1079,11 +1081,11 @@ void executor::http_json_report(std::string& out)
|
||||
cn_error.append(buffer);
|
||||
}
|
||||
|
||||
size_t bb_size = 1024 + hr_thds.size() + res_error.size() + cn_error.size();
|
||||
size_t bb_size = 2048 + hr_thds.size() + res_error.size() + cn_error.size();
|
||||
std::unique_ptr<char[]> bigbuf( new char[ bb_size ] );
|
||||
|
||||
int bb_len = snprintf(bigbuf.get(), bb_size, sJsonApiFormat,
|
||||
hr_thds.c_str(), hr_buffer, a,
|
||||
get_version_str().c_str(), hr_thds.c_str(), hr_buffer, a,
|
||||
int_port(iPoolDiff), int_port(iGoodRes), int_port(iTotalRes), fAvgResTime, int_port(iPoolHashes),
|
||||
int_port(iTopDiff[0]), int_port(iTopDiff[1]), int_port(iTopDiff[2]), int_port(iTopDiff[3]), int_port(iTopDiff[4]),
|
||||
int_port(iTopDiff[5]), int_port(iTopDiff[6]), int_port(iTopDiff[7]), int_port(iTopDiff[8]), int_port(iTopDiff[9]),
|
||||
|
||||
@@ -509,8 +509,8 @@ bool jpsock::cmd_login()
|
||||
{
|
||||
char cmd_buffer[1024];
|
||||
|
||||
snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"" AGENTID_STR "\"},\"id\":1}\n",
|
||||
usr_login.c_str(), usr_pass.c_str());
|
||||
snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s\"},\"id\":1}\n",
|
||||
usr_login.c_str(), usr_pass.c_str(), get_version_str().c_str());
|
||||
|
||||
opq_json_val oResult(nullptr);
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "version.hpp"
|
||||
|
||||
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
|
||||
#if defined(GIT_ARCHIVE) && !defined(GIT_COMMIT_HASH)
|
||||
#define GIT_COMMIT_HASH $Format:%h$
|
||||
#endif
|
||||
|
||||
#ifndef GIT_COMMIT_HASH
|
||||
#define GIT_COMMIT_HASH 0000000
|
||||
#endif
|
||||
|
||||
#ifndef GIT_BRANCH
|
||||
#define GIT_BRANCH unknown
|
||||
#endif
|
||||
|
||||
#ifndef BACKEND_TYPE
|
||||
#define BACKEND_TYPE unknown
|
||||
#endif
|
||||
|
||||
#define XMR_STAK_NAME "xmr-stak"
|
||||
#define XMR_STAK_VERSION "2.0.0"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define OS_TYPE "win"
|
||||
#elif defined(__APPLE__)
|
||||
#define OS_TYPE "mac"
|
||||
#elif defined(__FreeBSD__)
|
||||
#define OS_TYPE "bsd"
|
||||
#elif defined(__linux__)
|
||||
#define OS_TYPE "lin"
|
||||
#else
|
||||
#define OS_TYPE "unk"
|
||||
#endif
|
||||
|
||||
#if defined(CONF_NO_AEON)
|
||||
#define COIN_TYPE "monero"
|
||||
#elif defined(CONF_NO_MONERO)
|
||||
#define COIN_TYPE "aeon"
|
||||
#else
|
||||
#define COIN_TYPE "aeon-monero"
|
||||
#endif
|
||||
|
||||
#define XMRSTAK_PP_TOSTRING1(str) #str
|
||||
#define XMRSTAK_PP_TOSTRING(str) XMRSTAK_PP_TOSTRING1(str)
|
||||
|
||||
#define VERSION_LONG XMR_STAK_NAME "/" XMR_STAK_VERSION "/" XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) "/" XMRSTAK_PP_TOSTRING(GIT_BRANCH) "/" OS_TYPE "/" XMRSTAK_PP_TOSTRING(BACKEND_TYPE) "/" COIN_TYPE "/"
|
||||
#define VERSION_SHORT XMR_STAK_NAME " " XMR_STAK_VERSION " " XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH)
|
||||
#define VERSION_HTML "v" XMR_STAK_VERSION "-" XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH)
|
||||
|
||||
const char ver_long[] = VERSION_LONG;
|
||||
const char ver_short[] = VERSION_SHORT;
|
||||
const char ver_html[] = VERSION_HTML;
|
||||
+17
-2
@@ -1,4 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#define XMR_STAK_NAME "xmr-stak"
|
||||
#define XMR_STAK_VERSION "2.0.0-predev"
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include "donate-level.hpp"
|
||||
|
||||
extern const char ver_long[];
|
||||
extern const char ver_short[];
|
||||
extern const char ver_html[];
|
||||
|
||||
inline std::string get_version_str()
|
||||
{
|
||||
return std::string(ver_long) + std::to_string(uint32_t(fDevDonationLevel * 1000)) ;
|
||||
}
|
||||
|
||||
inline std::string get_version_str_short()
|
||||
{
|
||||
return std::string(ver_short);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user