Skip to content

Commit

Permalink
Merge pull request #1339 from Sphereserver/dev
Browse files Browse the repository at this point in the history
Merge Dev into master
  • Loading branch information
raydienull authored Dec 2, 2024
2 parents 7a9a90c + e488b8a commit bb06831
Show file tree
Hide file tree
Showing 392 changed files with 12,912 additions and 7,685 deletions.
130 changes: 71 additions & 59 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
# Based on LLVM style with C++20 support
BasedOnStyle: LLVM
Language: Cpp
Standard: c++20

# Tab and indent settings
TabWidth: 4
IndentWidth: 4
UseTab: Never
ColumnLimit: 160

# Text line management
#LineEndingStyle: LF
#MaxEmptyLinesToKeep: 3
MaxEmptyLinesToKeep: 2
InsertNewlineAtEOF: true

##-- Alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
# Alignment settings
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
#AlignEscapedNewlinesLeft: false
AlignTrailingComments: true

#AlignConsecutiveTableGenDefinitionColons:
# Enabled: true
# AcrossEmptyLines: true
# AcrossComments: false
AlignEscapedNewlines: Left
AlignTrailingComments:
Kind: Always
OverEmptyLines: 1
DerivePointerAlignment: false
PointerAlignment: Right

##-- Single line statements
# Single-line statements settings
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false

##-- Braces
BreakBeforeBraces: Custom #Allman
# Braces and wrapping settings
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: false
Expand All @@ -47,76 +57,78 @@ BraceWrapping:
SplitEmptyNamespace: false
Cpp11BracedListStyle: false

##-- Line breaks
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
# Line breaks and wrapping settings
#AllowAllParametersOfDeclarationOnNextLine: true
#AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AlwaysBreakAfterDefinitionReturnType: None # Keep return type on the same line if possible
AlwaysBreakAfterReturnType: None # Default value
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakAfterAttributes: Always
BreakBeforeBinaryOperators: None # Default value: No line break before binary operators
BreakBeforeConceptDeclarations: Always
BreakConstructorInitializers: AfterColon
#BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: false
BreakBeforeTernaryOperators: false # Default value
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: false
#BreakInheritanceList: AfterColon
BreakStringLiterals: false # Default value
PackConstructorInitializers: NextLineOnly
PenaltyReturnTypeOnItsOwnLine: 200 # Prefer keeping return type on the same line if possible

##-- Indentation
# Indentation settings
AccessModifierOffset: -4
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: false
LambdaBodyIndentation: Signature
NamespaceIndentation: Inner

##-- Spaces in/between statements/etc
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
# Spaces around statements settings
SpaceAfterCStyleCast: false # Default value
SpaceAfterTemplateKeyword: false # Default value
#SpaceAroundPointerQualifiers: Left
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceInEmptyParentheses: false # Default value
SpacesInAngles: false # Default value
SpacesInCStyleCastParentheses: false # Default value
SpacesInContainerLiterals: false # Default value
SpacesInParentheses: false # Default value
SpacesInSquareBrackets: false # Default value

##-- Misc
AllowAllParametersOfDeclarationOnNextLine: true
AccessModifierOffset: -4
BinPackArguments: false
BinPackParameters: false
BreakAfterAttributes: Always
ExperimentalAutoDetectBinPacking: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DisableFormat: false
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
ReflowComments: false
# Macros settings
#MacroBlockBegin: [regex -> EXC_TRY...]
#MacroBlockEnd:
#StatementMacros: [-> ASSERT?]

# Scopes settings
FixNamespaceComments: true
ShortNamespaceLines: 2

# Miscellaneous settings
SeparateDefinitionBlocks: Always
ReflowComments: false

#-- Include order
#IncludeIsMainRegex: '$?'
# Include order
#IncludeBlocks: Regroup
#IncludeIsMainRegex: '$?'
IncludeCategories:
#TODO: main include!
# Headers in "" with .h extension.
- Regex: '"([A-Za-z0-9\/-_])+\.h"'
Priority: 1
# Headers in "" with .hpp extension.
- Regex: '"([A-Za-z0-9\/-_])+\.hpp"'
Priority: 2

