Skip to content

Commit 1bbfd38

Browse files
authored
Merge pull request #7 from emrekovanci/develop
Develop
2 parents a5a29c1 + ec7dc64 commit 1bbfd38

File tree

20 files changed

+870
-446
lines changed

20 files changed

+870
-446
lines changed

.clang-format

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ IncludeCategories:
9090
# C++ standard headers
9191
- Priority: 4
9292
Regex: '<[[:alnum:]_-]+>'
93-
SortIncludes: Never
93+
SortIncludes: CaseSensitive
9494
SortUsingDeclarations: true
9595

9696
# Pointer & Reference Alignment
@@ -131,5 +131,4 @@ InsertNewlineAtEOF: true
131131
# Qualifiers (const, volatile, static, etc)
132132
QualifierAlignment: Custom
133133
QualifierOrder: ['static', 'inline', 'constexpr', 'const', 'volatile', 'type']
134-
135134
...

.clang-tidy

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1+
---
12
Checks: >
2-
-*,
3-
bugprone-*,
4-
clang-analyzer-*,
5-
misc-*,
6-
modernize-*,
7-
performance-*,
8-
portability-*,
9-
readability-*,
10-
-bugprone-narrowing-conversions,
3+
*,
4+
-altera-*,
5+
-cppcoreguidelines-avoid-magic-numbers,
6+
-fuchsia-*,
7+
fuchsia-multiple-inheritance,
8+
-hicpp-uppercase-literal-suffix,
9+
-llvmlibc-*,
1110
-misc-non-private-member-variables-in-classes,
1211
-modernize-use-nodiscard,
1312
-modernize-use-trailing-return-type,
1413
-readability-identifier-length,
15-
-readability-implicit-bool-conversion,
1614
-readability-magic-numbers,
17-
-readability-redundant-access-specifiers,
1815
-readability-uppercase-literal-suffix,
1916
CheckOptions:
17+
- { key: bugprone-misplaced-widening-cast.CheckImplicitCasts, value: true }
18+
- { key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression, value: true }
19+
- { key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison, value: true }
20+
- { key: readability-uniqueptr-delete-release.PreferResetCall, value: true }
21+
- { key: cppcoreguidelines-narrowing-conversions.PedanticMode, value: true }
22+
# Identifier styles
2023
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
2124
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
2225
- { key: readability-identifier-naming.VariableCase, value: camelBack }
@@ -28,3 +31,4 @@ CheckOptions:
2831
HeaderFilterRegex: '^.*/(app|library)/.*(h|hpp)$'
2932
WarningsAsErrors: '*'
3033
UseColor: true
34+
...

.clangd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Diagnostics:
2929

3030
# Ignore packages that installed by vcpkg
3131
If:
32-
PathMatch: out/.*
32+
PathMatch: (out|build).*
3333
Diagnostics:
3434
Suppress: '*'
3535
UnusedIncludes: None

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
builtin = clear,rare,en-GB_to_en-US,names,informal,code
3+
check-filenames =
4+
check-hidden =
5+
skip = */.git,*/build,*/.vscode
6+
quiet-level = 2

.editorconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
root = true
44

55
[*]
6+
charset = utf-8
67
end_of_line = lf
78
insert_final_newline = true
9+
trim_trailing_whitespace = true
810

911
[*{c,cpp,cxx,h,hpp,hxx,cmake}]
10-
charset = utf-8
1112
indent_style = space
1213
indent_size = 4
13-
trim_trailing_whitespace = true
1414

1515
[CMakeLists.txt]
16-
charset = utf-8
1716
indent_style = space
1817
indent_size = 4
19-
trim_trailing_whitespace = true
2018

2119
[*.yml]
2220
indent_size = 2
2321

22+
[*.json]
23+
indent_size = 4
24+
2425
[{.clangd,.clang-format,.clang-tidy}]
2526
indent_size = 2

