build_wamr.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. #
  6. PLATFORM=$(uname -s | tr A-Z a-z)
  7. readonly WORK_DIR=$PWD
  8. readonly WAMR_DIR=${WORK_DIR}/../../..
  9. function build_wamrc() {
  10. echo "Build wamrc for spec test under aot compile type"
  11. cd ${WAMR_DIR}/wamr-compiler &&
  12. ./build_llvm.sh &&
  13. cd ${WORK_DIR}/build &&
  14. if [ -d build-wamrc ]; then rm -rf build-wamrc; else mkdir build-wamrc; fi &&
  15. cd build-wamrc && cmake ${WAMR_DIR}/wamr-compiler && make -j 4
  16. }
  17. function build_iwasm() {
  18. echo "Build iwasm with compile flags " $1 " "
  19. cd ${WAMR_DIR}/product-mini/platforms/${PLATFORM} &&
  20. cd ${WORK_DIR}/build &&
  21. if [ -d build-iwasm-$2 ]; then rm -rf build-iwasm-$2; else mkdir build-iwasm-$2; fi &&
  22. cd build-iwasm-$2 &&
  23. cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} $1 \
  24. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_SANITIZER=asan &&
  25. make -j 4
  26. if [ "$?" != 0 ]; then
  27. echo -e "build iwasm failed"
  28. exit 1
  29. fi
  30. }
  31. rm -fr build && mkdir build
  32. # build wamrc
  33. build_wamrc
  34. # build default iwasm for testing fast-interp and AOT
  35. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1" "default"
  36. # build default iwasm for testing fast-interp and AOT with GC enabled
  37. build_iwasm "-DWAMR_BUILD_GC=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_SPEC_TEST=1" "default-gc-enabled"
  38. # build llvm-jit iwasm for testing llvm-jit
  39. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1" "llvm-jit"
  40. # build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit
  41. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1" "multi-tier-jit"
  42. # build default iwasm for testing fast-interp and AOT with libc-wasi disabled
  43. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_LIBC_WASI=0" "default-wasi-disabled"
  44. # build llvm-jit iwasm for testing llvm-jit with libc-wasi disabled
  45. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "llvm-jit-wasi-disabled"
  46. # build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit with libc-wasi disabled
  47. build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "multi-tier-jit-wasi-disabled"
  48. # TODO: add more version of iwasm, for example, sgx version