build.sh 830 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. release_mode=$1
  3. warnings_to_disable="-std=c++11 -Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined -Wno-writable-strings"
  4. libraries="-pthread -ldl -lm -lstdc++"
  5. other_args=""
  6. compiler="clang"
  7. if [ -z "$release_mode" ]; then release_mode="0"; fi
  8. if [ "$release_mode" -eq "0" ]; then
  9. other_args="${other_args} -g"
  10. fi
  11. if [ "$release_mode" -eq "1" ]; then
  12. other_args="${other_args} -O3 -march=native"
  13. fi
  14. if [[ "$(uname)" == "Darwin" ]]; then
  15. # Set compiler to clang on MacOS
  16. # MacOS provides a symlink to clang called gcc, but it's nice to be explicit here.
  17. compiler="clang"
  18. other_args="${other_args} -liconv"
  19. fi
  20. ${compiler} src/main.cpp ${warnings_to_disable} ${libraries} ${other_args} -o odin && ./odin run examples/demo/demo.odin