45-opencl.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. SCRIPT_REPO="https://github.com/KhronosGroup/OpenCL-Headers.git"
  3. SCRIPT_COMMIT="4ea6df132107e3b4b9407f903204b5522fdffcd6"
  4. SCRIPT_REPO2="https://github.com/KhronosGroup/OpenCL-ICD-Loader.git"
  5. SCRIPT_COMMIT2="92280246c8e30795f08362425510d6acfc5c3f0d"
  6. ffbuild_enabled() {
  7. return 0
  8. }
  9. ffbuild_dockerdl() {
  10. default_dl headers
  11. echo "git-mini-clone \"$SCRIPT_REPO2\" \"$SCRIPT_COMMIT2\" loader"
  12. }
  13. ffbuild_dockerbuild() {
  14. mkdir -p "$FFBUILD_PREFIX"/include/CL
  15. cp -r headers/CL/* "$FFBUILD_PREFIX"/include/CL/.
  16. cd loader
  17. mkdir build && cd build
  18. cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
  19. -DOPENCL_ICD_LOADER_HEADERS_DIR="$FFBUILD_PREFIX"/include -DOPENCL_ICD_LOADER_BUILD_SHARED_LIBS=OFF \
  20. -DOPENCL_ICD_LOADER_DISABLE_OPENCLON12=ON -DOPENCL_ICD_LOADER_PIC=ON \
  21. -DOPENCL_ICD_LOADER_BUILD_TESTING=OFF -DBUILD_TESTING=OFF ..
  22. make -j$(nproc)
  23. make install
  24. echo "prefix=$FFBUILD_PREFIX" > OpenCL.pc
  25. echo "exec_prefix=\${prefix}" >> OpenCL.pc
  26. echo "libdir=\${exec_prefix}/lib" >> OpenCL.pc
  27. echo "includedir=\${prefix}/include" >> OpenCL.pc
  28. echo >> OpenCL.pc
  29. echo "Name: OpenCL" >> OpenCL.pc
  30. echo "Description: OpenCL ICD Loader" >> OpenCL.pc
  31. echo "Version: 9999" >> OpenCL.pc
  32. echo "Cflags: -I\${includedir}" >> OpenCL.pc
  33. if [[ $TARGET == linux* ]]; then
  34. echo "Libs: -L\${libdir} -lOpenCL" >> OpenCL.pc
  35. echo "Libs.private: -ldl" >> OpenCL.pc
  36. elif [[ $TARGET == win* ]]; then
  37. echo "Libs: -L\${libdir} -l:OpenCL.a" >> OpenCL.pc
  38. echo "Libs.private: -lole32 -lshlwapi -lcfgmgr32" >> OpenCL.pc
  39. fi
  40. mkdir -p "$FFBUILD_PREFIX"/lib/pkgconfig
  41. mv OpenCL.pc "$FFBUILD_PREFIX"/lib/pkgconfig/OpenCL.pc
  42. }
  43. ffbuild_configure() {
  44. echo --enable-opencl
  45. }
  46. ffbuild_unconfigure() {
  47. echo --disable-opencl
  48. }