Merge branch 'master' into Mario/vaporizer_damage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / test / compilationunit.sh
1 #!/bin/bash
2 set -eu
3 cd "$(dirname "$0")"
4 cd ..
5
6 declare -a NOWARN=(
7   '-Wno-field-redeclared'
8   '-Wno-unused-variable'
9   '-Wno-implicit-function-pointer'
10 )
11 declare -a FEATURES=(
12   '-DVEHICLES_ENABLED=1'
13   '-DVEHICLES_USE_ODE=0'
14 )
15 declare QCC=../../../gmqcc/gmqcc
16
17 function check() {
18   declare -l base="$1"
19   declare -la predefs=("${!2}")
20   find "$base" -type f -name '*.qc' -print0 | sort -z | while IFS= read -r -d '' file; do
21     echo "$file"
22     ${QCC} -std=gmqcc -fftepp -fftepp-predefs -Werror -Wall "${NOWARN[@]}" "${FEATURES[@]}" -futf8 -O3 "${predefs[@]}" "$file" >/dev/null
23   done
24 }
25
26 clientdefs=("-DCSQC" "common/util-pre.qh" "dpdefs/csprogsdefs.qh")
27 check "client" clientdefs[@]
28
29 serverdefs=("-DSVQC" "common/util-pre.qh" "server/sys-pre.qh" "dpdefs/progsdefs.qh" "dpdefs/dpextensions.qh" "server/sys-post.qh" "server/defs.qh" "server/autocvars.qh")
30 check "server" serverdefs[@]
31
32 menudefs=("-DMENUQC" "common/util-pre.qh" "dpdefs/menudefs.qh")
33 check "menu" menudefs[@]