ease building with / without randomx

This commit is contained in:
Jethro Grassie 2019-08-21 19:35:30 -04:00
parent 2c636d00e9
commit bcc25dee1b
No known key found for this signature in database
GPG key ID: DE8ED755616565BB
3 changed files with 20 additions and 3 deletions

View file

@ -56,8 +56,9 @@ MONERO_LIBS = \
${MONERO_BUILD_ROOT}/src/ringct/libringct_basic.a \ ${MONERO_BUILD_ROOT}/src/ringct/libringct_basic.a \
${MONERO_BUILD_ROOT}/src/device/libdevice.a \ ${MONERO_BUILD_ROOT}/src/device/libdevice.a \
${MONERO_BUILD_ROOT}/contrib/epee/src/libepee.a \ ${MONERO_BUILD_ROOT}/contrib/epee/src/libepee.a \
${MONERO_BUILD_ROOT}/external/easylogging++/libeasylogging.a \ ${MONERO_BUILD_ROOT}/external/easylogging++/libeasylogging.a
${MONERO_BUILD_ROOT}/external/randomx/librandomx.a
LIBRX = ${MONERO_BUILD_ROOT}/external/randomx/librandomx.a
DIRS = src data rxi/log/src DIRS = src data rxi/log/src
@ -65,6 +66,15 @@ OS := $(shell uname -s)
CPPDEFS = _GNU_SOURCE AUTO_INITIALIZE_EASYLOGGINGPP LOG_USE_COLOR CPPDEFS = _GNU_SOURCE AUTO_INITIALIZE_EASYLOGGINGPP LOG_USE_COLOR
ifeq ($(wildcard ${LIBRX}),${LIBRX})
MONERO_LIBS += ${LIBRX}
CPPDEFS += HAVE_RX
else
ifneq ($(MAKECMDGOALS),clean)
$(warning Building without RandomX!)
endif
endif
W = -W -Wall -Wno-unused-parameter -Wuninitialized W = -W -Wall -Wno-unused-parameter -Wuninitialized
OPT = -maes -fPIC OPT = -maes -fPIC
CFLAGS = $(W) -Wbad-function-cast $(OPT) -std=c99 CFLAGS = $(W) -Wbad-function-cast $(OPT) -std=c99

View file

@ -248,8 +248,13 @@ static FILE *fd_log;
static unsigned char sec_view[32]; static unsigned char sec_view[32];
static unsigned char pub_spend[32]; static unsigned char pub_spend[32];
#ifdef HAVE_RX
extern void rx_stop_mining(); extern void rx_stop_mining();
extern void rx_slow_hash_free_state(); extern void rx_slow_hash_free_state();
#else
void rx_stop_mining(){}
void rx_slow_hash_free_state(){}
#endif
#define JSON_GET_OR_ERROR(name, parent, type, client) \ #define JSON_GET_OR_ERROR(name, parent, type, client) \
json_object *name = NULL; \ json_object *name = NULL; \

View file

@ -105,13 +105,15 @@ void get_rx_hash(const unsigned char *input, const size_t in_size,
unsigned char *output, const unsigned char *seed_hash, unsigned char *output, const unsigned char *seed_hash,
const uint64_t height) const uint64_t height)
{ {
static unsigned max_concurrency = 1;//tools::get_max_concurrency(); #ifdef HAVE_RX
static unsigned max_concurrency = tools::get_max_concurrency();
uint64_t seed_height; uint64_t seed_height;
if (rx_needhash(height, &seed_height)) if (rx_needhash(height, &seed_height))
{ {
rx_seedhash(seed_height, (const char*)seed_hash, max_concurrency); rx_seedhash(seed_height, (const char*)seed_hash, max_concurrency);
} }
rx_slow_hash((const char*)input, in_size, (char*)output, max_concurrency); rx_slow_hash((const char*)input, in_size, (char*)output, max_concurrency);
#endif
} }
int validate_block_from_blob(const char *blob_hex, int validate_block_from_blob(const char *blob_hex,