diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-12-02 11:29:36 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-12-07 17:53:38 -0800 |
commit | 8bfc5de1dc969559e031de6650d234e086cb4fb2 (patch) | |
tree | 38de57465dec4437321484f10cd78e046bf8b7a1 /scripts | |
parent | e1390f4f6fc1affcd93e704ff24d900dbeb936ff (diff) | |
download | qtlocation-mapboxgl-8bfc5de1dc969559e031de6650d234e086cb4fb2.tar.gz |
[build] use ccache
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/set_compiler.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/set_compiler.sh b/scripts/set_compiler.sh new file mode 100755 index 0000000000..161126f044 --- /dev/null +++ b/scripts/set_compiler.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +if [ ! -z "${_CXX}" ]; then export CXX="${_CXX}" ; fi +if [ ! -z "${_CC}" ]; then export CC="${_CC}" ; fi + +if [ "${CCACHE:-0}" -ge 1 ]; then + export CXX="ccache ${CXX}" + export CC="ccache ${CC}" + + # ccache splits up the compile steps, so we end up with unused arguments in some steps. + # Clang also thinks that ccache isn't interactive, so we explicitly need to enable color. + if [ $(echo | ${CXX} -dM -E - | grep -c "#define __clang__ 1") -ge 1 ]; then + export CXX="${CXX} -Qunused-arguments -fcolor-diagnostics" + export CC="${CC} -Qunused-arguments -fcolor-diagnostics" + else + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60304 + # GCC normally throws this error which is in GTest, but *only* when compilation and + # preprocessing aren't combined in one step. However, when using ccache with GCC, we are + # running them in separate steps, so this warning/error is shown. + export CXX="${CXX} -Wno-conversion-null" + export CC="${CC} -Wno-conversion-null" + fi +fi + +echo "export CXX=\"${CXX}\"" +echo "export CC=\"${CC}\"" +${CXX} --version |