Add clang-tidy configuration and watch script for improved code quality checks
This commit is contained in:
1 parent
fb273e0f8f
commit
fca0c19207
5 files changed
+197
No files matched your search
@@ -22,6 +22,8 @@ include("${DEVKITPRO_CMAKE}")
|
||||
|
||||
project(snakePlus LANGUAGES C CXX ASM)
|
||||
|
||||
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
|
||||
|
||||
# Export compile_commands.json for tooling (clangd, IntelliSense, static analysis).
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
@@ -30,6 +32,24 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
|
||||
if(NOT CLANG_TIDY_EXE)
|
||||
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON, but clang-tidy was not found")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CLANG_TIDY
|
||||
${CLANG_TIDY_EXE}
|
||||
--header-filter=^(include|source)/
|
||||
--extra-arg=--target=arm-none-eabi
|
||||
)
|
||||
set(CMAKE_CXX_CLANG_TIDY
|
||||
${CLANG_TIDY_EXE}
|
||||
--header-filter=^(include|source)/
|
||||
--extra-arg=--target=arm-none-eabi
|
||||
)
|
||||
endif()
|
||||
|
||||
set(TARGET_NAME ${PROJECT_NAME})
|
||||
|
||||
set(GAME_TITLE "Snake Plus")
|
||||
@@ -122,6 +142,15 @@ target_compile_definitions(${TARGET_NAME} PRIVATE
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
-g
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
-Wconversion
|
||||
-Wsign-conversion
|
||||
-Wshadow
|
||||
-Wformat=2
|
||||
-Wundef
|
||||
-Wnull-dereference
|
||||
-Wimplicit-fallthrough
|
||||
-O3
|
||||
-marm
|
||||
-mthumb-interwork
|
||||
|
||||
Reference in new issue
Block a user