Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-09-10 23:53:35 +0300
committerMark Thompson <sw@jkqxz.net>2017-11-23 02:17:34 +0300
commit59d6529333c4550701401d59d67b60454b164b1f (patch)
tree0f16b916fbee8c86a77fea010711ee724d2a91e7 /tools/cl2c
parent5c21c41b7da2bac069b09d5a30da6a53f72dbe96 (diff)
lavfi: Add infrastructure for building OpenCL source into libavfilter
Diffstat (limited to 'tools/cl2c')
-rwxr-xr-xtools/cl2c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/cl2c b/tools/cl2c
new file mode 100755
index 0000000000..1ead940811
--- /dev/null
+++ b/tools/cl2c
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Convert an OpenCL source file into a C source file containing the
+# OpenCL source as a C string. Also adds a #line directive so that
+# compiler messages are useful.
+
+input="$1"
+output="$2"
+
+name=$(basename "$input" | sed 's/.cl$//')
+
+cat >$output <<EOF
+// Generated from $input
+const char *ff_opencl_source_$name =
+"#line 1 \"$input\"\n"
+EOF
+
+# Convert \ to \\ and " to \", then add " to the start and end of the line.
+cat "$input" | sed 's/\\/\\\\/g;s/\"/\\\"/g;s/^/\"/;s/$/\\n\"/' >>$output
+
+echo ";" >>$output