build.sh 1.3 KB

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