@@ -231,7 +231,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2")
231231endif ()
232232
233233file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly)
234- file (GENERATE
234+ file (GENERATE # TODO: Do this as a list
235235 OUTPUT include_gpu_onthefly/GPUReconstructionKernelList.h
236236 INPUT Base/GPUReconstructionKernelList.template.h
237237)
@@ -255,10 +255,15 @@ file(GENERATE
255255 OUTPUT include_gpu_onthefly/GPUDefParametersLoad.inc
256256 INPUT Definitions /GPUDefParametersLoad.template.inc
257257)
258- if (NOT ALIGPU_BUILD_TYPE STREQUAL "O2" )
259- include_directories (${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly)
260- endif ()
261- set (HDRS_INSTALL ${HDRS_INSTALL} ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUReconstructionKernelList.h ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParameters.h ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoad.inc)
258+ add_custom_command (
259+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h
260+ COMMAND echo -e $<JOIN:$<LIST:TRANSFORM,$<TARGET_PROPERTY:O2_GPU_KERNELS,O2_GPU_KERNEL_NAMES>,REPLACE,[^A-Za-z0-9]+,_>,\\n> | sed -E "s/(.*)/#ifndef GPUCA_LB_\\ 1\\ n#define GPUCA_LB_\\ 1 0\\ n#endif\\ n/g" > ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h
261+ COMMENT "Generating GPUDefParametersLoadPrepare.h"
262+ VERBATIM
263+ COMMAND_EXPAND_LISTS
264+ )
265+
266+ set (HDRS_INSTALL ${HDRS_INSTALL} ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUReconstructionKernelList.h ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParameters.h ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoad.inc ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h)
262267include (kernels.cmake)
263268
264269# Optional sources depending on optional dependencies
@@ -396,6 +401,13 @@ set_source_files_properties(Base/GPUReconstructionLibrary.cxx
396401 PROPERTIES
397402 INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR} " )
398403
404+ # Make sure header files generated with add_custom_command are built
405+ target_sources (${targetName}
406+ PUBLIC FILE_SET "generatedHeaders"
407+ TYPE HEADERS
408+ FILES ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h # TODO: build file list for this
409+ BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} )
410+ set_source_files_properties (${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h PROPERTIES GENERATED 1)
399411
400412# Add compile definitions and libraries depending on available optional dependencies
401413if (GPUCA_QA)
0 commit comments