Reapply "Convert build scripts to CMake (#13427)"

This reverts commit 374bb15db6.
This commit is contained in:
Ashcon Partovi
2024-09-11 08:24:50 -07:00
parent 3e904303ac
commit d39e422b20
223 changed files with 4468 additions and 44770 deletions

View File

@@ -0,0 +1,58 @@
# https://clang.llvm.org/extra/clang-tidy/
include(Macros)
find_command(
VARIABLE
CLANG_TIDY_PROGRAM
COMMAND
clang-tidy
VERSION
${LLVM_VERSION}
REQUIRED
OFF
)
set(CLANG_TIDY_COMMAND ${CLANG_TIDY_PROGRAM} ${BUN_CPP_SOURCES}
-p ${BUILD_PATH}
--config-file=${CWD}/.clang-tidy
--fix
--fix-errors
--fix-notes
)
if(CMAKE_COLOR_DIAGNOSTICS)
list(APPEND CLANG_TIDY_COMMAND --use-color)
endif()
# Extra clang-tidy checks that are normally disabled due to noise.
# e.g. JavaScriptCore/Lookup.h
set(CLANG_TIDY_EXTRA_COMMAND ${CLANG_TIDY_PROGRAM}
--checks=performance-*
)
register_command(
TARGET
clang-tidy
COMMENT
"Running clang-tidy"
COMMAND
${CLANG_TIDY_COMMAND}
CWD
${BUILD_PATH}
TARGETS
${bun}
)
register_command(
TARGET
clang-tidy-extra
COMMENT
"Running clang-tidy with extra checks"
COMMAND
${CLANG_TIDY_EXTRA_COMMAND}
CWD
${BUILD_PATH}
TARGETS
${bun}
)