2020-10-11 14:40:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
HEADERS_REPO="https://github.com/KhronosGroup/OpenCL-Headers.git"
|
2022-02-26 23:37:15 +00:00
|
|
|
HEADERS_COMMIT="dcd5bede6859d26833cd85f0d6bbcee7382dc9b3"
|
2020-10-11 14:40:40 +00:00
|
|
|
|
|
|
|
LOADER_REPO="https://github.com/KhronosGroup/OpenCL-ICD-Loader.git"
|
2022-02-26 23:37:15 +00:00
|
|
|
LOADER_COMMIT="cd7d07cfa667d8d959b4272be45cf217a65c2948"
|
2020-10-11 14:40:40 +00:00
|
|
|
|
|
|
|
ffbuild_enabled() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_dockerbuild() {
|
|
|
|
mkdir opencl && cd opencl
|
|
|
|
|
|
|
|
git-mini-clone "$HEADERS_REPO" "$HEADERS_COMMIT" headers
|
|
|
|
mkdir -p "$FFBUILD_PREFIX"/include/CL
|
|
|
|
cp -r headers/CL/* "$FFBUILD_PREFIX"/include/CL/.
|
|
|
|
|
|
|
|
git-mini-clone "$LOADER_REPO" "$LOADER_COMMIT" loader
|
|
|
|
cd loader
|
|
|
|
|
|
|
|
mkdir build && cd build
|
|
|
|
|
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DOPENCL_ICD_LOADER_HEADERS_DIR="$FFBUILD_PREFIX"/include -DBUILD_SHARED_LIBS=OFF -DOPENCL_ICD_LOADER_DISABLE_OPENCLON12=ON -DOPENCL_ICD_LOADER_PIC=ON -DOPENCL_ICD_LOADER_BUILD_TESTING=OFF ..
|
|
|
|
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
|
|
|
|
|
2021-05-14 02:52:29 +00:00
|
|
|
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
|
|
|
|
}
|