Browse Source

Use external prebuilt OpenCL ICD DLL.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
9b45b6b571
  1. 5
      CMakeLists.txt
  2. 18
      cmake/FindOpenCL.cmake
  3. 5
      eth/CMakeLists.txt
  4. 1
      ethminer/CMakeLists.txt
  5. 7
      libethash-cl/CMakeLists.txt
  6. 2
      libethash-cl/ethash_cl_miner.cpp

5
CMakeLists.txt

@ -426,11 +426,6 @@ if (GENERAL OR MINER)
add_subdirectory(libethash)
if (ETHASHCL)
add_subdirectory(libethash-cl)
if (APPLE)
else()
add_subdirectory(khronos_icd)
set(OpenCL_TARGET OpenCL_ICD)
endif()
endif ()
endif ()

18
cmake/FindOpenCL.cmake

@ -124,6 +124,24 @@ 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

5
eth/CMakeLists.txt

@ -30,7 +30,8 @@ if (JSONRPC)
target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_CLIENT_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${CURL_LIBRARIES})
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
eth_copy_dlls(${EXECUTABLE} CURL_DLLS)
eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
eth_copy_dlls("${EXECUTABLE}" OpenCL_DLLS)
endif()
endif()
@ -42,7 +43,7 @@ if (JSCONSOLE)
endif()
#if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
# eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
# eth_copy_dlls("${EXECUTABLE}" MHD_DLLS OpenCL_DLLS)
#endif()
if (APPLE)

1
ethminer/CMakeLists.txt

@ -33,6 +33,7 @@ target_link_libraries(${EXECUTABLE} ethash)
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
eth_copy_dlls("${EXECUTABLE}" OpenCL_DLLS)
endif()
if (APPLE)

7
libethash-cl/CMakeLists.txt

@ -23,11 +23,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
if (APPLE)
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${OpenCL_LIBRARY} ethash)
else()
TARGET_LINK_LIBRARIES(${EXECUTABLE} OpenCL_ICD ethash)
endif()
target_include_directories(${EXECUTABLE} PUBLIC ${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} )

2
libethash-cl/ethash_cl_miner.cpp

@ -180,7 +180,7 @@ bool ethash_cl_miner::configureGPU(
// by default let's only consider the DAG of the first epoch
uint64_t dagSize = ethash_get_datasize(_currentBlock);
uint64_t requiredSize = dagSize + _extraGPUMemory;
return searchForAllDevices(_platformId, [&requiredSize](cl::Device const _device) -> bool
return searchForAllDevices(_platformId, [&requiredSize](cl::Device const& _device) -> bool
{
cl_ulong result;
_device.getInfo(CL_DEVICE_GLOBAL_MEM_SIZE, &result);

Loading…
Cancel
Save