55-spirv-cross.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. SCRIPT_REPO="https://github.com/KhronosGroup/SPIRV-Cross.git"
  3. SCRIPT_COMMIT="9040e0d25dc545a6d725276bdbd0362791c81f14"
  4. ffbuild_enabled() {
  5. [[ $ADDINS_STR == *4.4* ]] && return -1
  6. return 0
  7. }
  8. ffbuild_dockerbuild() {
  9. VER_MAJ="$(grep 'set(spirv-cross-abi-major' CMakeLists.txt | sed -re 's/.* ([0-9]+)\)/\1/')"
  10. VER_MIN="$(grep 'set(spirv-cross-abi-minor' CMakeLists.txt | sed -re 's/.* ([0-9]+)\)/\1/')"
  11. VER_PCH="$(grep 'set(spirv-cross-abi-patch' CMakeLists.txt | sed -re 's/.* ([0-9]+)\)/\1/')"
  12. VER_FULL="$VER_MAJ.$VER_MIN.$VER_PCH"
  13. mkdir build && cd build
  14. cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
  15. -DSPIRV_CROSS_SHARED=OFF -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_CLI=OFF -DSPIRV_CROSS_ENABLE_TESTS=OFF -DSPIRV_CROSS_FORCE_PIC=ON -DSPIRV_CROSS_ENABLE_CPP=OFF ..
  16. make -j$(nproc)
  17. make install
  18. cat >"$FFBUILD_PREFIX"/lib/pkgconfig/spirv-cross-c-shared.pc <<EOF
  19. prefix=$FFBUILD_PREFIX
  20. exec_prefix=\${prefix}
  21. libdir=\${prefix}/lib
  22. sharedlibdir=\${prefix}/lib
  23. includedir=\${prefix}/include/spirv_cross
  24. Name: spirv-cross-c-shared
  25. Description: C API for SPIRV-Cross
  26. Version: $VER_FULL
  27. Requires:
  28. Libs: -L\${libdir} -L\${sharedlibdir} -lspirv-cross-c -lspirv-cross-glsl -lspirv-cross-hlsl -lspirv-cross-reflect -lspirv-cross-msl -lspirv-cross-util -lspirv-cross-core -lstdc++
  29. Cflags: -I\${includedir}
  30. EOF
  31. }