Browse Source

CMake: drop some old options and flags

cl-refactor
Paweł Bylica 8 years ago
parent
commit
1a0f84d936
No known key found for this signature in database GPG Key ID: 7A0C037434FE77EF
  1. 1
      BuildInfo.h.in
  2. 49
      CMakeLists.txt
  3. 6
      cmake/scripts/buildinfo.cmake
  4. 44
      ethminer/MinerAux.h
  5. 2
      libethcore/EthashCUDAMiner.cpp
  6. 2
      libethcore/EthashCUDAMiner.h
  7. 2
      libethcore/EthashGPUMiner.cpp
  8. 2
      libethcore/EthashGPUMiner.h

1
BuildInfo.h.in

@ -5,4 +5,3 @@
#define ETH_CLEAN_REPO @ETH_CLEAN_REPO@
#define ETH_BUILD_TYPE @ETH_BUILD_TYPE@
#define ETH_BUILD_PLATFORM @ETH_BUILD_PLATFORM@
#define ETH_FATDB @ETH_FATDB@

49
CMakeLists.txt

@ -29,8 +29,6 @@ set(D_CMAKE_BUILD_TYPE "Release")
set(D_ETHASHCL ON)
set(D_ETHASHCUDA OFF)
set(D_JSONRPC ON)
set(D_OLYMPIC OFF)
set(D_MINER ON)
set(D_ETHSTRATUM OFF)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
@ -51,26 +49,6 @@ function(configureProject)
if (ETHSTRATUM)
add_definitions(-DETH_STRATUM)
endif()
if (FATDB)
add_definitions(-DETH_FATDB)
endif()
if (GUI)
add_definitions(-DETH_GUI)
endif()
if (CURL_FOUND)
add_definitions(-DETH_CURL)
endif()
if (OLYMPIC)
add_definitions(-DETH_OLYMPIC)
else()
add_definitions(-DETH_FRONTIER)
endif()
add_definitions(-DETH_TRUE)
endfunction()
set(CPPETHEREUM 1)
@ -108,7 +86,7 @@ function(createBuildInfo)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DETH_DST_DIR="${CMAKE_BINARY_DIR}"
-DETH_BUILD_TYPE="${_cmake_build_type}" -DETH_BUILD_PLATFORM="${ETH_BUILD_PLATFORM}"
-DPROJECT_VERSION="${PROJECT_VERSION}" -DGENOIL_VERSION="${GENOIL_VERSION}" -DETH_FATDB="${FATDB}"
-DPROJECT_VERSION="${PROJECT_VERSION}" -DGENOIL_VERSION="${GENOIL_VERSION}"
-P "${ETH_SCRIPTS_DIR}/buildinfo.cmake"
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@ -133,10 +111,8 @@ endmacro()
# Normalise build options
eth_format_option(JSONRPC)
eth_format_option(MINER)
eth_format_option(ETHASHCL)
eth_format_option(ETHASHCUDA)
eth_format_option(OLYMPIC)
eth_format_option(ETHSTRATUM)
# Default CMAKE_BUILD_TYPE accordingly.
@ -160,11 +136,8 @@ message("-- TARGET_PLATFORM Target platform ${TARGET_P
message("--------------------------------------------------------------- features")
message("-- Chromium support ${ETH_HAVE_WEBENGINE}")
message("-- HTTP Request support ${CURL_FOUND}")
message("-- FATDB Full database exploring ${FATDB}")
message("-- JSONRPC JSON-RPC support ${JSONRPC}")
message("-- OLYMPIC Default to the Olympic network ${OLYMPIC}")
message("------------------------------------------------------------- components")
message("-- MINER Build miner ${MINER}")
message("-- ETHASHCL Build OpenCL components ${ETHASHCL}")
message("-- ETHASHCUDA Build CUDA components ${ETHASHCUDA}")
message("-- ETHSTRATUM Build Stratum components ${ETHSTRATUM}")
@ -186,18 +159,16 @@ createBuildInfo()
add_subdirectory(libdevcore)
if (MINER)
add_subdirectory(libethash)
if (ETHASHCL)
add_subdirectory(libethash-cl)
endif ()
if (ETHASHCUDA)
add_subdirectory(libethash-cuda)
endif ()
if(ETHSTRATUM)
add_subdirectory(libstratum)
endif()
add_subdirectory(libethash)
if (ETHASHCL)
add_subdirectory(libethash-cl)
endif ()
if (ETHASHCUDA)
add_subdirectory(libethash-cuda)
endif ()
if(ETHSTRATUM)
add_subdirectory(libstratum)
endif()
add_subdirectory(libethcore)
add_subdirectory(ethminer)

6
cmake/scripts/buildinfo.cmake

@ -9,12 +9,6 @@
# example usage:
# cmake -DETH_SOURCE_DIR=. -DETH_DST_DIR=build -DETH_BUILD_TYPE=Debug -DETH_BUILD_PLATFORM=mac -P scripts/buildinfo.cmake
if (ETH_FATDB)
set(ETH_FATDB 1)
else()
set(ETH_FATDB 0)
endif()
if (NOT ETH_BUILD_TYPE)
set(ETH_BUILD_TYPE "unknown")
endif()

44
ethminer/MinerAux.h

@ -41,17 +41,17 @@
#include <libethcore/EthashGPUMiner.h>
#include <libethcore/EthashCPUMiner.h>
#include <libethcore/Farm.h>
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
#include <libethash-cl/ethash_cl_miner.h>
#endif
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
#include <libethash-cuda/ethash_cuda_miner.h>
#endif
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <jsonrpccpp/client/connectors/httpclient.h>
#include "BuildInfo.h"
#include "FarmClient.h"
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
#include <libstratum/EthStratumClient.h>
#include <libstratum/EthStratumClientV2.h>
#endif
@ -156,7 +156,7 @@ public:
cerr << "Bad " << arg << " option: " << argv[i] << endl;
BOOST_THROW_EXCEPTION(BadArgument());
}
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
else if ((arg == "-S" || arg == "--stratum") && i + 1 < argc)
{
mode = OperationMode::Stratum;
@ -254,7 +254,7 @@ public:
}
#endif
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
else if (arg == "--opencl-platform" && i + 1 < argc)
try {
m_openclPlatform = stol(argv[++i]);
@ -279,7 +279,7 @@ public:
}
}
#endif
#if ETH_ETHASHCL || ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCL || ETH_ETHASHCUDA
else if ((arg == "--cl-global-work" || arg == "--cuda-grid-size") && i + 1 < argc)
try {
m_globalWorkSizeMultiplier = stol(argv[++i]);
@ -303,11 +303,11 @@ public:
else if ((arg == "--cl-extragpu-mem" || arg == "--cuda-extragpu-mem") && i + 1 < argc)
m_extraGPUMemory = 1000000 * stol(argv[++i]);
#endif
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
else if (arg == "--allow-opencl-cpu")
m_clAllowCPU = true;
#endif
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
else if (arg == "--cuda-devices")
{
while (m_cudaDeviceCount < 16 && i + 1 < argc)
@ -475,11 +475,11 @@ public:
{
if (m_shouldListDevices)
{
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
if (m_minerType == MinerType::CL || m_minerType == MinerType::Mixed)
EthashGPUMiner::listDevices();
#endif
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
if (m_minerType == MinerType::CUDA || m_minerType == MinerType::Mixed)
EthashCUDAMiner::listDevices();
#endif
@ -495,7 +495,7 @@ public:
}
else if (m_minerType == MinerType::CL || m_minerType == MinerType::Mixed)
{
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
if (m_openclDeviceCount > 0)
{
EthashGPUMiner::setDevices(m_openclDevices, m_openclDeviceCount);
@ -522,7 +522,7 @@ public:
}
else if (m_minerType == MinerType::CUDA || m_minerType == MinerType::Mixed)
{
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
if (m_cudaDeviceCount > 0)
{
EthashCUDAMiner::setDevices(m_cudaDevices, m_cudaDeviceCount);
@ -552,7 +552,7 @@ public:
doFarm(m_minerType, m_activeFarmURL, m_farmRecheckPeriod);
else if (mode == OperationMode::Simulation)
doSimulation(m_minerType);
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
else if (mode == OperationMode::Stratum)
doStratum();
#endif
@ -565,7 +565,7 @@ public:
<< " -F,--farm <url> Put into mining farm mode with the work server at URL (default: http://127.0.0.1:8545)" << endl
<< " -FF,-FO, --farm-failover, --stratum-failover <url> Failover getwork/stratum URL (default: disabled)" << endl
<< " --farm-retries <n> Number of retries until switch to failover (default: 3)" << endl
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
<< " -S, --stratum <host:port> Put into stratum mode with the stratum server at host:port" << endl
<< " -FS, --failover-stratum <host:port> Failover stratum server at host:port" << endl
<< " -O, --userpass <username.workername:password> Stratum login credentials" << endl
@ -578,7 +578,7 @@ public:
<< " 2: EthereumStratum/1.0.0: nicehash" << endl
<< " -SE, --stratum-email <s> Email address used in eth-proxy (optional)" << endl
#endif
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
<< " --farm-recheck <n> Leave n ms between checks for changed work (default: 500). When using stratum, use a high value (i.e. 2000) to get more stable hashrate output" << endl
#endif
<< endl
@ -603,12 +603,12 @@ public:
<< " parallel - load DAG on all GPUs at the same time (default)" << endl
<< " sequential - load DAG on GPUs one after another. Use this when the miner crashes during DAG generation" << endl
<< " single <n> - generate DAG on device n, then copy to other devices" << endl
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
<< " --cl-extragpu-mem Set the memory (in MB) you believe your GPU requires for stuff other than mining. default: 0" << endl
<< " --cl-local-work Set the OpenCL local work size. Default is " << toString(ethash_cl_miner::c_defaultLocalWorkSize) << endl
<< " --cl-global-work Set the OpenCL global work size as a multiple of the local work size. Default is " << toString(ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier) << " * " << toString(ethash_cl_miner::c_defaultLocalWorkSize) << endl
#endif
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
<< " --cuda-extragpu-mem Set the memory (in MB) you believe your GPU requires for stuff other than mining. Windows rendering e.t.c.." << endl
<< " --cuda-block-size Set the CUDA block work size. Default is " << toString(ethash_cuda_miner::c_defaultBlockSize) << endl
<< " --cuda-grid-size Set the CUDA grid size. Default is " << toString(ethash_cuda_miner::c_defaultGridSize) << endl
@ -942,7 +942,7 @@ private:
exit(0);
}
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
void doStratum()
{
map<string, GenericFarm<EthashProofOfWork>::SealerDescriptor> sealers;
@ -1049,15 +1049,15 @@ private:
unsigned m_miningThreads = UINT_MAX;
bool m_shouldListDevices = false;
bool m_clAllowCPU = false;
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
unsigned m_openclDeviceCount = 0;
unsigned m_openclDevices[16];
#if !ETH_ETHASHCUDA || !ETH_TRUE
#if !ETH_ETHASHCUDA
unsigned m_globalWorkSizeMultiplier = ethash_cl_miner::c_defaultGlobalWorkSizeMultiplier;
unsigned m_localWorkSize = ethash_cl_miner::c_defaultLocalWorkSize;
#endif
#endif
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
unsigned m_globalWorkSizeMultiplier = ethash_cuda_miner::c_defaultGridSize;
unsigned m_localWorkSize = ethash_cuda_miner::c_defaultBlockSize;
unsigned m_cudaDeviceCount = 0;
@ -1087,7 +1087,7 @@ private:
bool m_farmRecheckSet = false;
int m_worktimeout = 180;
#if ETH_STRATUM || !ETH_TRUE
#if ETH_STRATUM
int m_stratumClientVersion = 1;
int m_stratumProtocol = STRATUM_PROTOCOL_STRATUM;
string m_user;

2
libethcore/EthashCUDAMiner.cpp

@ -21,7 +21,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
* Determines the PoW algorithm.
*/
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
#if defined(WIN32)
#include <Windows.h>

2
libethcore/EthashCUDAMiner.h

@ -22,7 +22,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if ETH_ETHASHCUDA || !ETH_TRUE
#if ETH_ETHASHCUDA
#include "libdevcore/Worker.h"
#include "EthashAux.h"

2
libethcore/EthashGPUMiner.cpp

@ -21,7 +21,7 @@
* Determines the PoW algorithm.
*/
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
#include "EthashGPUMiner.h"
#include <thread>

2
libethcore/EthashGPUMiner.h

@ -22,7 +22,7 @@
*/
#pragma once
#if ETH_ETHASHCL || !ETH_TRUE
#if ETH_ETHASHCL
#include "libdevcore/Worker.h"
#include "EthashAux.h"

Loading…
Cancel
Save