docker_build_spirvcross.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. # Validate the bld path input
  9. BUILD_FOLDER=${DOCKER_BUILD_PATH}
  10. if [ "${BUILD_FOLDER}" == "" ]
  11. then
  12. echo "Missing required build target folder environment"
  13. exit 1
  14. elif [ "${BUILD_FOLDER}" == "temp" ]
  15. then
  16. echo "Build target folder environment cannot be 'temp'"
  17. exit 1
  18. fi
  19. # Copy the source folder from the read-only $WORKSPACE/temp/src to $WORKSPACE/src
  20. # since the build process will write/modify the source path
  21. echo "Preparing source folder '$WORKSPACE/src'"
  22. cp -r $WORKSPACE/temp/src $WORKSPACE/ || (echo "Error copying src from $WORKSPACE/temp" && exit 1)
  23. SRC_PATH=$WORKSPACE/src
  24. if [ ! -d ${SRC_PATH} ]
  25. then
  26. echo "Missing expected source path at ${SRC_PATH}"
  27. exit 1
  28. fi
  29. CMAKE_BUILD_PATH=$WORKSPACE/gen
  30. BUILD_PATH=$WORKSPACE/build
  31. if [ -d ${BUILD_PATH} ]
  32. then
  33. rm -rf ${BUILD_PATH}
  34. fi
  35. # Run configure
  36. cmake -S $SRC_PATH -B ${CMAKE_BUILD_PATH}/Debug -G Ninja -DSPIRV_CROSS_CLI=ON \
  37. -DSPIRV_CROSS_SHARED=OFF \
  38. -DCMAKE_INSTALL_LIBDIR=${BUILD_FOLDER}/lib/Debug \
  39. -DCMAKE_INSTALL_BINDIR=${BUILD_FOLDER}/bin/Debug \
  40. -DCMAKE_BUILD_TYPE=Debug
  41. if [ $? -ne 0 ]
  42. then
  43. echo "Unable to generate SPIRVCROSS for debug"
  44. exit 1
  45. fi
  46. cmake --build ${CMAKE_BUILD_PATH}/Debug --target install
  47. if [ $? -ne 0 ]
  48. then
  49. echo "Failed to build SPIRVCROSS for debug"
  50. exit 1
  51. fi
  52. cmake -S $SRC_PATH -B ${CMAKE_BUILD_PATH} -G Ninja -DSPIRV_CROSS_CLI=ON \
  53. -DSPIRV_CROSS_SHARED=OFF \
  54. -DCMAKE_INSTALL_LIBDIR=${BUILD_FOLDER}/lib/Release \
  55. -DCMAKE_INSTALL_BINDIR=${BUILD_FOLDER}/bin/Release \
  56. -DCMAKE_BUILD_TYPE=Release
  57. if [ $? -ne 0 ]
  58. then
  59. echo "Unable to generate SPIRVCROSS for release"
  60. exit 1
  61. fi
  62. cmake --build ${CMAKE_BUILD_PATH}/Release --target install
  63. if [ $? -ne 0 ]
  64. then
  65. echo "Failed to build SPIRVCROSS for release"
  66. exit 1
  67. fi
  68. exit 1