diff --git a/.travis.yml b/.travis.yml index c97fdb993..61c3cc6ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: cache: ccache: true install: - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo add-apt-repository -y ppa:ethereum/ethereum; sudo apt-get update; sudo apt-get install -y --no-install-recommends --allow-unauthenticated libjson-rpc-cpp-dev libjsoncpp-dev libboost-all-dev libcurl4-openssl-dev libmicrohttpd-dev mesa-common-dev ocl-icd-libopencl1 opencl-headers; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo add-apt-repository -y ppa:ethereum/ethereum; sudo apt-get update; sudo apt-get install -y --no-install-recommends --allow-unauthenticated libjson-rpc-cpp-dev libjsoncpp-dev libcurl4-openssl-dev libmicrohttpd-dev mesa-common-dev ocl-icd-libopencl1 opencl-headers; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install libjson-rpc-cpp jsoncpp; fi script: - cmake -DETHASHCUDA=Off -DETHSTRATUM=On -DETHASHCL=On -H. -Bbuild diff --git a/CMakeLists.txt b/CMakeLists.txt index f67428e22..230dc5217 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.0) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) + # The default toolchain file configures compilers and build environment. + # This configuration is also used by hunter to build dependencies. + # CMake will cache this value, not need to explictly specify CACHE param. + set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain.cmake) +endif() + include(HunterGate) HunterGate( URL "https://github.com/ruslo/hunter/archive/v0.18.44.tar.gz" @@ -131,6 +138,9 @@ if ("x${TARGET_PLATFORM}" STREQUAL "x") set(TARGET_PLATFORM ${CMAKE_SYSTEM_NAME}) endif () +hunter_add_package(Boost COMPONENTS system) +find_package(Boost CONFIG REQUIRED COMPONENTS system) + include(EthDependencies) configureProject() diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 0a368aa75..7c2e35df3 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -3,7 +3,7 @@ # C++11 check and activation if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -Wno-error=parentheses -pedantic${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -Wextra -Wno-error=parentheses -pedantic${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") @@ -17,15 +17,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra") + set(CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -Wextra") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") - set(CMAKE_CXX_FLAGS_DEBUGSAN "-O1 -g -fsanitize=address,integer,undefined -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/sanitizer-blacklist.txt -fno-omit-frame-pointer -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_RELEASE") if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fcolor-diagnostics -Qunused-arguments -DBOOST_ASIO_HAS_CLANG_LIBCXX") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fcolor-diagnostics -Qunused-arguments") endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 0c5580bd4..359f836f8 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -19,23 +19,6 @@ include_directories(${ETH_GENERATED_DIR}) # custom cmake scripts set(ETH_SCRIPTS_DIR ${CMAKE_CURRENT_LIST_DIR}/scripts) -# Qt5 requires opengl -# TODO use proper version of windows SDK (32 vs 64) -# TODO make it possible to use older versions of windows SDK (7.0+ should also work) -# TODO it windows SDK is NOT FOUND, throw ERROR -# from https://github.com/rpavlik/cmake-modules/blob/master/FindWindowsSDK.cmake -if (WIN32) - find_package(WINDOWSSDK REQUIRED) - message(" - WindowsSDK dirs: ${WINDOWSSDK_DIRS}") - set (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WINDOWSSDK_DIRS}) -endif() - -# homebrew installs qts in opt -if (APPLE) - set (CMAKE_PREFIX_PATH "/usr/local/opt/qt5" ${CMAKE_PREFIX_PATH}) - set (CMAKE_PREFIX_PATH "/usr/local/opt/v8-315" ${CMAKE_PREFIX_PATH}) -endif() - find_program(CTEST_COMMAND ctest) message(STATUS "ctest path: ${CTEST_COMMAND}") @@ -72,32 +55,6 @@ endif() find_program(ETH_JSON_RPC_STUB jsonrpcstub) message(" - jsonrpcstub location : ${ETH_JSON_RPC_STUB}") -# use multithreaded boost libraries, with -mt suffix -set(Boost_USE_MULTITHREADED ON) - -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - -# TODO hanlde other msvc versions or it will fail find them - set(Boost_COMPILER -vc120) -# use static boost libraries *.lib - set(Boost_USE_STATIC_LIBS ON) - -elseif (APPLE) - -# use static boost libraries *.a - set(Boost_USE_STATIC_LIBS ON) - -elseif (UNIX) -# use dynamic boost libraries .dll - set(Boost_USE_STATIC_LIBS OFF) - -endif() - -find_package(Boost 1.54.0 REQUIRED COMPONENTS system) - -message(" - boost header: ${Boost_INCLUDE_DIRS}") -message(" - boost lib : ${Boost_LIBRARIES}") - if (APPLE) link_directories(/usr/local/lib) include_directories(/usr/local/include) diff --git a/cmake/scripts/runtest.cmake b/cmake/scripts/runtest.cmake deleted file mode 100644 index 15f7409ef..000000000 --- a/cmake/scripts/runtest.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# Should be used to run ctest -# -# example usage: -# cmake -DETH_TEST_NAME=TestInterfaceStub -DCTEST_COMMAND=/path/to/ctest -P scripts/runtest.cmake - -if (NOT CTEST_COMMAND) - message(FATAL_ERROR "ctest could not be found!") -endif() - -# verbosity is off, cause BOOST_MESSAGE is not thread safe and output is a trash -# see https://codecrafter.wordpress.com/2012/11/01/c-unit-test-framework-adapter-part-3/ -# -# output might not be usefull cause of thread safety issue -execute_process(COMMAND ${CTEST_COMMAND} --force-new-ctest-process -C Debug --output-on-failure -j 4 -R "${ETH_TEST_NAME}[.].*") - diff --git a/cmake/toolchain.cmake b/cmake/toolchain.cmake new file mode 100644 index 000000000..0ae619724 --- /dev/null +++ b/cmake/toolchain.cmake @@ -0,0 +1,3 @@ +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_EXTENSIONS Off) diff --git a/ethminer/CMakeLists.txt b/ethminer/CMakeLists.txt index 7f8aad61c..28daf9064 100644 --- a/ethminer/CMakeLists.txt +++ b/ethminer/CMakeLists.txt @@ -4,7 +4,6 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${Boost_INCLUDE_DIRS}) if (JSONRPC) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 366d0f680..50f100cb2 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -800,7 +800,7 @@ private: else if (_m == MinerType::CUDA) f.start("cuda", false); EthashProofOfWork::WorkPackage current, previous; - boost::mutex x_current; + std::mutex x_current; EthashAux::FullType dag; while (m_running) try diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index f62e474de..3fb79cbea 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -4,7 +4,6 @@ aux_source_directory(. SOURCES) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ..) -include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE devcore) @@ -12,24 +11,14 @@ file(GLOB HEADERS "*.h") add_library(devcore ${SOURCES} ${HEADERS}) -target_link_libraries(devcore ${Boost_THREAD_LIBRARIES}) -target_link_libraries(devcore ${Boost_RANDOM_LIBRARIES}) -target_link_libraries(devcore ${Boost_FILESYSTEM_LIBRARIES}) -target_link_libraries(devcore ${Boost_SYSTEM_LIBRARIES}) -target_link_libraries(devcore ${JSONCPP_LIBRARIES}) - -# transitive dependencies for windows executables -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) - target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -endif() +target_link_libraries(devcore PUBLIC ${JSONCPP_LIBRARIES} Boost::boost) if (APPLE) find_package(Threads REQUIRED) - target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${EXECUTABLE} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) elseif (UNIX) find_package(Threads REQUIRED) - target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${EXECUTABLE} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif() install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) diff --git a/libdevcore/Common.h b/libdevcore/Common.h index f78ce690e..dba0531de 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -41,18 +41,8 @@ #include #include #include -#include #include -#pragma warning(push) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#if (BOOST_VERSION == 105800) - #include "boost_multiprecision_number_compare_bug_workaround.hpp" -#endif #include -#pragma warning(pop) -#pragma GCC diagnostic pop #include "vector_ref.h" // CryptoPP defines byte in the global namespace, so must we. diff --git a/libdevcore/Guards.h b/libdevcore/Guards.h index 1436a7c43..2f1509b9a 100644 --- a/libdevcore/Guards.h +++ b/libdevcore/Guards.h @@ -24,12 +24,6 @@ #include #include #include -#pragma warning(push) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#pragma warning(pop) -#pragma GCC diagnostic pop namespace dev { diff --git a/libdevcore/Log.h b/libdevcore/Log.h index 2dc547dd7..92e9493f1 100644 --- a/libdevcore/Log.h +++ b/libdevcore/Log.h @@ -25,12 +25,6 @@ #include #include -#pragma warning(push) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#pragma warning(pop) -#pragma GCC diagnostic pop #include "vector_ref.h" #include "Common.h" #include "CommonData.h" diff --git a/libdevcore/Worker.h b/libdevcore/Worker.h index 23c90ab78..4301639e4 100644 --- a/libdevcore/Worker.h +++ b/libdevcore/Worker.h @@ -24,6 +24,7 @@ #include #include #include +#include #include "Guards.h" namespace dev diff --git a/libdevcore/boost_multiprecision_number_compare_bug_workaround.hpp b/libdevcore/boost_multiprecision_number_compare_bug_workaround.hpp deleted file mode 100644 index dae591dfb..000000000 --- a/libdevcore/boost_multiprecision_number_compare_bug_workaround.hpp +++ /dev/null @@ -1,520 +0,0 @@ - -// This is a copy of boost/multiprecision/detail/number_compare.hpp from boost 1.59 to replace buggy version from 1.58. - -#ifdef BOOST_MP_COMPARE_HPP -#error This bug workaround header must be included before original boost/multiprecision/detail/number_compare.hpp -#endif - -/////////////////////////////////////////////////////////////////////////////// -// Copyright 2012 John Maddock. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_MP_COMPARE_HPP -#define BOOST_MP_COMPARE_HPP - -// A copy of boost/multiprecision/traits/is_backend.hpp -#ifndef BOOST_MP_IS_BACKEND_HPP -#define BOOST_MP_IS_BACKEND_HPP - -#include -#include -#include -#include -#include - -namespace boost{ namespace multiprecision{ namespace detail{ - - BOOST_MPL_HAS_XXX_TRAIT_DEF(signed_types) - BOOST_MPL_HAS_XXX_TRAIT_DEF(unsigned_types) - BOOST_MPL_HAS_XXX_TRAIT_DEF(float_types) - - template - struct is_backend - { - static const bool value = has_signed_types::value && has_unsigned_types::value && has_float_types::value; - }; - - template - struct other_backend - { - typedef typename boost::conditional< - boost::is_same, number >::value, - number, number >::type type; - }; - - template - struct number_from_backend - { - typedef typename boost::conditional < - boost::is_convertible >::value, - number, - typename other_backend::type > ::type type; - }; - - template - struct is_first_backend_imp{ static const bool value = false; }; - template - struct is_first_backend_imp{ static const bool value = is_convertible >::value || is_convertible >::value; }; - - template - struct is_first_backend : is_first_backend_imp::value, T, U> {}; - - template - struct is_second_backend_imp{ static const bool value = false; }; - template - struct is_second_backend_imp{ static const bool value = is_convertible >::value || is_convertible >::value; }; - - template - struct is_second_backend : is_second_backend_imp::value, T, U> {}; - -} -} -} - -#endif // BOOST_MP_IS_BACKEND_HPP - -// -// Comparison operators for number. -// - -namespace boost{ namespace multiprecision{ - -namespace default_ops{ - -template -inline bool eval_eq(const B& a, const B& b) -{ - return a.compare(b) == 0; -} -template -inline typename enable_if_c::value, bool>::type eval_eq(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(b); - return eval_eq(a, t.backend()); -} -template -inline typename enable_if_c::value, bool>::type eval_eq(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(a); - return eval_eq(t.backend(), b); -} - -template -inline bool eval_lt(const B& a, const B& b) -{ - return a.compare(b) < 0; -} -template -inline typename enable_if_c::value, bool>::type eval_lt(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(b); - return eval_lt(a, t.backend()); -} -template -inline typename enable_if_c::value, bool>::type eval_lt(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(a); - return eval_lt(t.backend(), b); -} - -template -inline bool eval_gt(const B& a, const B& b) -{ - return a.compare(b) > 0; -} -template -inline typename enable_if_c::value, bool>::type eval_gt(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(b); - return eval_gt(a, t.backend()); -} -template -inline typename enable_if_c::value, bool>::type eval_gt(const T& a, const U& b) -{ - typename boost::multiprecision::detail::number_from_backend::type t(a); - return eval_gt(t.backend(), b); -} - -} // namespace default_ops - -namespace detail{ - -template -struct is_valid_mixed_compare : public mpl::false_ {}; - -template -struct is_valid_mixed_compare, Val> : public is_convertible > {}; - -template -struct is_valid_mixed_compare, number > : public mpl::false_ {}; - -template -struct is_valid_mixed_compare, expression > - : public mpl::bool_, number >::value> {}; - -template -struct is_valid_mixed_compare, number > - : public mpl::bool_, number >::value> {}; - -template -inline BOOST_CONSTEXPR typename boost::enable_if_c::value != number_kind_floating_point, bool>::type is_unordered_value(const number&) -{ - return false; -} -template -inline BOOST_CONSTEXPR typename boost::enable_if_c::value == number_kind_floating_point, bool>::type is_unordered_value(const number& a) -{ - using default_ops::eval_fpclassify; - return eval_fpclassify(a.backend()) == FP_NAN; -} - -template -inline BOOST_CONSTEXPR typename boost::enable_if_c::value != number_kind_floating_point, bool>::type is_unordered_value(const Arithmetic&) -{ - return false; -} -template -inline BOOST_CONSTEXPR typename boost::enable_if_c::value == number_kind_floating_point, bool>::type is_unordered_value(const Arithmetic& a) -{ - return (boost::math::isnan)(a); -} - -template -inline BOOST_CONSTEXPR bool is_unordered_comparison(const T& a, const U& b) -{ - return is_unordered_value(a) || is_unordered_value(b); -} - -} - -template -inline bool operator == (const number& a, const number& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_eq(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator == (const number& a, const Arithmetic& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_eq(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator == (const Arithmetic& a, const number& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_eq(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator == (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_eq; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return false; - return eval_eq(t.backend(), result_type::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator == (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_eq; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return false; - return eval_eq(t.backend(), result_type::canonical_value(b)); -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator == (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_eq; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return false; - return eval_eq(t.backend(), t2.backend()); -} - -template -inline bool operator != (const number& a, const number& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return true; - return !eval_eq(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator != (const number& a, const Arithmetic& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return true; - return !eval_eq(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator != (const Arithmetic& a, const number& b) -{ - using default_ops::eval_eq; - if(detail::is_unordered_comparison(a, b)) return true; - return !eval_eq(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator != (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_eq; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return true; - return !eval_eq(t.backend(), result_type::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator != (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_eq; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return true; - return !eval_eq(t.backend(), result_type::canonical_value(b)); -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator != (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_eq; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return true; - return !eval_eq(t.backend(), t2.backend()); -} - -template -inline bool operator < (const number& a, const number& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_lt(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator < (const number& a, const Arithmetic& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_lt(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator < (const Arithmetic& a, const number& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_gt(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator < (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_gt; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return false; - return eval_gt(t.backend(), result_type::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator < (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_lt; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return false; - return eval_lt(t.backend(), result_type::canonical_value(b)); -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator < (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_lt; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return false; - return eval_lt(t.backend(), t2.backend()); -} - -template -inline bool operator > (const number& a, const number& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_gt(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator > (const number& a, const Arithmetic& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_gt(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator > (const Arithmetic& a, const number& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return eval_lt(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator > (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_lt; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return false; - return a > t; -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator > (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_gt; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return false; - return t > b; -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator > (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_gt; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return false; - return t > t2; -} - -template -inline bool operator <= (const number& a, const number& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_gt(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator <= (const number& a, const Arithmetic& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_gt(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator <= (const Arithmetic& a, const number& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_lt(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator <= (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_lt; - if(detail::is_unordered_value(a) || detail::is_unordered_value(b)) - return false; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return false; - return !eval_lt(t.backend(), result_type::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator <= (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_gt; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return false; - return !eval_gt(t.backend(), result_type::canonical_value(b)); -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator <= (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_gt; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return false; - return !eval_gt(t.backend(), t2.backend()); -} - -template -inline bool operator >= (const number& a, const number& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_lt(a.backend(), b.backend()); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator >= (const number& a, const Arithmetic& b) -{ - using default_ops::eval_lt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_lt(a.backend(), number::canonical_value(b)); -} -template -inline typename enable_if_c, Arithmetic>::value, bool>::type - operator >= (const Arithmetic& a, const number& b) -{ - using default_ops::eval_gt; - if(detail::is_unordered_comparison(a, b)) return false; - return !eval_gt(b.backend(), number::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator >= (const Arithmetic& a, const detail::expression& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_gt; - result_type t(b); - if(detail::is_unordered_comparison(a, t)) return false; - return !eval_gt(t.backend(), result_type::canonical_value(a)); -} -template -inline typename enable_if_c::result_type, Arithmetic>::value, bool>::type - operator >= (const detail::expression& a, const Arithmetic& b) -{ - typedef typename detail::expression::result_type result_type; - using default_ops::eval_lt; - result_type t(a); - if(detail::is_unordered_comparison(t, b)) return false; - return !eval_lt(t.backend(), result_type::canonical_value(b)); -} -template -inline typename enable_if::result_type, typename detail::expression::result_type>, bool>::type - operator >= (const detail::expression& a, const detail::expression& b) -{ - using default_ops::eval_lt; - typename detail::expression::result_type t(a); - typename detail::expression::result_type t2(b); - if(detail::is_unordered_comparison(t, t2)) return false; - return !eval_lt(t.backend(), t2.backend()); -} - - -}} // namespaces - -#endif // BOOST_MP_COMPARE_HPP diff --git a/libethash-cl/CMakeLists.txt b/libethash-cl/CMakeLists.txt index cc2d5f2da..9af84f9a4 100644 --- a/libethash-cl/CMakeLists.txt +++ b/libethash-cl/CMakeLists.txt @@ -20,7 +20,6 @@ file(GLOB OUR_HEADERS "*.h") set(HEADERS ${OUR_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${Boost_INCLUDE_DIRS}) include_directories(..) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) target_include_directories(${EXECUTABLE} PUBLIC SYSTEM ${OpenCL_INCLUDE_DIR}) diff --git a/libethcore/CMakeLists.txt b/libethcore/CMakeLists.txt index fb5f52b60..6adb99551 100644 --- a/libethcore/CMakeLists.txt +++ b/libethcore/CMakeLists.txt @@ -1,17 +1,14 @@ -cmake_policy(SET CMP0015 NEW) - file(GLOB SOURCES "*.cpp") file(GLOB HEADERS "*.h") include_directories(BEFORE ..) -include_directories(${Boost_INCLUDE_DIRS}) if (ETHASHCUDA) include_directories(${CUDA_INCLUDE_DIRS}) endif () add_library(ethcore ${SOURCES} ${HEADERS}) -target_link_libraries(ethcore ethash pthread) +target_link_libraries(ethcore ethash devcore pthread) if (ETHASHCL) target_link_libraries(ethcore ethash-cl) diff --git a/libstratum/CMakeLists.txt b/libstratum/CMakeLists.txt index 349b6dbd1..7edafed44 100644 --- a/libstratum/CMakeLists.txt +++ b/libstratum/CMakeLists.txt @@ -1,15 +1,11 @@ -set(EXECUTABLE ethstratum) - -aux_source_directory(. SRC_LIST) - include_directories(..) -include_directories(${Boost_INCLUDE_DIRS}) include_directories(${JSONCPP_INCLUDE_DIRS}) -file(GLOB HEADERS "*.h") - -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY} pthread) +set(SOURCES + EthStratumClient.h EthStratumClient.cpp + EthStratumClientV2.h EthStratumClientV2.cpp +) -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) -install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) +add_library(ethstratum ${SOURCES}) +target_link_libraries(ethstratum PUBLIC Boost::system) +target_include_directories(ethstratum PUBLIC SYSTEM ${JSONCPP_INCLUDE_DIRS}) diff --git a/libstratum/EthStratumClient.h b/libstratum/EthStratumClient.h index faf2a1139..6b4e49bae 100644 --- a/libstratum/EthStratumClient.h +++ b/libstratum/EthStratumClient.h @@ -65,11 +65,11 @@ private: int m_waitState = MINER_WAIT_STATE_WORK; - boost::mutex x_pending; + std::mutex x_pending; int m_pending; GenericFarm * p_farm; - boost::mutex x_current; + std::mutex x_current; EthashProofOfWork::WorkPackage m_current; EthashProofOfWork::WorkPackage m_previous;