From a542150ccaede667b51176cb5e99ce7fc122194f Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Sat, 11 Apr 2020 16:53:19 -0400 Subject: [PATCH] Hack the clang-tidy include path to work on GitHub A difference in the clang include paths between Travis and GitHub workflows means that the custom clang-tidy we're using doesn't quite work correctly on GitHub. Work around this by adding a new include directory explicitly. --- build-scripts/build.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build-scripts/build.sh b/build-scripts/build.sh index 364b32835d8fd..2e86404900b47 100755 --- a/build-scripts/build.sh +++ b/build-scripts/build.sh @@ -48,15 +48,23 @@ then build_type=Debug fi - cmake_extra_opts= + cmake_extra_opts=() if [ "$CATA_CLANG_TIDY" = "plugin" ] then - cmake_extra_opts="$cmake_extra_opts -DCATA_CLANG_TIDY_PLUGIN=ON" + cmake_extra_opts+=("-DCATA_CLANG_TIDY_PLUGIN=ON") # Need to specify the particular LLVM / Clang versions to use, lest it # use the llvm-7 that comes by default on the Travis Xenial image. - cmake_extra_opts="$cmake_extra_opts -DLLVM_DIR=/usr/lib/llvm-8/lib/cmake/llvm" - cmake_extra_opts="$cmake_extra_opts -DClang_DIR=/usr/lib/llvm-8/lib/cmake/clang" + cmake_extra_opts+=("-DLLVM_DIR=/usr/lib/llvm-8/lib/cmake/llvm") + cmake_extra_opts+=("-DClang_DIR=/usr/lib/llvm-8/lib/cmake/clang") + fi + + if [ "$COMPILER" = "clang++-8" -a -n "$GITHUB_WORKFLOW" -a -n "$CATA_CLANG_TIDY" ] + then + # This is a hacky workaround for the fact that the custom clang-tidy we are + # using is built for Travis CI, so it's not using the correct include directories + # for GitHub workflows. + cmake_extra_opts+=("-DCMAKE_CXX_FLAGS=-isystem /usr/include/clang/8.0.0/include") fi mkdir build @@ -68,7 +76,7 @@ then -DCMAKE_BUILD_TYPE="$build_type" \ -DTILES=${TILES:-0} \ -DSOUND=${SOUND:-0} \ - $cmake_extra_opts \ + "${cmake_extra_opts[@]}" \ .. if [ -n "$CATA_CLANG_TIDY" ] then