Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 68 additions & 62 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,88 +1,94 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AlignOperands: false
AlignEscapedNewlines: Left
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
BreakConstructorInitializers: AfterColon
BreakInheritanceList: BeforeComma
ColumnLimit: 110
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH, FOR_EACH_R, FOR_EACH_RANGE, ]
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: false
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
- Regex: '^".*'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseBlocks: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: Inner
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
RequiresClausePosition: WithPreceding
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
TabWidth: 4
UseTab: Never
PenaltyBreakBeforeFirstCallParameter: 0
PenaltyBreakTemplateDeclaration: 0
PenaltyReturnTypeOnItsOwnLine: 10
...

107 changes: 107 additions & 0 deletions .clang_tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
Checks:
# --- 1. Enable broad categories by default ---
- 'bugprone-*'
- 'misc-*'
- 'modernize-*'
- 'performance-*'
- 'readability-*'
- 'mpi-*'
- 'openmp-*'

# --- 2. CERT (C++ Secure Coding Standards) ---
- 'cert-err52-cpp'
- 'cert-err60-cpp'
- 'cert-err34-c'
- 'cert-err33-c'
- 'cert-str34-c'
- 'cert-mem57-cpp'
- 'cert-msc50-cpp'
- 'cert-oop57-cpp'
- 'cert-msc51-cpp'
- 'cert-dcl58-cpp'
- 'cert-flp30-c'

# --- 3. C++ Core Guidelines ---
- 'cppcoreguidelines-avoid-capturing-lambda-coroutines'
- 'cppcoreguidelines-avoid-const-or-ref-data-members'
- 'cppcoreguidelines-misleading-capture-default-by-value'
- 'cppcoreguidelines-prefer-member-initializer'
- 'cppcoreguidelines-no-suspend-with-lock'
- 'cppcoreguidelines-rvalue-reference-param-not-moved'
- 'cppcoreguidelines-explicit-virtual-functions'
- 'cppcoreguidelines-slicing'
- 'cppcoreguidelines-pro-type-cstyle-cast'
- 'cppcoreguidelines-interfaces-global-init'
- 'cppcoreguidelines-pro-type-static-cast-downcast'
- 'cppcoreguidelines-narrowing-conversions'
- 'cppcoreguidelines-pro-bounds-constant-array-index'
- 'cppcoreguidelines-missing-std-forward'
- 'cppcoreguidelines-avoid-magic-numbers'
- 'cppcoreguidelines-pro-bounds-array-to-pointer-decay'

# --- 4. High Integrity C++ ---
- 'hicpp-multiway-paths-covered'

# --- 5. Portability ---
- 'portability-std-allocator-const'
- 'portability-simd-intrinsics'

# --- 6. Exclusions (Disabling specific checks) ---
# Exclusions for 'bugprone-*'
- '-bugprone-switch-missing-default-case'
- '-bugprone-casting-through-void'
- '-bugprone-exception-escape'
- '-bugprone-tagged-union-member-count'
- '-bugprone-suspicious-stringview-data-usage'
- '-bugprone-multiple-new-in-one-expression'
- '-bugprone-incorrect-enable-shared-from-this'
- '-bugprone-misleading-setter-of-reference'
- '-bugprone-nondeterministic-pointer-iteration-order'
- '-bugprone-incorrect-enable-if'
- '-bugprone-unintended-char-ostream-output'
- '-bugprone-bool-pointer-implicit-conversion'
- '-bugprone-crtp-constructor-accessibility'
- '-bugprone-multi-level-implicit-pointer-conversion'
- '-bugprone-easily-swappable-parameters'
- '-bugprone-non-zero-enum-to-bool-conversion'
- '-bugprone-not-null-terminated-result'
- '-bugprone-standalone-empty'

# Exclusions for 'misc-*'
- '-misc-unused-parameters'
- '-misc-misleading-identifier'
- '-misc-confusable-identifiers'
- '-misc-misleading-bidirectional'
- '-misc-header-include-cycle'
- '-misc-non-private-member-variables-in-classes'
- '-misc-redundant-expression'

# Exclusions for 'modernize-*'
- '-modernize-use-designated-initializers'
- '-modernize-use-trailing-return-type'
- '-modernize-avoid-c-arrays'
- '-modernize-macro-to-enum'

# Exclusions for 'performance-*'
- '-performance-noexcept-swap'
- '-performance-noexcept-destructor'
- '-performance-enum-size'
- '-performance-no-int-to-ptr'
- '-performance-avoid-endl'

