compat/cuda/ptx2c: strip CR from each line
authorRicardo Constantino <wiiaboo@gmail.com>
Tue, 29 Aug 2017 00:46:13 +0000 (01:46 +0100)
committerTimo Rothenpieler <timo@rothenpieler.org>
Wed, 30 Aug 2017 09:20:34 +0000 (11:20 +0200)
Windows nvcc + cl.exe produce a .ctx file with CR+LF newlines which
need to be stripped to work with gcc.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
compat/cuda/ptx2c.sh

index 1f37023..5ccabbf 100755 (executable)
@@ -29,7 +29,7 @@ NAME="$(basename "$IN" | sed 's/\..*//')"
 printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
 while read LINE
 do
-    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed 's/["\\]/\\&/g')" >> "$OUT"
+    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT"
 done < "$IN"
 printf ";\n" >> "$OUT"