FFmpeg-Builds/scripts.d/45-opencl.sh

57 lines
1.8 KiB
Bash
Raw Normal View History

2020-10-11 14:40:40 +00:00
#!/bin/bash
2022-07-12 15:54:12 +00:00
SCRIPT_REPO="https://github.com/KhronosGroup/OpenCL-Headers.git"
SCRIPT_COMMIT="def8be9d35fda35492b72f54a94515f7df8d1e9f"
2020-10-11 14:40:40 +00:00
2022-07-12 15:54:12 +00:00
SCRIPT_REPO2="https://github.com/KhronosGroup/OpenCL-ICD-Loader.git"
SCRIPT_COMMIT2="5b280f69e8312c41310a72c28c66cf24830ee85a"
2020-10-11 14:40:40 +00:00
ffbuild_enabled() {
return 0
}
ffbuild_dockerbuild() {
mkdir opencl && cd opencl
2022-07-12 15:54:12 +00:00
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" headers
2020-10-11 14:40:40 +00:00
mkdir -p "$FFBUILD_PREFIX"/include/CL
cp -r headers/CL/* "$FFBUILD_PREFIX"/include/CL/.
2022-07-12 15:54:12 +00:00
git-mini-clone "$SCRIPT_REPO2" "$SCRIPT_COMMIT2" loader
2020-10-11 14:40:40 +00:00
cd loader
mkdir build && cd build
2022-02-27 00:26:55 +00:00
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DOPENCL_ICD_LOADER_HEADERS_DIR="$FFBUILD_PREFIX"/include -DOPENCL_ICD_LOADER_BUILD_SHARED_LIBS=OFF -DOPENCL_ICD_LOADER_DISABLE_OPENCLON12=ON -DOPENCL_ICD_LOADER_PIC=ON -DOPENCL_ICD_LOADER_BUILD_TESTING=OFF -DBUILD_TESTING=OFF ..
2020-10-11 14:40:40 +00:00
make -j$(nproc)
make install
echo "prefix=$FFBUILD_PREFIX" > OpenCL.pc
echo "exec_prefix=\${prefix}" >> OpenCL.pc
echo "libdir=\${exec_prefix}/lib" >> OpenCL.pc
echo "includedir=\${prefix}/include" >> OpenCL.pc
echo >> OpenCL.pc
echo "Name: OpenCL" >> OpenCL.pc
echo "Description: OpenCL ICD Loader" >> OpenCL.pc
echo "Version: 9999" >> OpenCL.pc
echo "Libs: -L\${libdir} -lOpenCL" >> OpenCL.pc
echo "Cflags: -I\${includedir}" >> OpenCL.pc
if [[ $TARGET == linux* ]]; then
echo "Libs.private: -ldl" >> OpenCL.pc
elif [[ $TARGET == win* ]]; then
echo "Libs.private: -lole32 -lshlwapi -lcfgmgr32" >> OpenCL.pc
fi
2020-10-11 14:40:40 +00:00
mkdir -p "$FFBUILD_PREFIX"/lib/pkgconfig
mv OpenCL.pc "$FFBUILD_PREFIX"/lib/pkgconfig/OpenCL.pc
}
ffbuild_configure() {
echo --enable-opencl
}
ffbuild_unconfigure() {
echo --disable-opencl
}