Added macOS build

pull/11/head
SChernykh 3 years ago
parent e527b0c660
commit b31adbd5ae

@ -110,3 +110,36 @@ jobs:
run: |
cd tests/build/Release
./p2pool_tests.exe
build-macos:
runs-on: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake libuv zmq libpgm
- name: Build p2pool
run: |
mkdir build
cd build
cmake ..
make
- name: Build tests
run: |
cd tests
mkdir build
cd build
cmake ..
make
- name: Run tests
run: |
cd tests/build
./p2pool_tests

@ -39,7 +39,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${WARNING_FLAGS} ${SECURITY_FLAGS} /Ob1 /Ot /Zi /MT")
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(WARNING_FLAGS "-Wall -Wextra")
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Werror")
set(OPTIMIZATION_FLAGS "-Ofast -funroll-loops -fmerge-all-constants")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")

@ -204,7 +204,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, Wallet
// Select 1000 transactions with the highest fee per byte
if (m_mempoolTxs.size() > 1000) {
std::nth_element(m_mempoolTxs.begin(), m_mempoolTxs.begin() + 1000, m_mempoolTxs.end(),
[this](const TxMempoolData& tx_a, const TxMempoolData& tx_b)
[](const TxMempoolData& tx_a, const TxMempoolData& tx_b)
{
return tx_a.fee * tx_b.weight > tx_b.fee * tx_a.weight;
});
@ -749,7 +749,7 @@ hash BlockTemplate::calc_miner_tx_hash(uint32_t extra_nonce) const
// 1. Prefix (everything except vin_rct_type byte in the end)
// Apply extra_nonce in-place because we can't write to the block template here
keccak_custom([this, data, extra_nonce_offset, &extra_nonce_buf](int offset)
keccak_custom([data, extra_nonce_offset, &extra_nonce_buf](int offset)
{
const uint32_t k = static_cast<uint32_t>(offset - extra_nonce_offset);
if (k < EXTRA_NONCE_SIZE) {

@ -25,8 +25,6 @@ extern "C" {
#include "crypto-ops.h"
}
static constexpr char log_category_prefix[] = "Crypto ";
namespace p2pool {
namespace {

@ -172,6 +172,7 @@ INT_ENTRY(uint32_t)
INT_ENTRY(uint64_t)
#ifdef __clang__
INT_ENTRY(long)
INT_ENTRY(unsigned long)
#endif

@ -667,7 +667,7 @@ void P2PServer::download_missing_blocks()
}
send(client,
[this, &id](void* buf)
[&id](void* buf)
{
uint8_t* p0 = reinterpret_cast<uint8_t*>(buf);
uint8_t* p = p0;
@ -1093,7 +1093,7 @@ bool P2PServer::P2PClient::check_handshake_solution(const hash& solution, const
hash check{};
keccak_custom(
[this, &challenge, &solution_salt, &consensus_id, consensus_id_size](int offset) -> uint8_t
[&challenge, &solution_salt, &consensus_id, consensus_id_size](int offset) -> uint8_t
{
if (offset < CHALLENGE_SIZE) {
return challenge[offset];
@ -1185,7 +1185,7 @@ bool P2PServer::P2PClient::on_handshake_solution(const uint8_t* buf)
}
return m_owner->send(this,
[this, &solution, &solution_salt](void* buf)
[this](void* buf)
{
uint8_t* p0 = reinterpret_cast<uint8_t*>(buf);
uint8_t* p = p0;
@ -1243,7 +1243,7 @@ bool P2PServer::P2PClient::on_block_request(const uint8_t* buf)
}
return server->send(this,
[this, &blob](void* buf)
[&blob](void* buf)
{
uint8_t* p0 = reinterpret_cast<uint8_t*>(buf);
uint8_t* p = p0;
@ -1526,7 +1526,7 @@ void P2PServer::P2PClient::post_handle_incoming_block(const uint32_t reset_count
}
const bool result = m_owner->send(this,
[this, &id](void* buf)
[&id](void* buf)
{
uint8_t* p0 = reinterpret_cast<uint8_t*>(buf);
uint8_t* p = p0;

@ -810,7 +810,7 @@ void p2pool::api_update_network_stats()
}
m_api->set(p2pool_api::Category::NETWORK, "stats",
[this, mainnet_tip](log::Stream& s)
[mainnet_tip](log::Stream& s)
{
s << "{\"difficulty\":" << mainnet_tip.difficulty
<< ",\"hash\":\"" << mainnet_tip.id
@ -1000,7 +1000,7 @@ int p2pool::run()
}
{
ZMQReader z(m_params->m_host, m_params->m_rpcPort, m_params->m_zmqPort, this);
ZMQReader z(m_params->m_host, m_params->m_zmqPort, this);
get_info();
const int rc = uv_run(uv_default_loop_checked(), UV_RUN_DEFAULT);
LOGINFO(1, "uv_run exited, result = " << rc);

@ -493,7 +493,7 @@ void StratumServer::on_blobs_ready()
}
const bool result = send(client,
[data, target, client, hashing_blob, &job_id](void* buf)
[data, target, hashing_blob, &job_id](void* buf)
{
log::hex_buf target_hex(reinterpret_cast<const uint8_t*>(&target), sizeof(uint64_t));

@ -28,8 +28,6 @@ extern "C" {
#include "crypto-ops.h"
}
static constexpr char log_category_prefix[] = "Wallet ";
namespace {
// public keys: 64 bytes -> 88 characters in base58

@ -24,9 +24,8 @@ static constexpr char log_category_prefix[] = "ZMQReader ";
namespace p2pool {
ZMQReader::ZMQReader(const char* address, uint32_t rpc_port, uint32_t zmq_port, MinerCallbackHandler* handler)
ZMQReader::ZMQReader(const char* address, uint32_t zmq_port, MinerCallbackHandler* handler)
: m_address(address)
, m_rpcPort(rpc_port)
, m_zmqPort(zmq_port)
, m_handler(handler)
, m_tx()

@ -24,7 +24,7 @@ namespace p2pool {
class ZMQReader {
public:
ZMQReader(const char* address, uint32_t rpc_port, uint32_t zmq_port, MinerCallbackHandler* handler);
ZMQReader(const char* address, uint32_t zmq_port, MinerCallbackHandler* handler);
~ZMQReader();
private:
@ -34,7 +34,6 @@ private:
void parse(char* data, size_t size);
const char* m_address;
uint32_t m_rpcPort;
uint32_t m_zmqPort;
MinerCallbackHandler* m_handler;

@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 2.8.12)
project(p2pool_tests)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
add_subdirectory(googletest)
set(LIBS gtest)

Loading…
Cancel
Save