mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-16 15:57:38 +00:00
Fixes for MSVC.
This commit is contained in:
parent
9580c30d8a
commit
42bf85d10b
4 changed files with 51 additions and 18 deletions
|
@ -25,12 +25,14 @@
|
|||
#include <uv.h>
|
||||
#include <jansson.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include "getopt/getopt.h"
|
||||
# include "getopt/getopt.h"
|
||||
#else
|
||||
#include <getopt.h>
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "Console.h"
|
||||
#include "Cpu.h"
|
||||
#include "donate.h"
|
||||
|
@ -391,24 +393,29 @@ void Options::showUsage(int status) const
|
|||
|
||||
void Options::showVersion()
|
||||
{
|
||||
/* printf(APP_NAME " " APP_VERSION "\n built on " __DATE__)
|
||||
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
||||
|
||||
#ifdef __GNUC__
|
||||
# if defined(__GNUC__)
|
||||
" with GCC");
|
||||
printf(" %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
#endif
|
||||
# elif defined(_MSC_VER)
|
||||
" with MSVC");
|
||||
printf(" %d", MSVC_VERSION);
|
||||
# else
|
||||
);
|
||||
# endif
|
||||
|
||||
printf("\n features:"
|
||||
#ifdef __i386__
|
||||
# if defined(__i386__) || defined(_M_IX86)
|
||||
" i386"
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
# elif defined(__x86_64__) || defined(_M_AMD64)
|
||||
" x86_64"
|
||||
#endif
|
||||
#ifdef __AES__
|
||||
# endif
|
||||
|
||||
# if defined(__AES__) || defined(_MSC_VER)
|
||||
" AES-NI"
|
||||
#endif
|
||||
"\n");*/
|
||||
# endif
|
||||
"\n");
|
||||
|
||||
printf("\nlibuv/%s\n", uv_version_string());
|
||||
printf("libjansson/%s\n", JANSSON_VERSION);
|
||||
|
|
|
@ -37,8 +37,10 @@ static void print_versions()
|
|||
{
|
||||
char buf[16];
|
||||
|
||||
# ifdef __GNUC__
|
||||
# if defined(__GNUC__)
|
||||
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# elif defined(_MSC_VER)
|
||||
snprintf(buf, 16, " MSVC/%d", MSVC_VERSION);
|
||||
# else
|
||||
buf[0] = '\0';
|
||||
# endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
@ -51,13 +51,21 @@ static inline OSVERSIONINFOEX winOsVersion()
|
|||
char *Network::userAgent()
|
||||
{
|
||||
const auto osver = winOsVersion();
|
||||
const size_t max = 128;
|
||||
|
||||
char *buf = static_cast<char*>(malloc(128));
|
||||
char *buf = static_cast<char*>(malloc(max));
|
||||
int length = snprintf(buf, max, "%s/%s (Windows NT %lu.%lu", APP_NAME, APP_VERSION, osver.dwMajorVersion, osver.dwMinorVersion);
|
||||
|
||||
# if defined(__x86_64__) || defined(_M_AMD64)
|
||||
length += snprintf(buf + length, max - length, "; Win64; x64) libuv/%s", uv_version_string());
|
||||
# else
|
||||
length += snprintf(buf + length, max - length, ") libuv/%s", uv_version_string());
|
||||
# endif
|
||||
|
||||
# ifdef __GNUC__
|
||||
snprintf(buf, 128, "%s/%s (Windows NT %lu.%lu; Win64; x64) libuv/%s gcc/%d.%d.%d", APP_NAME, APP_VERSION, osver.dwMajorVersion, osver.dwMinorVersion, uv_version_string(), __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# else
|
||||
snprintf(buf, 128, "%s/%s (Windows NT %lu.%lu; Win64; x64) libuv/%s", APP_NAME, APP_VERSION, osver.dwMajorVersion, osver.dwMinorVersion, uv_version_string());
|
||||
length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
#elif _MSC_VER
|
||||
length += snprintf(buf + length, max - length, " msvc/%d", MSVC_VERSION);
|
||||
# endif
|
||||
|
||||
return buf;
|
||||
|
|
|
@ -37,4 +37,20 @@
|
|||
#define APP_VER_BUILD 0
|
||||
#define APP_VER_REV 0
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER == 1910
|
||||
# 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
|
||||
|
||||
#endif /* __VERSION_H__ */
|
||||
|
|
Loading…
Reference in a new issue