docker_build_assimp_linux.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #
  9. cd /data/workspace/src
  10. CPU_ARCH=$(uname -m)
  11. echo "Detected architecture ${CPU_ARCH}"
  12. if [ "${CPU_ARCH}" = "aarch64" ]
  13. then
  14. AARCH64_FLAGS="-DCMAKE_CXX_FLAGS_INIT=\"-ffp-contract=off\""
  15. fi
  16. # Since we are mapping in a git repo from outside of the docker, git will report that the folder has a 'dubious' owner
  17. # which will cause code in the CMakeLists.txt that extracts the commit hash to fail, and thus fail the revision
  18. # unit test. To prevent this, mark the forlder 'src' as a safe directory for git
  19. git config --global --add safe.directory /data/workspace/src
  20. GIT_HASH=$(git rev-parse --short=8 HEAD)
  21. echo "Working with Assimp commit hash ${GIT_HASH}"
  22. echo "Using custom zlib (shared) library at /data/workspace/${ZLIB_LIB_PATH}"
  23. cmake -S . -B /data/workspace/build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MODULE_PATH="/data/workspace/${ZLIB_LIB_PATH}" -DASSIMP_BUILD_ZLIB=ON -DBUILD_SHARED_LIBS=ON -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DASSIMP_BUILD_USD_IMPORTER=ON -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_CXX_FLAGS="-Wno-sign-compare -Wno-maybe-uninitialized" ${AARCH64_FLAGS}
  24. if [ $? -ne 0 ]
  25. then
  26. echo "Failed generating cmake project for assimp/shared."
  27. exit 1
  28. fi
  29. cmake --build /data/workspace/build
  30. if [ $? -ne 0 ]
  31. then
  32. echo "Failed building cmake project for assimp/shared."
  33. exit 1
  34. fi
  35. echo "Using custom zlib (static) library at /data/workspace/${ZLIB_LIB_PATH}"
  36. cmake -S . -B /data/workspace/build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MODULE_PATH="/data/workspace/${ZLIB_LIB_PATH}" -DASSIMP_BUILD_ZLIB=ON -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DASSIMP_BUILD_USD_IMPORTER=ON -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_CXX_FLAGS="-Wno-sign-compare -Wno-maybe-uninitialized" ${AARCH64_FLAGS}
  37. if [ $? -ne 0 ]
  38. then
  39. echo "Failed generating cmake project for assimp/static."
  40. exit 1
  41. fi
  42. cmake --build /data/workspace/build
  43. if [ $? -ne 0 ]
  44. then
  45. echo "Failed building cmake project for assimp/shared."
  46. exit 1
  47. fi
  48. mkdir -p /data/workspace/build/port/
  49. cp -R /data/workspace/src/port/PyAssimp /data/workspace/build/port/
  50. mkdir -p /data/workspace/build/include/assimp/
  51. cp -v -r /data/workspace/src/include/assimp/* /data/workspace/build/include/assimp/
  52. rm /data/workspace/build/include/assimp/config.h.in
  53. echo "Running unit test"
  54. cd ..
  55. mkdir -p test_out
  56. cd test_out
  57. ../build/bin/unit
  58. if [ $? -eq 0 ]; then
  59. echo "Unit Tests Passed"
  60. exit 0
  61. else
  62. echo "Unit Tests Failed"
  63. exit 1
  64. fi
  65. exit 0