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"
|
2023-05-29 12:10:36 +00:00
|
|
|
SCRIPT_COMMIT="e049b16b5f157e2f28e7b5c301e71e1ccb3fe288"
|
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"
|
2023-06-21 11:43:28 +00:00
|
|
|
SCRIPT_COMMIT2="229410f86a8c8c9e0f86f195409e5481a2bae067"
|
2020-10-11 14:40:40 +00:00
|
|
|
|
|
|
|
ffbuild_enabled() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2023-06-18 14:44:57 +00:00
|
|
|
ffbuild_dockerdl() {
|
2023-06-18 19:25:50 +00:00
|
|
|
default_dl opencl/headers
|
|
|
|
to_df "RUN git-mini-clone \"$SCRIPT_REPO2\" \"$SCRIPT_COMMIT2\" opencl/loader"
|
2023-06-18 14:44:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_dockerbuild() {
|
|
|
|
cd "$FFBUILD_DLDIR"/opencl
|
|
|
|
|
2020-10-11 14:40:40 +00:00
|
|
|
mkdir -p "$FFBUILD_PREFIX"/include/CL
|
|
|
|
cp -r headers/CL/* "$FFBUILD_PREFIX"/include/CL/.
|
|
|
|
|
|
|
|
cd loader
|
|
|
|
mkdir build && cd build
|
|
|
|
|
2022-12-03 00:14:46 +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 "Cflags: -I\${includedir}" >> OpenCL.pc
|
|
|
|
|
2021-05-14 02:52:29 +00:00
|
|
|
if [[ $TARGET == linux* ]]; then
|
2022-12-03 00:14:46 +00:00
|
|
|
echo "Libs: -L\${libdir} -lOpenCL" >> OpenCL.pc
|
2021-05-14 02:52:29 +00:00
|
|
|
echo "Libs.private: -ldl" >> OpenCL.pc
|
|
|
|
elif [[ $TARGET == win* ]]; then
|
2022-12-03 00:14:46 +00:00
|
|
|
echo "Libs: -L\${libdir} -l:OpenCL.a" >> OpenCL.pc
|
2021-05-14 02:52:29 +00:00
|
|
|
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
|
|
|
|
}
|