build_wasm.sh 816 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. #!/bin/bash
  4. export CC=/opt/wasi-sdk/bin/clang
  5. export CXX=/opt/wasi-sdk/bin/clang++
  6. cd /mnt
  7. if [ -d build ];then
  8. rm -fr build
  9. fi
  10. mkdir -p build && cd build
  11. echo "========> compile wasm with wasi-sdk"
  12. cmake -DWASI_SDK_DIR=/opt/wasi-sdk -DCMAKE_TOOLCHAIN_FILE=/opt/wamr-sdk/app/wamr_toolchain.cmake ../.wamr && make
  13. if [ $? -eq 0 ]; then
  14. echo "========> compile wasm to AoT with wamrc"
  15. # target name will be provided:
  16. # - user input the target name in IDE
  17. # - generated wasm binary name will be set as user's input target name
  18. # - aot binary name should be the same as wasm binary name
  19. # - target name will be provided through 1st parameter
  20. wamrc -o $1.aot $1.wasm
  21. fi