Skip to content

Commit

Permalink
chore(tools): add run-clang-tidy
Browse files Browse the repository at this point in the history
Signed-off-by: black-desk <me@black-desk.cn>
  • Loading branch information
black-desk committed Oct 16, 2023
1 parent 7b360ba commit ec4bd2b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tools/run-clang-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/env bash

# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

set -x
set -e

cd "$(git rev-parse --show-toplevel)" || exit 255

builddir=build-run-clang-tidy

command -v clang++ &>/dev/null
command -v clang-tidy &>/dev/null

command -v ccache &>/dev/null && {
USE_CCACHE=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
}

# shellcheck disable=SC2086
cmake --fresh -B "$builddir" -S . \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy \
$USE_CCACHE || exit 255

cmake --build "$builddir" -j "$(nproc)" || exit 255

0 comments on commit ec4bd2b

Please sign in to comment.