diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d9eea1..2467337 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,4 +68,6 @@ llvm_map_components_to_libnames(llvm_libs support core irreader) # Link against LLVM libraries target_link_libraries(sapphirec ${llvm_libs}) -install(TARGETS sapphirec) \ No newline at end of file +install(TARGETS sapphirec) + +include(cmake/clang-dev-tools.cmake) \ No newline at end of file diff --git a/build.sh b/build.sh index 9db27f2..e69de29 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +0,0 @@ -if [ ! -d build ] -then - mkdir build -fi - -cmake -S . -B build -G Ninja - -cmake --build build \ No newline at end of file diff --git a/cmake/clang-dev-tools.cmake b/cmake/clang-dev-tools.cmake new file mode 100644 index 0000000..5fdfbcf --- /dev/null +++ b/cmake/clang-dev-tools.cmake @@ -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} +) \ No newline at end of file diff --git a/tools/build.sh b/tools/build.sh new file mode 100755 index 0000000..ca8a677 --- /dev/null +++ b/tools/build.sh @@ -0,0 +1,8 @@ +if [ ! -d build ] +then + mkdir build +fi + +cmake -S . -B build -G ${1:-Ninja} + +cmake --build build \ No newline at end of file diff --git a/tools/format.sh b/tools/format.sh new file mode 100755 index 0000000..1b5ded9 --- /dev/null +++ b/tools/format.sh @@ -0,0 +1,9 @@ +if [ ! -d build ] +then + mkdir build + cmake -S . -B build +fi + +cd build + +cmake --build . --target clang-format \ No newline at end of file diff --git a/tools/lint.sh b/tools/lint.sh new file mode 100755 index 0000000..b4fbb14 --- /dev/null +++ b/tools/lint.sh @@ -0,0 +1,9 @@ +if [ ! -d build ] +then + mkdir build + cmake -S . -B build +fi + +cd build + +cmake --build . --target clang-tidy \ No newline at end of file