You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
526B

  1. #!/bin/sh
  2. # Convert an OpenCL source file into a C source file containing the
  3. # OpenCL source as a C string. Also adds a #line directive so that
  4. # compiler messages are useful.
  5. input="$1"
  6. output="$2"
  7. name=$(basename "$input" | sed 's/.cl$//')
  8. cat >$output <<EOF
  9. // Generated from $input
  10. const char *ff_opencl_source_$name =
  11. "#line 1 \"$input\"\n"
  12. EOF
  13. # Convert \ to \\ and " to \", then add " to the start and end of the line.
  14. cat "$input" | sed 's/\\/\\\\/g;s/\"/\\\"/g;s/^/\"/;s/$/\\n\"/' >>$output
  15. echo ";" >>$output