build.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. WAMRC="../../../wamr-compiler/build/wamrc"
  5. if [ ! -d coremark ]; then
  6. git clone https://github.com/eembc/coremark.git
  7. fi
  8. cd coremark
  9. echo "Build coremark with gcc .."
  10. gcc -O3 -Iposix -I. -DFLAGS_STR=\""-O3 -DPERFORMANCE_RUN=1 -lrt"\" \
  11. -DITERATIONS=0 -DPERFORMANCE_RUN=1 \
  12. core_list_join.c core_main.c core_matrix.c core_state.c \
  13. core_util.c posix/core_portme.c \
  14. -o ../coremark.exe -lrt
  15. echo "Build coremark with wasi-sdk .."
  16. /opt/wasi-sdk/bin/clang -O3 -Iposix -I. -DFLAGS_STR=\""-O3 -DPERFORMANCE_RUN=1"\" \
  17. -Wl,--export=main \
  18. -DITERATIONS=0 -DPERFORMANCE_RUN=1 \
  19. -Wl,--allow-undefined \
  20. core_list_join.c core_main.c core_matrix.c core_state.c \
  21. core_util.c posix/core_portme.c \
  22. -o ../coremark.wasm
  23. cd ..
  24. echo "Compile coremark.wasm to coremark.aot .."
  25. ${WAMRC} -o coremark.aot coremark.wasm
  26. echo "Done"