Skip to content

Commit 0b09209

Browse files
committed
Add .camke-format.py and format CMakeLists.txt
1 parent 9e1ba96 commit 0b09209

File tree

4 files changed

+289
-230
lines changed

4 files changed

+289
-230
lines changed

.cmake-format.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# -----------------------------
2+
# Options affecting formatting.
3+
# -----------------------------
4+
with section("format"):
5+
6+
# Disable formatting entirely, making cmake-format a no-op
7+
disable = False
8+
9+
# How wide to allow formatted cmake files
10+
line_width = 120
11+
12+
# How many spaces to tab for indent
13+
tab_size = 4
14+
15+
# If true, lines are indented using tab characters (utf-8 0x09) instead of
16+
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
17+
# require a fractional tab character, the behavior of the fractional
18+
# indentation is governed by <fractional_tab_policy>
19+
use_tabchars = False
20+
21+
# If <use_tabchars> is True, then the value of this variable indicates how
22+
# fractional indentions are handled during whitespace replacement. If set to
23+
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
24+
# to `round-up` fractional indentation is replaced with a single tab character
25+
# (utf-8 0x09) effectively shifting the column to the next tabstop
26+
fractional_tab_policy = 'use-space'
27+
28+
# If an argument group contains more than this many sub-groups (parg or kwarg
29+
# groups) then force it to a vertical layout.
30+
max_subgroups_hwrap = 4
31+
32+
# If a positional argument group contains more than this many arguments, then
33+
# force it to a vertical layout.
34+
max_pargs_hwrap = 6
35+
36+
# If a cmdline positional group consumes more than this many lines without
37+
# nesting, then invalidate the layout (and nest)
38+
max_rows_cmdline = 2
39+
40+
# If true, separate flow control names from their parentheses with a space
41+
separate_ctrl_name_with_space = False
42+
43+
# If true, separate function names from parentheses with a space
44+
separate_fn_name_with_space = False
45+
46+
# If a statement is wrapped to more than one line, than dangle the closing
47+
# parenthesis on its own line.
48+
dangle_parens = True
49+
50+
# If the trailing parenthesis must be 'dangled' on its on line, then align it
51+
# to this reference: `prefix`: the start of the statement, `prefix-indent`:
52+
# the start of the statement, plus one indentation level, `child`: align to
53+
# the column of the arguments
54+
dangle_align = 'prefix'
55+
56+
# If the statement spelling length (including space and parenthesis) is
57+
# smaller than this amount, then force reject nested layouts.
58+
min_prefix_chars = 4
59+
60+
# If the statement spelling length (including space and parenthesis) is larger
61+
# than the tab width by more than this amount, then force reject un-nested
62+
# layouts.
63+
max_prefix_chars = 10
64+
65+
# If a candidate layout is wrapped horizontally but it exceeds this many
66+
# lines, then reject the layout.
67+
max_lines_hwrap = 2
68+
69+
# What style line endings to use in the output.
70+
line_ending = 'unix'
71+
72+
# Format command names consistently as 'lower' or 'upper' case
73+
command_case = 'canonical'
74+
75+
# Format keywords consistently as 'lower' or 'upper' case
76+
keyword_case = 'unchanged'
77+
78+
# A list of command names which should always be wrapped
79+
always_wrap = []
80+
81+
# If true, the argument lists which are known to be sortable will be sorted
82+
# lexicographicall
83+
enable_sort = True
84+
85+
# If true, the parsers may infer whether or not an argument list is sortable
86+
# (without annotation).
87+
autosort = False
88+
89+
# By default, if cmake-format cannot successfully fit everything into the
90+
# desired linewidth it will apply the last, most agressive attempt that it
91+
# made. If this flag is True, however, cmake-format will print error, exit
92+
# with non-zero status code, and write-out nothing
93+
require_valid_layout = False
94+
95+
# A dictionary mapping layout nodes to a list of wrap decisions. See the
96+
# documentation for more information.
97+
layout_passes = {}
98+
99+
# -----------------------------
100+
# Options affecting comment formatting (indirectly).
101+
# -----------------------------
102+
with section("markup"):
103+
# Disabling markup avoids merging consecutive comment lines
104+
enable_markup = False

0 commit comments

Comments
 (0)