.github/workflows/ci.yml

Lines changed: 70 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: ci
22

3+
permissions:
4+
contents: write
5+
36
on:
47
push:
58
branches:
@@ -10,53 +13,76 @@ on:
1013
types: [published]
1114
workflow_dispatch:
1215

16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
VCPKG_FEATURE_FLAGS: dependencygraph
19+
1320
jobs:
14-
build:
15-
name: ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.build_type }} ${{ matrix.config.name }}
21+
lint:
22+
runs-on: ubuntu-22.04
23+
24+
env:
25+
CLANG_FORMAT_VERSION: 17
26+
27+
steps:
28+
- name: Checkout Code
29+
uses: actions/checkout@v4
30+
31+
- name: Install Clang-Format
32+
uses: aminya/setup-cpp@v1
33+
with:
34+
clangformat: ${{ env.CLANG_FORMAT_VERSION }}
35+
36+
- name: Install Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.8"
40+
41+
- name: Install codespell
42+
run: pip3 install codespell
43+
44+
- name: Format Code
45+
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake
46+
47+
- name: Check Formatting
48+
run: git diff --color --exit-code
49+
50+
- name: Spell Check
51+
if: always()
52+
run: cmake -P cmake/CodeSpell.cmake
53+
54+
- name: Format Vcpkg.json
55+
if: always()
56+
run: vcpkg format-manifest ./vcpkg.json
57+
58+
test:
59+
needs: [lint]
60+
61+
name: ${{ matrix.platform.os }} ${{ matrix.platform.generator }} ${{ matrix.platform.compiler }} ${{ matrix.config.name }} ${{ matrix.type.name }}
1662
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
17-
runs-on: ${{ matrix.os }}
63+
runs-on: ${{ matrix.platform.os }}
1864
timeout-minutes: 120
1965

