Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Simplify buildinfo generation
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed May 10, 2017
1 parent d5eac09 commit 0c86011
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 75 deletions.
6 changes: 2 additions & 4 deletions BuildInfo.h.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#define ETH_PROJECT_VERSION "@PROJECT_VERSION@"
#define ETH_COMMIT_HASH @ETH_COMMIT_HASH@
#define ETH_CLEAN_REPO @ETH_CLEAN_REPO@
#define ETH_BUILD_TYPE @ETH_BUILD_TYPE@
#define ETH_BUILD_PLATFORM @ETH_BUILD_PLATFORM@
#define ETH_BUILD_TYPE "@ETH_BUILD_TYPE@"
#define ETH_BUILD_PLATFORM "@ETH_BUILD_PLATFORM@"
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ function(createBuildInfo)
set(_cmake_build_type "${CMAKE_CFG_INTDIR}")
endif()

message("createBuildInfo()")

# Generate header file containing useful build information
add_custom_target(BuildInfo.h ALL
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand All @@ -103,9 +101,6 @@ function(createBuildInfo)
-P "${ETH_SCRIPTS_DIR}/buildinfo.cmake"
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SRC_LIST BuildInfo.h)
endfunction()


Expand Down
23 changes: 1 addition & 22 deletions cmake/scripts/buildinfo.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generates BuildInfo.h
#
#
# this module expects
# ETH_SOURCE_DIR - main CMAKE_SOURCE_DIR
# ETH_DST_DIR - main CMAKE_BINARY_DIR
Expand All @@ -17,26 +17,6 @@ if (NOT ETH_BUILD_PLATFORM)
set(ETH_BUILD_PLATFORM "unknown")
endif()

execute_process(
COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} rev-parse HEAD
OUTPUT_VARIABLE ETH_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
)

if (NOT ETH_COMMIT_HASH)
set(ETH_COMMIT_HASH 0)
endif()

execute_process(
COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} diff --shortstat
OUTPUT_VARIABLE ETH_LOCAL_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
)

if (ETH_LOCAL_CHANGES)
set(ETH_CLEAN_REPO 0)
else()
set(ETH_CLEAN_REPO 1)
endif()

set(INFILE "${ETH_SOURCE_DIR}/BuildInfo.h.in")
set(TMPFILE "${ETH_DST_DIR}/BuildInfo.h.tmp")
set(OUTFILE "${ETH_DST_DIR}/BuildInfo.h")
Expand All @@ -45,4 +25,3 @@ configure_file("${INFILE}" "${TMPFILE}")

include("${ETH_SOURCE_DIR}/cmake/EthUtils.cmake")
replace_if_different("${TMPFILE}" "${OUTFILE}" CREATE)

19 changes: 9 additions & 10 deletions ethminer/MinerAux.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <libethash-cuda/ethash_cuda_miner.h>
#endif
#include <jsonrpccpp/client/connectors/httpclient.h>
#include "BuildInfo.h"
#include "FarmClient.h"
#if ETH_STRATUM
#include <libstratum/EthStratumClient.h>
Expand Down Expand Up @@ -238,7 +237,7 @@ class MinerCLI
{
m_worktimeout = atoi(argv[++i]);
}

#endif
#if ETH_ETHASHCL
else if (arg == "--opencl-platform" && i + 1 < argc)
Expand Down Expand Up @@ -472,7 +471,7 @@ class MinerCLI
EthashGPUMiner::setDevices(m_openclDevices, m_openclDeviceCount);
m_miningThreads = m_openclDeviceCount;
}

if (!EthashGPUMiner::configureGPU(
m_localWorkSize,
m_globalWorkSizeMultiplier,
Expand All @@ -499,7 +498,7 @@ class MinerCLI
EthashCUDAMiner::setDevices(m_cudaDevices, m_cudaDeviceCount);
m_miningThreads = m_cudaDeviceCount;
}

EthashCUDAMiner::setNumInstances(m_miningThreads);
if (!EthashCUDAMiner::configureGPU(
m_localWorkSize,
Expand All @@ -521,7 +520,7 @@ class MinerCLI
doBenchmark(m_minerType, m_benchmarkWarmup, m_benchmarkTrial, m_benchmarkTrials);
else if (mode == OperationMode::Farm)
doFarm(m_minerType, m_activeFarmURL, m_farmRecheckPeriod);
else if (mode == OperationMode::Simulation)
else if (mode == OperationMode::Simulation)
doSimulation(m_minerType);
#if ETH_STRATUM
else if (mode == OperationMode::Stratum)
Expand Down Expand Up @@ -605,7 +604,7 @@ class MinerCLI
exit(0);
}



void doBenchmark(MinerType _m, unsigned _warmupDuration = 15, unsigned _trialDuration = 3, unsigned _trials = 5)
{
Expand Down Expand Up @@ -757,7 +756,7 @@ class MinerCLI
}
}


void doFarm(MinerType _m, string & _remote, unsigned _recheckPeriod)
{
map<string, GenericFarm<EthashProofOfWork>::SealerDescriptor> sealers;
Expand Down Expand Up @@ -904,7 +903,7 @@ class MinerCLI
}
m_farmRetries = 0;
}

}
}
exit(0);
Expand All @@ -922,7 +921,7 @@ class MinerCLI
#endif
if (!m_farmRecheckSet)
m_farmRecheckPeriod = m_defaultStratumFarmRecheckPeriod;

GenericFarm<EthashProofOfWork> f;

// this is very ugly, but if Stratum Client V2 tunrs out to be a success, V1 will be completely removed anyway
Expand Down Expand Up @@ -1044,7 +1043,7 @@ class MinerCLI
/// Farm params
string m_farmURL = "http://127.0.0.1:8545";
string m_farmFailOverURL = "";


string m_activeFarmURL = m_farmURL;
unsigned m_farmRetries = 0;
Expand Down
4 changes: 3 additions & 1 deletion ethminer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <fstream>
#include <iostream>
#include "MinerAux.h"
#include "BuildInfo.h"

using namespace std;
using namespace dev;
using namespace dev::eth;
Expand All @@ -57,7 +59,7 @@ void help()
void version()
{
cout << "ethminer version " << ETH_PROJECT_VERSION << endl;
cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl;
cout << "Build: " << ETH_BUILD_PLATFORM << "/" << ETH_BUILD_TYPE << endl;
exit(0);
}

Expand Down
3 changes: 1 addition & 2 deletions libdevcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ find_package(Threads)

add_library(devcore ${SOURCES} ${HEADERS})
target_link_libraries(devcore PUBLIC Boost::boost)
target_link_libraries(devcore PRIVATE ${CMAKE_THREAD_LIBS_INIT})
#target_include_directories(devcore PRIVATE ..)
target_link_libraries(devcore PRIVATE Threads::Threads)
27 changes: 0 additions & 27 deletions libdevcore/Common.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions libdevcore/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
// CryptoPP defines byte in the global namespace, so must we.
using byte = uint8_t;

// Quote a given token stream to turn it into a string.
#define DEV_QUOTED_HELPER(s) #s
#define DEV_QUOTED(s) DEV_QUOTED_HELPER(s)

#define DEV_IGNORE_EXCEPTIONS(X) try { X; } catch (...) {}

#define DEV_IF_NO_ELSE(X) if(!(X)){}else
Expand Down

0 comments on commit 0c86011

Please sign in to comment.