aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 3f18c955fc81a97286c6bd10763dd2743defde9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

release_mode=$1

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"
libraries="-pthread -ldl -lm -lstdc++"
other_args=""
compiler="clang"

if [ -z "$release_mode" ]; then release_mode="0"; fi

if [ "$release_mode" -eq "0" ]; then
	other_args="${other_args} -g"
fi
if [ "$release_mode" -eq "1" ]; then
	other_args="${other_args} -O3 -march=native"
fi

if [[ "$(uname)" == "Darwin" ]]; then

	# Set compiler to clang on MacOS
	# MacOS provides a symlink to clang called gcc, but it's nice to be explicit here.
	compiler="clang"

	other_args="${other_args} -liconv"
fi

${compiler} src/main.cpp ${warnings_to_disable} ${libraries} ${other_args} -o odin && ./odin run examples/demo.odin