format and lint tasks

This commit is contained in:
apio 2022-07-19 14:18:53 +02:00
parent 723b74da13
commit 434405afb4
6 changed files with 48 additions and 9 deletions

View File

@ -69,3 +69,5 @@ llvm_map_components_to_libnames(llvm_libs support core irreader)
target_link_libraries(sapphirec ${llvm_libs})
install(TARGETS sapphirec)
include(cmake/clang-dev-tools.cmake)

View File

@ -1,8 +0,0 @@
if [ ! -d build ]
then
mkdir build
fi
cmake -S . -B build -G Ninja
cmake --build build

View File

@ -0,0 +1,19 @@
file(GLOB ALL_SOURCE_FILES src/*.cpp src/*.h src/AST/*.cpp src/AST/*.h)
add_custom_target(
clang-format
COMMAND /usr/bin/clang-format
-style=file
-i
${ALL_SOURCE_FILES}
)
add_custom_target(
clang-tidy
COMMAND /usr/bin/clang-tidy
${ALL_SOURCE_FILES}
-config=''
--
-std=c++20
-I${INCLUDE_DIRECTORIES}
)

8
tools/build.sh Executable file
View File

@ -0,0 +1,8 @@
if [ ! -d build ]
then
mkdir build
fi
cmake -S . -B build -G ${1:-Ninja}
cmake --build build

9
tools/format.sh Executable file
View File

@ -0,0 +1,9 @@
if [ ! -d build ]
then
mkdir build
cmake -S . -B build
fi
cd build
cmake --build . --target clang-format

9
tools/lint.sh Executable file
View File

@ -0,0 +1,9 @@
if [ ! -d build ]
then
mkdir build
cmake -S . -B build
fi
cd build
cmake --build . --target clang-tidy