Browse Source

Disable OpenCL_ICD on OSX.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
63730439b8
  1. 15
      CMakeLists.txt
  2. 2
      exp/CMakeLists.txt
  3. 3
      libethash-cl/CMakeLists.txt
  4. 6
      libethash-cl/ethash_cl_miner.cpp

15
CMakeLists.txt

@ -131,7 +131,7 @@ function(createBuildInfo)
add_custom_target(BuildInfo.h ALL
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}"
-DETH_BUILD_TYPE="${_cmake_build_type}" -DETH_BUILD_PLATFORM="${ETH_BUILD_PLATFORM}"
-P "${ETH_SCRIPTS_DIR}/buildinfo.cmake"
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@ -175,9 +175,9 @@ endif ()
macro(eth_format_option O)
if (${${O}})
set(${O} ON)
set(${O} ON)
else()
set(${O} OFF)
set(${O} OFF)
endif()
endmacro()
@ -426,7 +426,14 @@ if (GENERAL OR MINER)
add_subdirectory(libethash)
if (ETHASHCL)
add_subdirectory(libethash-cl)
add_subdirectory(khronos_icd)
if (APPLE)
add_library(OpenCL SHARED IMPORTED)
set_property(TARGET OpenCL PROPERTY IMPORTED_LOCATION ${OpenCL_LIBRARY})
set(OpenCL_TARGET OpenCL)
else()
add_subdirectory(khronos_icd)
set(OpenCL_TARGET OpenCL_ICD)
endif()
endif ()
endif ()

2
exp/CMakeLists.txt

@ -27,6 +27,6 @@ target_link_libraries(${EXECUTABLE} p2p)
if (ETHASHCL)
target_link_libraries(${EXECUTABLE} ethash-cl)
target_link_libraries(${EXECUTABLE} ethash)
target_link_libraries(${EXECUTABLE} OpenCL_ICD)
target_link_libraries(${EXECUTABLE} ${OpenCL_TARGET})
endif()
install( TARGETS ${EXECUTABLE} DESTINATION bin)

3
libethash-cl/CMakeLists.txt

@ -23,8 +23,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
TARGET_LINK_LIBRARIES(${EXECUTABLE} OpenCL_ICD ethash)
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${OpenCL_TARGET} ethash)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )

6
libethash-cl/ethash_cl_miner.cpp

@ -87,9 +87,11 @@ std::vector<cl::Platform> ethash_cl_miner::getPlatforms()
}
catch(cl::Error const& err)
{
#if !defined(CL_PLATFORM_NOT_FOUND_KHR)
if (err.err() == CL_PLATFORM_NOT_FOUND_KHR)
ETHCL_LOG("No OpenCL platforms found");
else
#endif
throw err;
}
return platforms;
@ -190,7 +192,7 @@ bool ethash_cl_miner::configureGPU(
);
return true;
}
ETHCL_LOG(
"OpenCL device " << _device.getInfo<CL_DEVICE_NAME>()
<< " has insufficient GPU memory." << result <<
@ -231,7 +233,7 @@ bool ethash_cl_miner::searchForAllDevices(unsigned _platformId, function<bool(cl
for (cl::Device const& device: devices)
if (_callback(device))
return true;
return false;
}

Loading…
Cancel
Save