# Headers in <> with .h extension.
- Regex: '<([A-Za-z0-9\/-_])+\.h>'
Priority: 10
# Headers in <> with .hpp extension.
- Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
Priority: 20
# Headers in <> without extension.
- Regex: '<([A-Za-z0-9\/-_])+>'
Priority: 30
SortIncludes: false #CaseSensitive
- Regex: '"([A-Za-z0-9\/-_])+\.h"'
Priority: 1
- Regex: '"([A-Za-z0-9\/-_])+\.hpp"'
Priority: 2
- Regex: '<([A-Za-z0-9\/-_])+\.h>'
Priority: 10
- Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
Priority: 20
- Regex: '<([A-Za-z0-9\/-_])+>'
Priority: 30
SortIncludes: false
82 changes: 82 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
ExcludeHeaderFilterRegex: ^.*(lib\/).*

Checks: >
#-*,
# Enable groups:
bugprone-*,
cppcoreguidelines-*,
clang-analyzer-*,
##hicpp-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
# Disable specific checks/warnings:
-clang-analyzer-security.insecureAPI.strcpy,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-init-variables, # false positives
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-pro-bounds-array-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-const-cast, # we have some instances, and we should remove them...
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-union-access,
##-hicpp-use-auto, #duplicate
##-hicpp-braces-around-statements,
##-hicpp-vararg, #duplicate
-misc-include-cleaner,
-modernize-avoid-c-arrays,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-modernize-loop-convert,
-readability-braces-around-statements,
-readability-delete-null-pointer,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-identifier-naming,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-misleading-indentation, # to be enabled after the source is properly formatted
-readability-simplify-boolean-expr,
-readability-uppercase-literal-suffix,
##-misc-non-private-member-variables-in-classes,
##-readability-named-parameter,
##-readability-braces-around-statements,
##-readability-magic-numbers
# Turn all the warnings from the checks above into errors.
#WarningsAsErrors: "*"

CheckOptions:
- key: 'clang-analyzer-core.NonNullParamChecker:assert_like_macro'
value: 'DEBUG_ASSERT,ASSERT,PERSISTANT_ASSERT'
- key: 'clang-analyzer-config:noreturn_function'
value: 'RaiseImmediateAbort,RaiseRecoverableAbort'
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack } # lower_case
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: m_ }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE}
#- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
- { key: readability-identifier-naming.ScopedEnumConstantCase, value: CamelCase }
- { key: readability-identifier-naming.ScopedEnumConstantPrefix, value: k }
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
- { key: readability-identifier-naming.MemberConstantCase, value: CamelCase }
- { key: readability-identifier-naming.MemberConstantPrefix, value: k }
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
20 changes: 20 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CompileFlags:
Add:
# Exclude the following folders from the source code analysis.
- -I!.codelite
- -I!.ctagsd
- -I!.git
- -I!.github
- -I!.kdev4
- -I!.vscode
- -I!build
- -I!cmake
- -I!lib
- -I!utilities

# If:
# PathMatch: '.*/src/common/common\.h'
# Diagnostics:
# Suppress: ['-Wunused-include-directive']

# TODO: disable clazy-non-pod-global-static
14 changes: 10 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ root = true
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# Optional: git will commit as lf, this will only affect local files
end_of_line = lf

[*.txt]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

Expand All @@ -18,15 +24,15 @@ indent_style = tab

[*.{py,yml,sh,cmake}]
indent_style = space
indent_size = 2
indent_size = 4

[*.{py,yml,sh,cmake}.in]
indent_style = space
indent_size = 2
indent_size = 4

[CMakeLists.txt]
indent_style = space
indent_size = 2
indent_size = 4

