Skip to content

Commit 38d007f

Browse files
Cleaned up the build system and code (#1)
- [x] uprgade the build system (CMake scripts) - [x] clean up code - [x] test on macOS - [x] add GH CI scripts
2 parents 9132d72 + 3f5a7c0 commit 38d007f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+5091
-4115
lines changed

.clang-format

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: true
7+
AlignConsecutiveAssignments: false
8+
AlignConsecutiveDeclarations: false
9+
AlignEscapedNewlines: Left
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowAllArgumentsOnNextLine: true
13+
AllowAllConstructorInitializersOnNextLine: true
14+
AllowAllParametersOfDeclarationOnNextLine: true
15+
AllowShortBlocksOnASingleLine: false
16+
AllowShortCaseLabelsOnASingleLine: true
17+
AllowShortFunctionsOnASingleLine: All
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortIfStatementsOnASingleLine: Never
20+
AllowShortLoopsOnASingleLine: false
21+
AlwaysBreakAfterDefinitionReturnType: None
22+
AlwaysBreakAfterReturnType: None
23+
AlwaysBreakBeforeMultilineStrings: false
24+
AlwaysBreakTemplateDeclarations: Yes
25+
BinPackArguments: true
26+
BinPackParameters: true
27+
BraceWrapping:
28+
AfterCaseLabel: false
29+
AfterClass: true
30+
AfterControlStatement: false
31+
AfterEnum: false
32+
AfterFunction: true
33+
AfterNamespace: false
34+
AfterObjCDeclaration: true
35+
AfterStruct: true
36+
AfterUnion: true
37+
AfterExternBlock: false
38+
BeforeCatch: false
39+
BeforeElse: false
40+
IndentBraces: false
41+
SplitEmptyFunction: false
42+
SplitEmptyRecord: false
43+
SplitEmptyNamespace: false
44+
BreakBeforeBinaryOperators: None
45+
BreakBeforeBraces: Custom
46+
BreakBeforeInheritanceComma: false
47+
BreakInheritanceList: BeforeColon
48+
BreakBeforeTernaryOperators: true
49+
BreakConstructorInitializersBeforeComma: false
50+
BreakConstructorInitializers: AfterColon
51+
BreakAfterJavaFieldAnnotations: false
52+
BreakStringLiterals: true
53+
ColumnLimit: 120
54+
CommentPragmas: '^ IWYU pragma:'
55+
CompactNamespaces: true
56+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
57+
ConstructorInitializerIndentWidth: 4
58+
ContinuationIndentWidth: 4
59+
Cpp11BracedListStyle: true
60+
DerivePointerAlignment: false
61+
DisableFormat: false
62+
ExperimentalAutoDetectBinPacking: false
63+
FixNamespaceComments: true
64+
ForEachMacros:
65+
- foreach
66+
- Q_FOREACH
67+
- BOOST_FOREACH
68+
#IncludeBlocks: Regroup
69+
IncludeBlocks: Preserve
70+
IndentCaseLabels: false
71+
IndentPPDirectives: None
72+
IndentWidth: 4
73+
IndentWrappedFunctionNames: false
74+
JavaScriptQuotes: Leave
75+
JavaScriptWrapImports: true
76+
KeepEmptyLinesAtTheStartOfBlocks: false
77+
MacroBlockBegin: ''
78+
MacroBlockEnd: ''
79+
MaxEmptyLinesToKeep: 1
80+
NamespaceIndentation: None
81+
ObjCBinPackProtocolList: Never
82+
ObjCBlockIndentWidth: 2
83+
ObjCSpaceAfterProperty: false
84+
ObjCSpaceBeforeProtocolList: true
85+
PenaltyBreakAssignment: 2
86+
PenaltyBreakBeforeFirstCallParameter: 1
87+
PenaltyBreakComment: 300
88+
PenaltyBreakFirstLessLess: 120
89+
PenaltyBreakString: 1000
90+
PenaltyBreakTemplateDeclaration: 10
91+
PenaltyExcessCharacter: 1000000
92+
PenaltyReturnTypeOnItsOwnLine: 200
93+
PointerAlignment: Left
94+
RawStringFormats:
95+
- Language: Cpp
96+
Delimiters:
97+
- cc
98+
- CC
99+
- cpp
100+
- Cpp
101+
- CPP
102+
- 'c++'
103+
- 'C++'
104+
CanonicalDelimiter: ''
105+
BasedOnStyle: google
106+
- Language: TextProto
107+
Delimiters:
108+
- pb
109+
- PB
110+
- proto
111+
- PROTO
112+
EnclosingFunctions:
113+
- EqualsProto
114+
- EquivToProto
115+
- PARSE_PARTIAL_TEXT_PROTO
116+
- PARSE_TEST_PROTO
117+
- PARSE_TEXT_PROTO
118+
- ParseTextOrDie
119+
- ParseTextProtoOrDie
120+
CanonicalDelimiter: ''
121+
ReflowComments: true
122+
#SortIncludes: true
123+
SortIncludes: false
124+
SortUsingDeclarations: false
125+
SpaceAfterCStyleCast: false
126+
SpaceAfterLogicalNot: false
127+
SpaceAfterTemplateKeyword: true
128+
SpaceBeforeAssignmentOperators: true
129+
SpaceBeforeCpp11BracedList: false
130+
SpaceBeforeCtorInitializerColon: false
131+
SpaceBeforeInheritanceColon: true
132+
SpaceBeforeParens: ControlStatements
133+
SpaceBeforeRangeBasedForLoopColon: true
134+
SpaceInEmptyParentheses: false
135+
SpacesBeforeTrailingComments: 2
136+
SpacesInAngles: false
137+
SpacesInContainerLiterals: true
138+
SpacesInCStyleCastParentheses: false
139+
SpacesInParentheses: false
140+
SpacesInSquareBrackets: false
141+
Standard: Auto
142+
StatementMacros:
143+
- Q_UNUSED
144+
- QT_REQUIRE_VERSION
145+
TabWidth: 4
146+
UseTab: Never
147+
---
148+
Language: Java
149+
BasedOnStyle: Google
150+
AlignTrailingComments: true
151+
AllowShortFunctionsOnASingleLine: All
152+
BinPackArguments: true
153+
BreakAfterJavaFieldAnnotations: true
154+
BreakBeforeBraces: Custom
155+
BraceWrapping:
156+
AfterCaseLabel: false
157+
AfterClass: true
158+
AfterControlStatement: false
159+
AfterEnum: false
160+
AfterFunction: true
161+
AfterNamespace: false
162+
AfterObjCDeclaration: true
163+
AfterStruct: true
164+
AfterUnion: true
165+
AfterExternBlock: false
166+
BeforeCatch: false
167+
BeforeElse: false
168+
IndentBraces: false
169+
SplitEmptyFunction: false
170+
SplitEmptyRecord: false
171+
SplitEmptyNamespace: false
172+
ColumnLimit: 120
173+
IndentWidth: 4
174+
ReflowComments: true
175+
TabWidth: 4
176+
UseTab: Never
177+
...

.github/workflows/build-linux-clang.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/build-linux.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: Build for macOS-13
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- src/**
8+
- test/**
9+
- benchmark/**
10+
- cmake/**
11+
- CMakeLists.txt
12+
- CMakePresets.json
13+
- .github/workflows/build-macos-13.yml
14+
pull_request:
15+
branches: [main]
16+
types: [synchronize, opened, reopened, ready_for_review]
17+
paths:
18+
- src/**
19+
- test/**
20+
- benchmark/**
21+
- cmake/**
22+
- CMakeLists.txt
23+
- CMakePresets.json
24+
- .github/workflows/build-macos-13.yml
25+
workflow_dispatch:
26+
27+
jobs:
28+
macOS-13:
29+
runs-on: macos-13
30+
env:
31+
CMAKE_GENERATOR: "Ninja Multi-Config"
32+
CTEST_OUTPUT_ON_FAILURE: 1
33+
BUILD_DIR: build
34+
steps:
35+
- uses: maxim-lobanov/setup-xcode@v1
36+
with:
37+
xcode-version: '14.3.1'
38+
- name: Setup Runner Environment
39+
run: |
40+
uname -a
41+
xcrun --show-sdk-version
42+
CORES=$(sysctl -n hw.ncpu)
43+
echo "CMAKE_BUILD_PARALLEL_LEVEL=$CORES" >> $GITHUB_ENV
44+
echo "CTEST_TEST_PARALLEL_LEVEL=$CORES" >> $GITHUB_ENV
45+
echo "CTEST_TEST_LOAD=$CORES" >> $GITHUB_ENV
46+
- name: Install Build Tools
47+
run: |
48+
brew update
49+
brew install cmake ninja boost google-sparsehash
50+
- uses: actions/checkout@v4
51+
- name: Configure Multi-Config
52+
run: cmake -B "$BUILD_DIR" -DPTRIE_BuildTests=ON -DPTRIE_BuildBenchmark=OFF
53+
- name: Build Debug
54+
run: cmake --build "$BUILD_DIR" --config Debug
55+
- name: Test Debug
56+
run: ctest --test-dir "$BUILD_DIR" -C Debug
57+
- name: Build Release
58+
run: cmake --build "$BUILD_DIR" --config Release
59+
- name: Test Release
60+
run: ctest --test-dir "$BUILD_DIR" -C Release

0 commit comments

Comments
 (0)