# Exclusions for 'readability-*'
- '-readability-named-parameter'
- '-readability-function-size'
- '-readability-identifier-length'
- '-readability-uppercase-literal-suffix'
- '-readability-math-missing-parentheses'
- '-readability-operators-representation'
- '-readability-ambiguous-smartptr-reset-call'
- '-readability-implicit-bool-conversion'
- '-readability-braces-around-statements'
- '-readability-qualified-auto'
- '-readability-container-data-pointer'
- '-readability-avoid-unconditional-preprocessor-if'
- '-readability-function-cognitive-complexity'
- '-readability-identifier-naming'
- '-readability-enum-initial-value'
32 changes: 8 additions & 24 deletions .github/actions/build-flashmini/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,18 @@ inputs:
runs:
using: "composite"
steps:
# --- 1. Restore Vcpkg ---
- name: Restore Vcpkg
id: vcpkg
uses: ./.github/actions/restore-cache
with:
path: vcpkg_installed
key: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}-${{ hashFiles('vcpkg.json') }}
global-tag: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
gh-token: ${{ github.token }}

# --- 2. Configure ---
# --- 1. setup vcpkg cache ---
- name: setup vcpkg
uses: ./.github/actions/setup-vcpkg-cache

# --- 2. configure ---
- name: Configure CMake
shell: bash
run: |
[ -f ci/CMakeUserPresets.json ] && cp ci/CMakeUserPresets.json CMakeUserPresets.json
cmake --preset ci_${{ inputs.compiler }}_af_${{ inputs.backend }}

# --- 3. Save Vcpkg ---
- name: Save Vcpkg
if: steps.vcpkg.outputs.cache-hit != 'true'
uses: ./.github/actions/save-cache
with:
path: vcpkg_installed
key: ${{ steps.vcpkg.outputs.primary-key }}
global-tag: vcpkg-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
gh-token: ${{ github.token }}

# --- 4. Restore BuildCache ---
# --- 4. restore BuildCache ---
- name: Restore BuildCache
id: buildcache
uses: ./.github/actions/restore-cache
Expand All @@ -52,12 +36,12 @@ runs:
global-tag: buildcache-${{ inputs.cache_prefix }}-${{ inputs.compiler }}-${{ inputs.backend }}
gh-token: ${{ github.token }}

# --- 5. Build ---
# --- 5. build ---
- name: Build
shell: bash
run: cmake --build --preset ci_${{ inputs.compiler }}_af_${{ inputs.backend }}

# --- 6. Save BuildCache ---
# --- 6. save BuildCache ---
- name: Save BuildCache
if: always()
uses: ./.github/actions/save-cache
Expand Down
42 changes: 42 additions & 0 deletions .github/actions/setup-vcpkg-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Vcpkg Cache'
description: 'sets up vcpkg to use NuGet for caching'
inputs:
gh-token:
description: 'GitHub Token for GHCR auth'
required: true
default: ${{ github.token }}

runs:
using: "composite"
steps:
# --- WINDOWS: (dotnet nuget) ---
- name: setup vcpkg nuget source
if: runner.os == 'Windows'
shell: bash
run: |
dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
--name "GitHub" \
--username "${{ github.repository_owner }}" \
--password "${{ inputs.gh-token }}" \
--store-password-in-clear-text

# --- other: (mono + nuget.exe) ---
- name: setup vcpkg nuget source
if: runner.os != 'Windows'
shell: bash
run: |
# download nuget.exe
wget -qO nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
NUGET_PATH="$(pwd)/nuget.exe"

# add source
mono "$NUGET_PATH" sources add \
-Name "GitHub" \
-Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
-UserName "${{ github.repository_owner }}" \
-Password "${{ inputs.gh-token }}" \
-StorePasswordInClearText

# set API key for push
mono "$NUGET_PATH" setapikey "${{ inputs.gh-token }}" \
-Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
3 changes: 3 additions & 0 deletions ci/CMakeUserPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"hidden": true,
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkg_installed"
},
"environment": {
"VCPKG_BINARY_SOURCES" : "clear;nuget,GitHub,readwrite"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions ci/docker/linux/Dockerfile.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN pacman -Syu --noconfirm && \
vcpkg \
wget \
cloc \
mono \
buildcache-git

ENV VCPKG_ROOT=/opt/vcpkg
Expand Down
1 change: 1 addition & 0 deletions ci/docker/linux/Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN pacman -Syu --noconfirm && \
vcpkg \
wget \
cloc \
mono \
buildcache-git

ENV VCPKG_ROOT=/opt/vcpkg
Expand Down
Loading