summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/utils
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-09-17 20:39:13 (GMT)
committerunknown <rmaynard@nvidia.com>2021-10-20 15:18:06 (GMT)
commit61b9764b03517276e99584de02d52ceefa5689ec (patch)
tree663e5dee6f66a2ef958002b209437b659ad02dca /Tests/CudaOnly/utils
parent3b5e1b53eae726bb4105240143354270df4495e3 (diff)
downloadCMake-61b9764b03517276e99584de02d52ceefa5689ec.zip
CMake-61b9764b03517276e99584de02d52ceefa5689ec.tar.gz
CMake-61b9764b03517276e99584de02d52ceefa5689ec.tar.bz2
CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION
The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION` now aren't mutually exclusive and can now be used together on the same target.
Diffstat (limited to 'Tests/CudaOnly/utils')
-rw-r--r--Tests/CudaOnly/utils/bin2c_wrapper.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/CudaOnly/utils/bin2c_wrapper.cmake b/Tests/CudaOnly/utils/bin2c_wrapper.cmake
new file mode 100644
index 0000000..0baf934
--- /dev/null
+++ b/Tests/CudaOnly/utils/bin2c_wrapper.cmake
@@ -0,0 +1,19 @@
+
+set(file_contents)
+foreach(obj ${OBJECTS})
+ get_filename_component(obj_ext ${obj} EXT)
+ get_filename_component(obj_name ${obj} NAME_WE)
+ get_filename_component(obj_dir ${obj} DIRECTORY)
+
+ if(obj_ext MATCHES ".ptx")
+ set(args --name ${obj_name} ${obj})
+ execute_process(COMMAND "${BIN_TO_C_COMMAND}" ${args}
+ WORKING_DIRECTORY ${obj_dir}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE error_var
+ )
+ set(file_contents "${file_contents} \n${output}")
+ endif()
+endforeach()
+file(WRITE "${OUTPUT}" "${file_contents}")