@@ -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,19 @@ 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+ file (GENERATE
259+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /GPUDefParametersLoadPrepareBase
260+ CONTENT "$<JOIN:$<LIST:TRANSFORM,$<TARGET_PROPERTY:O2_GPU_KERNELS,O2_GPU_KERNEL_NAMES>,REPLACE,[^A-Za-z0-9]+,_>,\n >"
261+ )
262+ add_custom_command (
263+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h
264+ COMMAND awk "{print(\" #ifndef GPUCA_LB_\" $0 \"\\ n#define GPUCA_LB_\" $0 \" 0\\ n#endif\" )}" ${CMAKE_CURRENT_BINARY_DIR} /GPUDefParametersLoadPrepareBase > ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h
265+ COMMENT "Generating GPUDefParametersLoadPrepare.h"
266+ VERBATIM
267+ COMMAND_EXPAND_LISTS
268+ )
269+
270+ 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)
262271include (kernels.cmake)
263272
264273# Optional sources depending on optional dependencies
@@ -396,6 +405,12 @@ set_source_files_properties(Base/GPUReconstructionLibrary.cxx
396405 PROPERTIES
397406 INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR} " )
398407
408+ # Make sure header files generated with add_custom_command are built
409+ target_sources (${targetName}
410+ PRIVATE FILE_SET "generatedHeaders"
411+ TYPE HEADERS
412+ FILES ${CMAKE_CURRENT_BINARY_DIR} /include_gpu_onthefly/GPUDefParametersLoadPrepare.h # TODO: build file list for this
413+ BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} )
399414
400415# Add compile definitions and libraries depending on available optional dependencies
401416if (GPUCA_QA)
0 commit comments