meson: Detect CL version

Different DDK might have different CL versions.

Change-Id: I7384a0f653e3e774cc46a4c545a5697986a31e27
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
Jeffy Chen
2023-07-24 16:31:55 +08:00
parent 205c5261a1
commit 089692e6f9
2 changed files with 46 additions and 1 deletions

19
scripts/fixup_cl.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh -e
[ $# -lt 2 ] && {
echo "usage: $0 <path of include> <cl version>"
exit 1
}
HEADER="${MESON_INSTALL_DESTDIR_PREFIX:-/usr}/$1/CL/cl_version.h"
if [ -f "$HEADER" ]; then
VER="$2"
TARGET_VER=$(echo "$VER * 100" | bc | sed "s/\.0$//")
sed -i -e "s/\(Defaulting to \).* ([^)]*/\1$TARGET_VER (OpenCL $VER/" \
-e "s/\(^#define CL_TARGET_OPENCL_VERSION \).*/\1$TARGET_VER/" \
"$HEADER"
fi
exit 0