Browse Source

Add cmake command for OpenCL kernel code

The OpenCL kernel gets parsed and copied into a byte array accessible
by a specific header during the cmake configuration step.

We are now adding a special command "make clbin2h" which would generate
this header byte array on demand
cl-refactor
Lefteris Karapetsas 9 years ago
parent
commit
4bb4a8aa60
  1. 10
      libethash-cl/CMakeLists.txt

10
libethash-cl/CMakeLists.txt

@ -5,6 +5,16 @@ bin2h(SOURCE_FILE ethash_cl_miner_kernel.cl
VARIABLE_NAME ethash_cl_miner_kernel
HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h)
# Add a custom command so that the user can regenerate the header file containing the kernel
# code's bytearray by running "make clbin2h"
add_custom_target(clbin2h)
add_custom_command(TARGET clbin2h
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -DBIN2H_SOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl"
-DBIN2H_VARIABLE_NAME=ethash_cl_miner_kernel
-DBIN2H_HEADER_FILE="${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h"
-P "${CMAKE_CURRENT_SOURCE_DIR}/bin2h.cmake")
aux_source_directory(. SRC_LIST)
file(GLOB HEADERS "*.h")

Loading…
Cancel
Save