TMP / Improved build tools layout

This commit is contained in:
OLEGSHA 2023-04-01 23:19:07 +02:00
parent 310724a207
commit 553916f8c1
6 changed files with 10 additions and 20 deletions

View File

@ -28,7 +28,7 @@ file(MAKE_DIRECTORY "${generated}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/")
include(embed/embed) include(embed/embed)
include(glslc) include(glslc)
include(clang-tidy/clang-tidy) include(dev-mode)
# Source files # Source files
target_sources(progressia PRIVATE target_sources(progressia PRIVATE

View File

@ -3,9 +3,7 @@ if (DEV_MODE)
find_package(Python3 COMPONENTS Interpreter REQUIRED) find_package(Python3 COMPONENTS Interpreter REQUIRED)
# Setup clang-tidy # Setup clang-tidy
set(clang_tidy_config_file "${CMAKE_CURRENT_LIST_DIR}/clang-tidy.yml")
list(APPEND clang_tidy_command "${clang_tidy_EXECUTABLE}" list(APPEND clang_tidy_command "${clang_tidy_EXECUTABLE}"
"--config-file=${clang_tidy_config_file}"
"--warnings-as-errors=*" "--warnings-as-errors=*"
"--use-color") "--use-color")

View File

@ -48,7 +48,6 @@ import json
STASH_NAME = 'progressia_pre_commit_stash' STASH_NAME = 'progressia_pre_commit_stash'
# Paths are relative to this script's directory, tools/ # Paths are relative to this script's directory, tools/
SETTINGS_PATH = 'pre-commit-settings.json' SETTINGS_PATH = 'pre-commit-settings.json'
CLANG_FORMAT_PATH = 'clang-format/clang-format.json'
CLANG_TIDY_CHECK_MARKER = 'Clang-tidy is enabled. ' \ CLANG_TIDY_CHECK_MARKER = 'Clang-tidy is enabled. ' \
'This is a marker for pre-commit.py' 'This is a marker for pre-commit.py'
@ -163,17 +162,10 @@ def do_restore():
def format_project(): def format_project():
"""Format staged files with clang-format-diff.""" """Format staged files with clang-format-diff."""
print('Formatting code')
format_file = os.path.join(os.path.dirname(__file__),
CLANG_FORMAT_PATH)
with open(format_file, encoding='utf-8') as f:
style = f.read()
diff = invoke(*git, 'diff', '-U0', '--no-color', '--relative', 'HEAD', diff = invoke(*git, 'diff', '-U0', '--no-color', '--relative', 'HEAD',
*(f"{d}/*.{e}" for d in src_dirs for e in exts)) *(f"{d}/*.{e}" for d in src_dirs for e in exts))
invoke(*clang_format_diff, '-p1', '-i', '--verbose', '-style=' + style, invoke(*clang_format_diff, '-p1', '-i', '--verbose',
stdin=diff, result_when_dry='', quiet=False) stdin=diff, result_when_dry='', quiet=False)