[*.{c,h,cpp,cxx,hpp}]
charset = utf-8
Expand Down
12 changes: 12 additions & 0 deletions .gersemirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/master/gersemi/configuration.schema.json

cache: false
color: false
definitions: []
indent: 4
line_length: 120
list_expansion: favour-inlining
quiet: false
unsafe: false
warn_about_unknown_commands: false
workers: 4
2 changes: 1 addition & 1 deletion .github/workflows/build_linux_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Create package
run: |
mkdir accounts logs save scripts
tar -czf SphereSvrX-linux-x86-nightly.tar.gz accounts/ logs/ save/ scripts/ build/bin-x86/SphereSvrX32_nightly src/sphere.ini src/sphereCrypt.ini
tar -czf SphereSvrX-linux-x86-nightly.tar.gz accounts/ logs/ save/ scripts/ -C build/bin-x86/ SphereSvrX32_nightly -C ../../src sphere.ini sphereCrypt.ini
# Upload artifact linked to the workflow run - only if the run is for a pull request, or for selected branches
- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Create package
run: |
mkdir accounts logs save scripts
tar -czf SphereSvrX-linux-x86_64-nightly.tar.gz accounts/ logs/ save/ scripts/ build/bin-x86_64/SphereSvrX64_nightly src/sphere.ini src/sphereCrypt.ini
tar -czf SphereSvrX-linux-x86_64-nightly.tar.gz accounts/ logs/ save/ scripts/ -C build/bin-x86_64/ SphereSvrX64_nightly -C ../../src sphere.ini sphereCrypt.ini
# Upload artifact linked to the workflow run - only if the run is for a pull request, or for selected branches
- name: Upload artifact
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_osx_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
runs-on: macos-14 # apple silicon
env:
CMAKE_GEN: Ninja
CMAKE_TCH: cmake/toolchains/OSX-AppleClang-native.cmake
#CMAKE_TCH: cmake/toolchains/OSX-AppleClang-native.cmake
CMAKE_TCH: cmake/toolchains/OSX-AppleClang-AArch64.cmake

steps:
- name: Checkout repository
Expand All @@ -44,13 +45,12 @@ jobs:
mkdir -p build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE="Nightly" -DCMAKE_TOOLCHAIN_FILE="$CMAKE_TCH" -S . -B ./build
- name: Ninja
run: cd build && ninja -v && cd ..
run: cd build && ninja && cd ..
- name: Create package
run: |
pwd
mkdir accounts logs save scripts
zip -r SphereSvrX-osx-arm64-nightly.zip accounts/ logs/ save/ scripts/
zip SphereSvrX-osx-arm64-nightly.zip src/sphere.ini src/sphereCrypt.ini build/bin-native64/*
zip -rj SphereSvrX-osx-arm64-nightly.zip accounts/ logs/ save/ scripts/ src/sphere.ini src/sphereCrypt.ini build/bin-aarch64/*
# Upload artifact linked to the workflow run - only if the run is for a pull request, or for selected branches
- name: Upload artifact
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_osx_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ jobs:
mkdir -p build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE="Nightly" -DCMAKE_TOOLCHAIN_FILE="$CMAKE_TCH" -S . -B ./build
- name: Ninja
run: cd build && ninja -v && cd ..
run: cd build && ninja && cd ..
- name: Create package
run: |
pwd
mkdir accounts logs save scripts
zip -r SphereSvrX-osx-x86_64-nightly.zip accounts/ logs/ save/ scripts/
zip SphereSvrX-osx-x86_64-nightly.zip src/sphere.ini src/sphereCrypt.ini build/bin-x86_64/*
zip -rj SphereSvrX-osx-x86_64-nightly.zip accounts/ logs/ save/ scripts/ src/sphere.ini src/sphereCrypt.ini build/bin-x86_64/*
# Upload artifact linked to the workflow run - only if the run is for a pull request, or for selected branches
- name: Upload artifact
Expand Down
Loading

0 comments on commit bb06831

Please sign in to comment.