build.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. readonly CURR_DIR=$PWD
  4. readonly BINARYDUMP_DIR=$PWD/../../../../test-tools/binarydump-tool
  5. # build binarydump
  6. cd $BINARYDUMP_DIR
  7. mkdir -p build && cd build
  8. cmake .. && make -j
  9. cp -a binarydump $CURR_DIR
  10. cd $CURR_DIR
  11. ## build app1
  12. /opt/wasi-sdk/bin/clang -O3 \
  13. -z stack-size=4096 -Wl,--initial-memory=65536 \
  14. -o app1/app1.wasm app1/main.c -Wl,--export-all \
  15. -Wl,--export=__heap_base,--export=__data_end \
  16. -Wl,--no-entry -nostdlib -Wl,--allow-undefined
  17. ./binarydump -o app1_wasm.h -n app1_wasm app1/app1.wasm
  18. wavm disassemble app1/app1.wasm app1.wast
  19. rm -f app1/app1.wasm
  20. ## build app2
  21. /opt/wasi-sdk/bin/clang -O3 \
  22. -z stack-size=4096 -Wl,--initial-memory=65536 \
  23. -o app2/app2.wasm app2/main.c -Wl,--export-all \
  24. -Wl,--export=__heap_base,--export=__data_end \
  25. -Wl,--no-entry -nostdlib -Wl,--allow-undefined
  26. ./binarydump -o app2_wasm.h -n app2_wasm app2/app2.wasm
  27. wavm disassemble app2/app2.wasm app2.wast
  28. rm -f app2/app2.wasm
  29. ## build app3
  30. /opt/wasi-sdk/bin/clang -O3 \
  31. -z stack-size=4096 -Wl,--initial-memory=65536 \
  32. -o app3/app3.wasm app3/main.c -Wl,--export-all \
  33. -Wl,--export=__heap_base,--export=__data_end \
  34. -Wl,--no-entry -nostdlib -Wl,--allow-undefined
  35. ./binarydump -o app3_wasm.h -n app3_wasm app3/app3.wasm
  36. wavm disassemble app3/app3.wasm app3.wast
  37. rm -f app3/app3.wasm