|
@@ -4083,13 +4083,25 @@ macro CUDA_NVCC_FLAGS(Flags...) {
|
|
|
SET_APPEND(CUDA_NVCC_FLAGS $Flags)
|
|
|
}
|
|
|
|
|
|
+CUDA_DEVICE_LINK_LIBRARY_CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input:_NVCC_DEVICE_SRCS} -I$CUDA_TARGET_ROOT/include --compiler-options ${join= :C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"} && $LINK_LIB
|
|
|
+
|
|
|
+### @usage: CUDA_DEVICE_LINK_LIBRARY()
|
|
|
+###
|
|
|
+### The LIBRARY() module with an additional step with CUDA device linking.
|
|
|
+### Use [NVCC_DEVICE_LINK](#macro_NVCC_DEVICE_LINK) macro to specify sources for device link.
|
|
|
+module CUDA_DEVICE_LINK_LIBRARY: LIBRARY {
|
|
|
+ SET(_LD_LINK_LIB_EXTRA_INPUT ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"})
|
|
|
+ .CMD=$CUDA_DEVICE_LINK_LIBRARY_CMD
|
|
|
+}
|
|
|
+
|
|
|
# tag:flags
|
|
|
### @usage: NVCC_DEVICE_LINK(file.cu...)
|
|
|
### Run nvcc --device-link on objects compiled from srcs with --device-c.
|
|
|
### This generates a stub object devlink.o that supplies missing pieces for the
|
|
|
### host linker to link relocatable device objects into the final executable.
|
|
|
+### This macro can be used only with [CUDA_DEVICE_LINK_LIBRARY](#module_CUDA_DEVICE_LINK_LIBRARY) module.
|
|
|
macro NVCC_DEVICE_LINK(Srcs...) {
|
|
|
- .CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} -I$CUDA_TARGET_ROOT/include --compiler-options ${quo:C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"}
|
|
|
+ SET_APPEND(_NVCC_DEVICE_SRCS ${suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs})
|
|
|
.PEERDIR=build/platform/cuda
|
|
|
}
|
|
|
|