Skip to content

Commit 9babfd4

Browse files
committed
GPU CMake: Switch from IMPLICIT_DEPENDS to DEPFILE and -MT -MD -MF, as ninja does not support IMPLICIT_DEPENDS
1 parent e382946 commit 9babfd4

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

GPU/GPUTracking/Base/cuda/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ add_custom_command(
7070
COMMAND cp ${GPUDIR}/Base/GPUStdSystemHeaders.h ${GPU_RTC_BIN}.src
7171
COMMAND cat ${GPUDIR}/Base/cuda/GPUReconstructionCUDAIncludesSystem.h | grep -v GPUStdSystemHeaders.h >> ${GPU_RTC_BIN}.src
7272
COMMAND cat ${GPUDIR}/Base/GPUStdSystemHeaders.h >> ${GPU_RTC_BIN}.src
73+
COMMAND ${CMAKE_CUDA_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_CUDA_STANDARD} -D__CUDA_ARCH__=${RTC_CUDA_ARCH} -D__CUDACC__ -x c++ -M -MD -MT ${GPU_RTC_BIN}.src -MF ${GPU_RTC_BIN}.src.d ${GPU_RTC_SRC}
7374
COMMAND ${CMAKE_CUDA_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_CUDA_STANDARD} -D__CUDA_ARCH__=${RTC_CUDA_ARCH} -D__CUDACC__ -x c++ -E -Xcompiler "-nostdinc -P" ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src
74-
MAIN_DEPENDENCY ${GPU_RTC_SRC}
75-
IMPLICIT_DEPENDS CXX ${GPU_RTC_SRC}
75+
DEPENDS ${GPU_RTC_SRC} ${GPUDIR}/Base/GPUStdSystemHeaders.h ${GPUDIR}/Base/cuda/GPUReconstructionCUDAIncludesSystem.h ${GPUDIR}/Base/GPUStdSystemHeaders.h
76+
DEPFILE ${GPU_RTC_BIN}.src.d
7677
COMMAND_EXPAND_LISTS
7778
COMMENT "Preparing CUDA RTC source file ${GPU_RTC_BIN}.src"
7879
)

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAGenRTC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int32_t GPUReconstructionCUDA::genRTC(std::string& filename, uint32_t& nCompile)
131131
}
132132
return 0;
133133
};
134-
if (checkSHA(shasource, "source") ||
134+
if (checkSHA(shasource, "source") || // TODO: CHECK VERSION!
135135
checkSHA(shaparam, "param") ||
136136
checkSHA(shacmd, "command line") ||
137137
checkSHA(shakernels, "kernel definitions") ||

GPU/GPUTracking/Base/hip/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ add_custom_command(
116116
OUTPUT ${GPU_RTC_BIN}.src
117117
COMMAND cp ${GPUDIR}/Base/GPUStdSystemHeaders.h ${GPU_RTC_BIN}.src
118118
COMMAND cat ${GPUDIR}/Base/hip/GPUReconstructionHIPIncludesSystem.h | grep -v GPUStdSystemHeaders.h >> ${GPU_RTC_BIN}.src
119-
COMMAND ${CMAKE_HIP_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_HIP_STANDARD} -D__HIPCC__ -D__HIP_DEVICE_COMPILE__ -x c++ -nostdinc -E -P ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src
120-
MAIN_DEPENDENCY ${GPU_RTC_SRC}
121-
IMPLICIT_DEPENDS CXX ${GPU_RTC_SRC}
122-
DEPENDS ${MODULE}_HIPIFIED
119+
COMMAND cat ${GPUDIR}/Base/GPUStdSystemHeaders.h >> ${GPU_RTC_BIN}.src
120+
COMMAND ${CMAKE_HIP_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_HIP_STANDARD} -D__HIPCC__ -D__HIP_DEVICE_COMPILE__ -x c++ -nostdinc -E -P ${GPU_RTC_SRC} -MD -MT ${GPU_RTC_BIN}.src -MF ${GPU_RTC_BIN}.src.d >> ${GPU_RTC_BIN}.src
121+
DEPENDS ${GPU_RTC_SRC} ${GPUDIR}/Base/GPUStdSystemHeaders.h ${GPUDIR}/Base/hip/GPUReconstructionHIPIncludesSystem.h ${GPUDIR}/Base/GPUStdSystemHeaders.h ${MODULE}_HIPIFIED
122+
DEPFILE ${GPU_RTC_BIN}.src.d
123123
COMMAND_EXPAND_LISTS
124124
COMMENT "Preparing HIP RTC source file ${GPU_RTC_BIN}.src"
125125
)

GPU/GPUTracking/Base/opencl/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ if(OPENCL_ENABLED_SPIRV) # BUILD OpenCL intermediate code for SPIR-V target
6161
-ferror-limit=1000 -Wno-invalid-constexpr -Wno-unused-command-line-argument
6262
${OCL_FLAGS}
6363
${OCL_DEFINECL}
64+
-MD -MT ${CL_BIN}.spirv -MF ${CL_BIN}.spirv.d
6465
-o ${CL_BIN}.spirv -c ${CL_SRC}
65-
MAIN_DEPENDENCY ${CL_SRC}
66-
IMPLICIT_DEPENDS CXX ${CL_SRC}
66+
DEPENDS ${CL_SRC}
67+
DEPFILE ${CL_BIN}.spirv.d
6768
COMMAND_EXPAND_LISTS
6869
COMMENT "Compiling OpenCL CL source file ${CL_SRC} to SPIRV ${CL_BIN}.spirv")
6970

@@ -82,9 +83,10 @@ if(OPENCL_ENABLED) # BUILD OpenCL source code for runtime compilation target
8283
${OCL_DEFINECL}
8384
-cl-no-stdinc
8485
-nostdinc
86+
-MD -MT ${CL_BIN}.src -MF ${CL_BIN}.src.d
8587
-E -P ${CL_SRC} > ${CL_BIN}.src
86-
MAIN_DEPENDENCY ${CL_SRC}
87-
IMPLICIT_DEPENDS CXX ${CL_SRC}
88+
DEPENDS ${CL_SRC}
89+
DEPFILE ${CL_BIN}.src.d
8890
COMMAND_EXPAND_LISTS
8991
COMMENT "Preparing OpenCL CL source file for run time compilation ${CL_BIN}.src")
9092

GPU/GPUTracking/cmake/vulkan_display.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ function(add_glslc_shader TARGET SHADER)
2525

2626
add_custom_command(
2727
OUTPUT ${spirv-file}
28-
COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o ${spirv-file} ${input-file-abs}
28+
COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o ${spirv-file} ${input-file-abs} -MD -MT ${spirv-file} -MF ${spirv-file}.d
2929
DEPENDS ${input-file-abs}
30-
IMPLICIT_DEPENDS CXX ${input-file-abs}
30+
DEPFILE ${input-file-abs}.d
3131
COMMENT "Compiling GLSL to SPIRV: ${SHADER}"
3232
VERBATIM
3333
)

0 commit comments

Comments
 (0)