2066
strategy:
2167
fail-fast: false
68+
69+
# https://github.com/actions/runner-images
2270
matrix:
23-
os:
24-
- ubuntu-22.04
25-
- macos-13
26-
- windows-2022
27-
compiler:
28-
- llvm
29-
- gcc
30-
build_type:
31-
- Debug
32-
- Release
71+
platform:
72+
- { os: windows-2022, generator: vs2022, compiler: msvc, preset: windows-vs2022 }
73+
- { os: windows-2022, generator: vs2022, compiler: llvm, preset: windows-vs2022-clangcl }
74+
- { os: windows-2022, generator: ninja, compiler: msvc, preset: windows-ninja }
75+
- { os: windows-2022, generator: ninja, compiler: llvm, preset: windows-ninja-clangcl }
76+
- { os: ubuntu-22.04, generator: ninja, compiler: gcc, preset: linux-ninja-gcc }
77+
- { os: ubuntu-22.04, generator: ninja, compiler: llvm, preset: linux-ninja-clang }
78+
- { os: macos-13, generator: ninja, compiler: llvm, preset: mac-ninja-clang }
79+
- { os: macos-13, generator: xcode, compiler: llvm, preset: mac-xcode-clang }
3380
config:
3481
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
3582
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
36-
37-
exclude:
38-
- os: windows-2022
39-
compiler: gcc
40-
- os: macos-13
41-
compiler: gcc
42-
43-
include:
44-
- os: windows-2022
45-
compiler: msvc
46-
build_type: Debug
47-
config: { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
48-
- os: windows-2022
49-
compiler: msvc
50-
build_type: Debug
51-
config: { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
52-
- os: windows-2022
53-
compiler: msvc
54-
build_type: Release
55-
config: { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
56-
- os: windows-2022
57-
compiler: msvc
58-
build_type: Release
59-
config: { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
83+
type:
84+
- { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug }
85+
- { name: Release, flags: -DCMAKE_BUILD_TYPE=Release }
6086

6187
steps:
6288
- name: Checkout Code
@@ -65,71 +91,24 @@ jobs:
6591
- name: Install Cpp Environment
6692
uses: aminya/setup-cpp@v1
6793
with:
68-
compiler: ${{ matrix.compiler }}
69-
vcvarsall: ${{ contains(matrix.os, 'windows') }}
94+
compiler: ${{ matrix.platform.compiler }}
95+
vcvarsall: ${{ contains(matrix.platform.os, 'windows') }}
7096
cmake: true
7197
ninja: true
7298
vcpkg: true
99+
clangtidy: true
100+
cppcheck: true
73101

74102
- name: CMake Configure
75103
env:
76104
VCPKG_ROOT: '~/vcpkg'
77105
shell: bash
78-
run: |
79-
if [ "${{ runner.os }}" == "Windows" ]; then
80-
cmake --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
81-
else
82-
cmake --preset=${{ matrix.compiler }}-${{ matrix.build_type }} ${{ matrix.config.flags }}
83-
fi
106+
run: cmake --preset=${{ matrix.platform.preset }} ${{ matrix.config.flags }} ${{ matrix.type.flags }} -DVCPKG_MANIFEST_FEATURES=tests -DFEATURE_TESTS=ON
84107

85108
- name: CMake Build
86109
shell: bash
87-
run: |
88-
if [ "${{ runner.os }}" == "Windows" ]; then
89-
cmake --build --preset=Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
90-
else
91-
cmake --build --preset=${{ matrix.compiler }}-${{ matrix.build_type }}
92-
fi
93-
94-
- name: Install
95-
shell: bash
96-
run: |
97-
if [ "${{ runner.os }}" == "Windows" ]; then
98-
cmake --install out/build/Windows-${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
99-
else
100-
cmake --install out/build/${{ matrix.compiler }}-${{ matrix.build_type }} --prefix prefix
101-
fi
110+
run: cmake --build --preset=${{ matrix.platform.preset }} --config ${{ matrix.type.name }}
102111

103112
- name: Test
104-
if: ${{ matrix.build_type == 'Debug' }}
105113
shell: bash
106-
run: |
107-
if [ "${{ runner.os }}" == "Windows" ]; then
108-
ctest --preset=test-Windows-${{ matrix.compiler }}-${{ matrix.build_type }}
109-
else
110-
ctest --preset=test-${{ matrix.compiler }}-${{ matrix.build_type }}
111-
fi
112-
113-
format:
114-
name: Formatting
115-
runs-on: ubuntu-22.04
116-
env:
117-
CLANG_FORMAT_VERSION: 17
118-
119-
strategy:
120-
fail-fast: false
121-
122-
steps:
123-
- name: Checkout Code
124-
uses: actions/checkout@v4
125-
126-
- name: Install Clang-Format
127-
uses: aminya/setup-cpp@v1
128-
with:
129-
clangformat: ${{ env.CLANG_FORMAT_VERSION }}
130-
131-
- name: Format Code
132-
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ env.CLANG_FORMAT_VERSION }} -P cmake/Format.cmake
133-
134-
- name: Check Formatting
135-
run: git diff --color --exit-code
114+
run: ctest --preset=${{ matrix.platform.preset }} -C ${{ matrix.type.name }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ out/
44

55
# ide folders
66
.vs/
7-
.vscode/
87
.idea/
98

9+
# vscode
10+
.vscode/*
11+
!.vscode/settings.json
12+
!.vscode/tasks.json
13+
!.vscode/launch.json
14+
!.vscode/extensions.json
15+
*.code-workspace
16+
1017
# cmake
1118
compile_commands.json
1219

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode.cmake-tools",
4+
"twxs.cmake",
5+
"ms-vscode.cpptools",
6+
"llvm-vs-code-extensions.vscode-clangd",
7+
"EditorConfig.EditorConfig",
8+
"IBM.output-colorizer",
9+
]
10+
}

0 commit comments

Comments
 (0)