Skip to content

Commit 7872ee5

Browse files
committed
GPU CMake: cleanup and fix some todos
1 parent 7e212e1 commit 7872ee5

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

GPU/GPUTracking/CMakeLists.txt

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -230,31 +230,21 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2")
230230
Interface/GPUO2InterfaceConfigurableParam.cxx)
231231
endif()
232232

233+
set(TEMPLATE_HEADER_LIST Base/GPUReconstructionKernelList.template.h
234+
Base/GPUReconstructionKernelIncludes.template.h
235+
Base/GPUReconstructionIncludesDeviceAll.template.h
236+
cmake/GPUNoFastMathKernels.template.h
237+
Definitions/GPUDefParameters.template.h
238+
Definitions/GPUDefParametersLoad.template.inc)
239+
set(GENERATED_HEADERS_LIST "")
240+
233241
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include_gpu_onthefly)
234-
file(GENERATE # TODO: Do this as a list
235-
OUTPUT include_gpu_onthefly/GPUReconstructionKernelList.h
236-
INPUT Base/GPUReconstructionKernelList.template.h
237-
)
238-
file(GENERATE
239-
OUTPUT include_gpu_onthefly/GPUReconstructionKernelIncludes.h
240-
INPUT Base/GPUReconstructionKernelIncludes.template.h
241-
)
242-
file(GENERATE
243-
OUTPUT include_gpu_onthefly/GPUReconstructionIncludesDeviceAll.h
244-
INPUT Base/GPUReconstructionIncludesDeviceAll.template.h
245-
)
246-
file(GENERATE
247-
OUTPUT include_gpu_onthefly/GPUNoFastMathKernels.h
248-
INPUT cmake/GPUNoFastMathKernels.template.h
249-
)
250-
file(GENERATE
251-
OUTPUT include_gpu_onthefly/GPUDefParameters.h
252-
INPUT Definitions/GPUDefParameters.template.h
253-
)
254-
file(GENERATE
255-
OUTPUT include_gpu_onthefly/GPUDefParametersLoad.inc
256-
INPUT Definitions/GPUDefParametersLoad.template.inc
257-
)
242+
foreach(TEMPLATE_FILE ${TEMPLATE_HEADER_LIST})
243+
get_filename_component(OUTPUT_FILE_NAME ${TEMPLATE_FILE} NAME)
244+
string(REPLACE ".template" "" OUTPUT_FILE_NAME ${OUTPUT_FILE_NAME})
245+
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include_gpu_onthefly/${OUTPUT_FILE_NAME} INPUT ${TEMPLATE_FILE})
246+
list(APPEND GENERATED_HEADERS_LIST ${CMAKE_CURRENT_BINARY_DIR}/include_gpu_onthefly/${OUTPUT_FILE_NAME})
247+
endforeach()
258248
file(GENERATE
259249
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/GPUDefParametersLoadPrepareBase
260250
CONTENT "$<JOIN:$<LIST:TRANSFORM,$<TARGET_PROPERTY:O2_GPU_KERNELS,O2_GPU_KERNEL_NAMES>,REPLACE,[^A-Za-z0-9]+,_>,\n>"
@@ -266,6 +256,7 @@ add_custom_command(
266256
VERBATIM
267257
COMMAND_EXPAND_LISTS
268258
)
259+
list(APPEND GENERATED_HEADERS_LIST ${CMAKE_CURRENT_BINARY_DIR}/include_gpu_onthefly/GPUDefParametersLoadPrepare.h)
269260

270261
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)
271262
include(kernels.cmake)
@@ -405,11 +396,11 @@ set_source_files_properties(Base/GPUReconstructionLibrary.cxx
405396
PROPERTIES
406397
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}")
407398

408-
# Make sure header files generated with add_custom_command are built
399+
# Make sure header files generated with add_custom_command are built before being used
409400
target_sources(${targetName}
410401
PRIVATE FILE_SET "generatedHeaders"
411402
TYPE HEADERS
412-
FILES ${CMAKE_CURRENT_BINARY_DIR}/include_gpu_onthefly/GPUDefParametersLoadPrepare.h # TODO: build file list for this
403+
FILES ${GENERATED_HEADERS_LIST}
413404
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
414405

415406
# Add compile definitions and libraries depending on available optional dependencies

0 commit comments

Comments
 (0)