summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake
blob: 0baf93434dfa1630cf40e91fa4c7c9894a664564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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}")