diff --git a/.travis.yml b/.travis.yml index 61c3cc6ac..33b41d0f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,10 @@ matrix: osx_image: xcode8.3 cache: ccache: true + directories: + - $HOME/.hunter 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 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; 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/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 359f836f8..1bd27fb48 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -39,12 +39,6 @@ find_package (CURL) message(" - curl header: ${CURL_INCLUDE_DIRS}") message(" - curl lib : ${CURL_LIBRARIES}") -find_package (OpenCL) -if (OpenCL_FOUND) - message(" - opencl header: ${OpenCL_INCLUDE_DIRS}") - message(" - opencl lib : ${OpenCL_LIBRARIES}") -endif() - find_package (CUDA) if (CUDA_FOUND) message(" - CUDA header: ${CUDA_INCLUDE_DIRS}") diff --git a/cmake/FindEth.cmake b/cmake/FindEth.cmake deleted file mode 100644 index 8f887a027..000000000 --- a/cmake/FindEth.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Find ethereum -# -# Find the ethereum includes and library -# -# This module defines -# ETH_CORE_LIBRARIES, the libraries needed to use ethereum. -# ETH_FOUND, If false, do not try to use ethereum. -# TODO: ETH_INCLUDE_DIRS - -set(CORE_LIBS web3jsonrpc;webthree;whisper;ethereum;evm;ethcore;lll;p2p;evmasm;devcrypto;evmcore;natspec;devcore;ethash-cl;ethash;secp256k1;scrypt;jsqrc) -set(ALL_LIBS ${CORE_LIBS};evmjit;solidity;secp256k1) - -set(ETH_INCLUDE_DIRS ${ETH_INCLUDE_DIR}) -set(ETH_CORE_LIBRARIES ${ETH_LIBRARY}) - -foreach (l ${ALL_LIBS}) - string(TOUPPER ${l} L) - find_library(ETH_${L}_LIBRARY - NAMES ${l} - PATH_SUFFIXES "lib${l}" "${l}" - ) -endforeach() - -foreach (l ${CORE_LIBS}) - string(TOUPPER ${l} L) - list(APPEND ETH_CORE_LIBRARIES ${ETH_${L}_LIBRARY}) -endforeach() - -# handle the QUIETLY and REQUIRED arguments and set ETH_FOUND to TRUE -# if all listed variables are TRUE, hide their existence from configuration view -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ethereum DEFAULT_MSG - ETH_CORE_LIBRARIES) -mark_as_advanced (ETH_CORE_LIBRARIES) - diff --git a/cmake/FindOpenCL.cmake b/cmake/FindOpenCL.cmake deleted file mode 100644 index d756100c9..000000000 --- a/cmake/FindOpenCL.cmake +++ /dev/null @@ -1,154 +0,0 @@ -#.rst: -# FindOpenCL -# ---------- -# -# Try to find OpenCL -# -# Once done this will define:: -# -# OpenCL_FOUND - True if OpenCL was found -# OpenCL_INCLUDE_DIRS - include directories for OpenCL -# OpenCL_LIBRARIES - link against this library to use OpenCL -# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2) -# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation -# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation -# -# The module will also define two cache variables:: -# -# OpenCL_INCLUDE_DIR - the OpenCL include directory -# OpenCL_LIBRARY - the path to the OpenCL library -# - -#============================================================================= -# Copyright 2014 Matthaeus G. Chajdas -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -function(_FIND_OPENCL_VERSION) - include(CheckSymbolExists) - include(CMakePushCheckState) - set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) - - CMAKE_PUSH_CHECK_STATE() - foreach(VERSION "2_0" "1_2" "1_1" "1_0") - set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}") - - if(APPLE) - CHECK_SYMBOL_EXISTS( - CL_VERSION_${VERSION} - "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h" - OPENCL_VERSION_${VERSION}) - else() - CHECK_SYMBOL_EXISTS( - CL_VERSION_${VERSION} - "${OpenCL_INCLUDE_DIR}/CL/cl.h" - OPENCL_VERSION_${VERSION}) - endif() - - if(OPENCL_VERSION_${VERSION}) - string(REPLACE "_" "." VERSION "${VERSION}") - set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE) - string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}") - list(GET version_components 0 major_version) - list(GET version_components 1 minor_version) - set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE) - set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE) - break() - endif() - endforeach() - CMAKE_POP_CHECK_STATE() -endfunction() - -find_path(OpenCL_INCLUDE_DIR - NAMES - CL/cl.h OpenCL/cl.h - PATHS - ENV "PROGRAMFILES(X86)" - ENV AMDAPPSDKROOT - ENV INTELOCLSDKROOT - ENV NVSDKCOMPUTE_ROOT - ENV CUDA_PATH - ENV ATISTREAMSDKROOT - PATH_SUFFIXES - include - OpenCL/common/inc - "AMD APP/include") - -_FIND_OPENCL_VERSION() - -if(WIN32) - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - find_library(OpenCL_LIBRARY - NAMES OpenCL - PATHS - ENV "PROGRAMFILES(X86)" - ENV AMDAPPSDKROOT - ENV INTELOCLSDKROOT - ENV CUDA_PATH - ENV NVSDKCOMPUTE_ROOT - ENV ATISTREAMSDKROOT - PATH_SUFFIXES - "AMD APP/lib/x86" - lib/x86 - lib/Win32 - OpenCL/common/lib/Win32) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - find_library(OpenCL_LIBRARY - NAMES OpenCL - PATHS - ENV "PROGRAMFILES(X86)" - ENV AMDAPPSDKROOT - ENV INTELOCLSDKROOT - ENV CUDA_PATH - ENV NVSDKCOMPUTE_ROOT - ENV ATISTREAMSDKROOT - PATH_SUFFIXES - "AMD APP/lib/x86_64" - lib/x86_64 - lib/x64 - OpenCL/common/lib/x64) - endif() -else() - find_library(OpenCL_LIBRARY - NAMES OpenCL libOpenCL.so.1) -endif() - -set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) -set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) - -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - - find_library( - OpenCL_LIBRARY_DEBUG - NAMES OpenCL_d - ) - - set(OpenCL_LIBRARIES optimized ${OpenCL_LIBRARY} debug ${OpenCL_LIBRARY_DEBUG}) - - # prepare dlls - string(REPLACE ".lib" ".dll" OpenCL_DLL ${OpenCL_LIBRARY}) - string(REPLACE "/lib/" "/bin/" OpenCL_DLL ${OpenCL_DLL}) - string(REPLACE ".lib" ".dll" OpenCL_DLL_DEBUG ${OpenCL_LIBRARY_DEBUG}) - string(REPLACE "/lib/" "/bin/" OpenCL_DLL_DEBUG ${OpenCL_DLL_DEBUG}) - set(OpenCL_DLLS optimized ${OpenCL_DLL} debug ${OpenCL_DLL_DEBUG}) - -endif() - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args( - OpenCL - FOUND_VAR OpenCL_FOUND - REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR - VERSION_VAR OpenCL_VERSION_STRING) - -mark_as_advanced( - OpenCL_INCLUDE_DIR - OpenCL_LIBRARY) diff --git a/ethminer/CMakeLists.txt b/ethminer/CMakeLists.txt index 28daf9064..b8ae9c892 100644 --- a/ethminer/CMakeLists.txt +++ b/ethminer/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_policy(SET CMP0015 NEW) -set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) @@ -22,8 +21,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARIES}) - if (JSONRPC) target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_CLIENT_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${CURL_LIBRARIES}) @@ -40,13 +37,5 @@ if (ETHSTRATUM) target_link_libraries(${EXECUTABLE} ethstratum) endif() -if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW) - eth_copy_dlls("${EXECUTABLE}" OpenCL_DLLS) -endif() - - -if (APPLE) - install(TARGETS ${EXECUTABLE} DESTINATION bin) -else() - eth_install_executable(${EXECUTABLE}) -endif() +include(GNUInstallDirs) +install(TARGETS ethminer DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 50f100cb2..f1c9ab464 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -47,7 +47,6 @@ #if ETH_ETHASHCUDA #include #endif -#include #include #include "BuildInfo.h" #include "FarmClient.h" diff --git a/libethash-cl/CMakeLists.txt b/libethash-cl/CMakeLists.txt index 9af84f9a4..0e52383ae 100644 --- a/libethash-cl/CMakeLists.txt +++ b/libethash-cl/CMakeLists.txt @@ -1,5 +1,3 @@ -set(EXECUTABLE ethash-cl) - # A custom command and target to turn the OpenCL kernel into a byte array header # The normal build depends on it properly and if the kernel file is changed, then # a rebuild of libethash-cl should be triggered @@ -19,11 +17,16 @@ aux_source_directory(. SRC_LIST) file(GLOB OUR_HEADERS "*.h") set(HEADERS ${OUR_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) +if(NOT APPLE) +# TODO: Take cl.hpp also from hunter. + hunter_add_package(OpenCL) +endif() +find_package(OpenCL REQUIRED) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(..) -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -target_include_directories(${EXECUTABLE} PUBLIC SYSTEM ${OpenCL_INCLUDE_DIR}) -target_link_libraries(${EXECUTABLE} ${OpenCL_LIBRARIES} ethash) -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) -install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) +add_library(ethash-cl ${SRC_LIST} ${HEADERS}) +target_link_libraries(ethash-cl PUBLIC ethash) +target_link_libraries(ethash-cl PRIVATE ${OpenCL_LIBRARY}) +target_include_directories(ethash-cl PRIVATE SYSTEM ${OpenCL_INCLUDE_DIR}) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index 4cd3a2686..7557f05c7 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include