Skip to content

Commit

Permalink
Hack the clang-tidy include path to work on GitHub
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbytheway committed Apr 12, 2020
1 parent 2393076 commit a542150
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a542150

Please sign in to comment.