| 1 |
set(LLVM_LINK_COMPONENTS support) |
| 2 |
|
| 3 |
add_clang_library(clangFormat |
| 4 |
AffectedRangeManager.cpp |
| 5 |
BreakableToken.cpp |
| 6 |
ContinuationIndenter.cpp |
| 7 |
DefinitionBlockSeparator.cpp |
| 8 |
Format.cpp |
| 9 |
FormatToken.cpp |
| 10 |
FormatTokenLexer.cpp |
| 11 |
IntegerLiteralSeparatorFixer.cpp |
| 12 |
MacroCallReconstructor.cpp |
| 13 |
MacroExpander.cpp |
| 14 |
MatchFilePath.cpp |
| 15 |
NamespaceEndCommentsFixer.cpp |
| 16 |
NumericLiteralCaseFixer.cpp |
| 17 |
NumericLiteralInfo.cpp |
| 18 |
ObjCPropertyAttributeOrderFixer.cpp |
| 19 |
QualifierAlignmentFixer.cpp |
| 20 |
SortJavaScriptImports.cpp |
| 21 |
TokenAnalyzer.cpp |
| 22 |
TokenAnnotator.cpp |
| 23 |
UnwrappedLineFormatter.cpp |
| 24 |
UnwrappedLineParser.cpp |
| 25 |
UsingDeclarationsSorter.cpp |
| 26 |
WhitespaceManager.cpp |
| 27 |
|
| 28 |
LINK_LIBS |
| 29 |
clangBasic |
| 30 |
clangLex |
| 31 |
clangToolingCore |
| 32 |
clangToolingInclusions |
| 33 |
) |
| 34 |
|
| 35 |
file(GLOB_RECURSE files |
| 36 |
*.cpp |
| 37 |
*.h |
| 38 |
${CLANG_SOURCE_DIR}/include/clang/Format/*.h |
| 39 |
${CLANG_SOURCE_DIR}/tools/clang-format/*.cpp |
| 40 |
${CLANG_SOURCE_DIR}/unittests/Format/*.cpp |
| 41 |
${CLANG_SOURCE_DIR}/unittests/Format/*.h |
| 42 |
) |
| 43 |
|
| 44 |
set(check_format_depends) |
| 45 |
set(i 0) |
| 46 |
foreach(file IN LISTS files) |
| 47 |
add_custom_command(OUTPUT check_format_depend_${i} |
| 48 |
COMMAND clang-format ${file} | diff -u ${file} - |
| 49 |
VERBATIM |
| 50 |
COMMENT "Checking format of ${file}" |
| 51 |
) |
| 52 |
list(APPEND check_format_depends check_format_depend_${i}) |
| 53 |
math(EXPR i ${i}+1) |
| 54 |
endforeach() |
| 55 |
add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) |
| 56 |
|
| 57 |
set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools) |
| 58 |
|
| 59 |
set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend) |
| 60 |
set(dump_style dump_format_style.py) |
| 61 |
set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst) |
| 62 |
add_custom_command(OUTPUT ${format_style_depend} |
| 63 |
COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend} |
| 64 |
WORKING_DIRECTORY ${docs_tools_dir} |
| 65 |
VERBATIM |
| 66 |
COMMENT "Updating ${style_options_rst}" |
| 67 |
DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h |
| 68 |
${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h |
| 69 |
${style_options_rst} |
| 70 |
${docs_tools_dir}/plurals.txt |
| 71 |
${docs_tools_dir}/${dump_style} |
| 72 |
) |
| 73 |
add_custom_target(clang-format-style DEPENDS ${format_style_depend}) |
| 74 |
|
| 75 |
set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend) |
| 76 |
set(dump_help dump_format_help.py) |
| 77 |
set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.rst) |
| 78 |
add_custom_command(OUTPUT ${format_help_depend} |
| 79 |
COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin && |
| 80 |
touch ${format_help_depend} |
| 81 |
WORKING_DIRECTORY ${docs_tools_dir} |
| 82 |
VERBATIM |
| 83 |
COMMENT "Updating ${clang_format_rst}" |
| 84 |
DEPENDS clang-format |
| 85 |
${clang_format_rst} |
| 86 |
${docs_tools_dir}/${dump_help} |
| 87 |
) |
| 88 |
add_custom_target(clang-format-help DEPENDS ${format_help_depend}) |