Skip to content

Commit 26df903

Browse files
committed
Initial commit
0 parents  commit 26df903

40 files changed

+2753
-0
lines changed

.clang-format

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
AccessModifierOffset: -2
2+
AlignAfterOpenBracket: DontAlign
3+
AlignConsecutiveAssignments: false
4+
AlignConsecutiveDeclarations: false
5+
AlignEscapedNewlines: Left
6+
AlignOperands: true
7+
AlignTrailingComments: false
8+
AllowAllParametersOfDeclarationOnNextLine: false
9+
AllowShortBlocksOnASingleLine: true
10+
AllowShortCaseLabelsOnASingleLine: false
11+
AllowShortFunctionsOnASingleLine: All
12+
AllowShortIfStatementsOnASingleLine: true
13+
AllowShortLoopsOnASingleLine: true
14+
AlwaysBreakAfterDefinitionReturnType: None
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: false
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: true
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: true
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: true
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
SplitEmptyFunction: false
33+
SplitEmptyNamespace: true
34+
SplitEmptyRecord: true
35+
BreakAfterJavaFieldAnnotations: true
36+
BreakBeforeBinaryOperators: NonAssignment
37+
BreakBeforeBraces: Custom
38+
BreakBeforeInheritanceComma: true
39+
BreakBeforeTernaryOperators: true
40+
BreakConstructorInitializers: BeforeColon
41+
BreakConstructorInitializersBeforeComma: false
42+
BreakStringLiterals: true
43+
ColumnLimit: 120
44+
CommentPragmas: '^ IWYU pragma:'
45+
CompactNamespaces: false
46+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
47+
ConstructorInitializerIndentWidth: 2
48+
ContinuationIndentWidth: 2
49+
Cpp11BracedListStyle: false
50+
DerivePointerAlignment: false
51+
DisableFormat: false
52+
ExperimentalAutoDetectBinPacking: true
53+
FixNamespaceComments: true
54+
ForEachMacros:
55+
- foreach
56+
- Q_FOREACH
57+
- BOOST_FOREACH
58+
IncludeCategories:
59+
- Priority: 2
60+
Regex: ^"(llvm|llvm-c|clang|clang-c)/
61+
- Priority: 3
62+
Regex: ^(<|"(gtest|gmock|isl|json)/)
63+
- Priority: 1
64+
Regex: .*
65+
IncludeIsMainRegex: (Test)?$
66+
IndentCaseLabels: false
67+
IndentWidth: 2
68+
IndentWrappedFunctionNames: true
69+
JavaScriptQuotes: Leave
70+
JavaScriptWrapImports: true
71+
KeepEmptyLinesAtTheStartOfBlocks: true
72+
Language: Cpp
73+
MacroBlockBegin: ''
74+
MacroBlockEnd: ''
75+
MaxEmptyLinesToKeep: 2
76+
NamespaceIndentation: Inner
77+
ObjCBlockIndentWidth: 7
78+
ObjCSpaceAfterProperty: true
79+
ObjCSpaceBeforeProtocolList: false
80+
PointerAlignment: Right
81+
ReflowComments: true
82+
SortIncludes: true
83+
SortUsingDeclarations: false
84+
SpaceAfterCStyleCast: false
85+
SpaceAfterTemplateKeyword: false
86+
SpaceBeforeAssignmentOperators: true
87+
SpaceBeforeParens: ControlStatements
88+
SpaceInEmptyParentheses: false
89+
SpacesBeforeTrailingComments: 0
90+
SpacesInAngles: false
91+
SpacesInCStyleCastParentheses: false
92+
SpacesInContainerLiterals: true
93+
SpacesInParentheses: false
94+
SpacesInSquareBrackets: false
95+
Standard: c++20
96+
TabWidth: 8
97+
UseTab: Never
98+

.clang-tidy

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
Checks: "*,
3+
-abseil-*,
4+
-altera-*,
5+
-android-*,
6+
-fuchsia-*,
7+
-google-*,
8+
-llvm*,
9+
-modernize-use-trailing-return-type,
10+
-zircon-*,
11+
-readability-else-after-return,
12+
-readability-static-accessed-through-instance,
13+
-readability-avoid-const-params-in-decls,
14+
-cppcoreguidelines-non-private-member-variables-in-classes,
15+
-misc-non-private-member-variables-in-classes,
16+
"
17+
WarningsAsErrors: ''
18+
HeaderFilterRegex: ''
19+
FormatStyle: none
20+
21+
22+
23+
24+
25+

.cmake-format.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
additional_commands:
2+
foo:
3+
flags:
4+
- BAR
5+
- BAZ
6+
kwargs:
7+
DEPENDS: '*'
8+
HEADERS: '*'
9+
SOURCES: '*'
10+
bullet_char: '*'
11+
dangle_parens: false
12+
enum_char: .
13+
line_ending: unix
14+
line_width: 120
15+
max_pargs_hwrap: 3
16+
separate_ctrl_name_with_space: false
17+
separate_fn_name_with_space: false
18+
tab_size: 2
19+
20+
markup:
21+
enable_markup: false

.devcontainer/.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Build directories and binary files
2+
build/
3+
out/
4+
cmake-build-*/
5+
6+
# User spesific settings
7+
CMakeUserPresets.json
8+
9+
# IDE files
10+
.vs/
11+
.idea/
12+
.vscode/
13+
!.vscode/settings.json
14+
!.vscode/tasks.json
15+
!.vscode/launch.json
16+
!.vscode/extensions.json
17+
*.swp
18+
*~
19+
_ReSharper*
20+
*.log
21+
22+
# OS Generated Files
23+
.DS_Store
24+
.AppleDouble
25+
.LSOverride
26+
._*
27+
.Spotlight-V100
28+
.Trashes
29+
.Trash-*
30+
$RECYCLE.BIN/
31+
.TemporaryItems
32+
ehthumbs.db
33+
Thumbs.db
34+
Dockerfile

.devcontainer/Dockerfile

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# [Choice] bionic (18.04), focal (20.04)
2+
ARG VARIANT="focal"
3+
FROM ubuntu:${VARIANT}
4+
5+
# Restate the variant to use it later on in the llvm and cmake installations
6+
ARG VARIANT
7+
8+
# Install necessary packages available from standard repos
9+
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
10+
apt-get install -y --no-install-recommends \
11+
software-properties-common wget apt-utils file zip \
12+
openssh-client gpg-agent socat rsync \
13+
make ninja-build git \
14+
python3 python3-pip
15+
16+
# Install conan
17+
RUN python3 -m pip install --upgrade pip setuptools && \
18+
python3 -m pip install conan && \
19+
conan --version
20+
21+
# By default, anything you run in Docker is done as superuser.
22+
# Conan runs some install commands as superuser, and will prepend `sudo` to
23+
# these commands, unless `CONAN_SYSREQUIRES_SUDO=0` is in your env variables.
24+
ENV CONAN_SYSREQUIRES_SUDO 0
25+
# Some packages request that Conan use the system package manager to install
26+
# a few dependencies. This flag allows Conan to proceed with these installations;
27+
# leaving this flag undefined can cause some installation failures.
28+
ENV CONAN_SYSREQUIRES_MODE enabled
29+
30+
# User-settable versions:
31+
# This Dockerfile should support gcc-[7, 8, 9, 10, 11] and clang-[10, 11, 12, 13]
32+
# Earlier versions of clang will require significant modifications to the IWYU section
33+
ARG GCC_VER="11"
34+
# Add gcc-${GCC_VER}
35+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
36+
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
37+
apt-get install -y --no-install-recommends \
38+
gcc-${GCC_VER} g++-${GCC_VER} gdb
39+
40+
# Set gcc-${GCC_VER} as default gcc
41+
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100
42+
RUN update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100
43+
44+
ARG LLVM_VER="13"
45+
# Add clang-${LLVM_VER}
46+
ARG LLVM_URL="http://apt.llvm.org/${VARIANT}/"
47+
ARG LLVM_PKG="llvm-toolchain-${VARIANT}-${LLVM_VER}"
48+
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null && \
49+
add-apt-repository -y "deb ${LLVM_URL} ${LLVM_PKG} main" && \
50+
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
51+
apt-get install -y --no-install-recommends \
52+
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} \
53+
llvm-${LLVM_VER}-dev libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER}
54+
55+
# Set the default clang-tidy, so CMake can find it
56+
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1
57+
58+
# Set clang-${LLVM_VER} as default clang
59+
RUN update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100
60+
RUN update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100
61+
62+
# Add current cmake/ccmake, from Kitware
63+
ARG CMAKE_URL="https://apt.kitware.com/ubuntu/"
64+
ARG CMAKE_PKG=${VARIANT}
65+
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
66+
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
67+
apt-add-repository -y "deb ${CMAKE_URL} ${CMAKE_PKG} main" && \
68+
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
69+
apt-get install -y --no-install-recommends cmake cmake-curses-gui
70+
71+
# Install editors
72+
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
73+
apt-get install -y --no-install-recommends \
74+
neovim emacs nano
75+
76+
# Install optional dependecies
77+
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
78+
apt-get install -y --no-install-recommends \
79+
doxygen graphviz ccache cppcheck
80+
81+
# Install include-what-you-use
82+
ENV IWYU /home/iwyu
83+
ENV IWYU_BUILD ${IWYU}/build
84+
ENV IWYU_SRC ${IWYU}/include-what-you-use
85+
RUN mkdir -p ${IWYU_BUILD} && \
86+
git clone --branch clang_${LLVM_VER} \
87+
https://github.com/include-what-you-use/include-what-you-use.git \
88+
${IWYU_SRC}
89+
RUN CC=clang-${LLVM_VER} CXX=clang++-${LLVM_VER} cmake -S ${IWYU_SRC} \
90+
-B ${IWYU_BUILD} \
91+
-G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-${LLVM_VER} && \
92+
cmake --build ${IWYU_BUILD} -j && \
93+
cmake --install ${IWYU_BUILD}
94+
95+
# Per https://github.com/include-what-you-use/include-what-you-use#how-to-install:
96+
# `You need to copy the Clang include directory to the expected location before
97+
# running (similarly, use include-what-you-use -print-resource-dir to learn
98+
# exactly where IWYU wants the headers).`
99+
RUN mkdir -p $(include-what-you-use -print-resource-dir 2>/dev/null)
100+
RUN ln -s $(readlink -f /usr/lib/clang/${LLVM_VER}/include) \
101+
$(include-what-you-use -print-resource-dir 2>/dev/null)/include
102+
103+
## Cleanup cached apt data we don't need anymore
104+
RUN apt-get autoremove -y && apt-get clean && \
105+
rm -rf /var/lib/apt/lists/*
106+
107+
# Allow the user to set compiler defaults
108+
ARG USE_CLANG
109+
# if --build-arg USE_CLANG=1, set CC to 'clang' or set to null otherwise.
110+
ENV CC=${USE_CLANG:+"clang"}
111+
ENV CXX=${USE_CLANG:+"clang++"}
112+
# if CC is null, set it to 'gcc' (or leave as is otherwise).
113+
ENV CC=${CC:-"gcc"}
114+
ENV CXX=${CXX:-"g++"}
115+
116+
# Include project
117+
#ADD . /workspaces/cpp_starter_project
118+
#WORKDIR /workspaces/cpp_starter_project
119+
120+
CMD ["/bin/bash"]

.devcontainer/devcontainer.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/cpp
3+
{
4+
"name": "C++",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick an Ubuntu OS version. Options: [bionic, focal]. Default: focal
8+
// Update 'GCC_VER' to pick a gcc and g++ version. Options: [7, 8, 9, 10, 11]. Default: 11
9+
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13]. Default: 13
10+
// Update 'USE_CLANG' to set clang as the default C and C++ compiler. Options: [1, null]. Default null
11+
// "args": {
12+
// "VARIANT": "focal",
13+
// "GCC_VER": "11",
14+
// "LLVM_VER": "13"
15+
// }
16+
},
17+
"runArgs": [
18+
"--cap-add=SYS_PTRACE",
19+
"--security-opt",
20+
"seccomp=unconfined"
21+
],
22+
// Set *default* container specific settings.json values on container create.
23+
"settings": {
24+
"cmake.configureOnOpen": true,
25+
"editor.formatOnSave": true
26+
},
27+
// Add the IDs of extensions you want installed when the container is created.
28+
"extensions": [
29+
"ms-vscode.cpptools",
30+
"ms-vscode.cmake-tools",
31+
"twxs.cmake",
32+
"ms-vscode.cpptools-themes",
33+
"cschlosser.doxdocgen",
34+
"eamodio.gitlens",
35+
"ms-python.python",
36+
"ms-python.vscode-pylance",
37+
"mutantdino.resourcemonitor"
38+
],
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
// "forwardPorts": [],
41+
// Use 'postCreateCommand' to run commands after the container is created.
42+
//"postCreateCommand": "uname -a",
43+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
//"remoteUser": "vscode",
45+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=delegated",
46+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
47+
"features": {
48+
"git": "latest",
49+
"git-lfs": "latest",
50+
"powershell": "latest"
51+
}
52+
}

.gitattributes

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
###############################
2+
# Git Line Endings #
3+
###############################
4+
5+
* text=auto eol=lf
6+
*.{cmd,[cC][mM][dD]} text eol=crlf
7+
*.{bat,[bB][aA][tT]} text eol=crlf
8+
*.{vcxproj,vcxproj.filters} text eol=crlf
9+
10+
###############################
11+
# Git Large File System (LFS) #
12+
###############################
13+
14+
# Archives
15+
#*.7z filter=lfs diff=lfs merge=lfs -text
16+
#*.br filter=lfs diff=lfs merge=lfs -text
17+
#*.gz filter=lfs diff=lfs merge=lfs -text
18+
#*.tar filter=lfs diff=lfs merge=lfs -text
19+
#*.zip filter=lfs diff=lfs merge=lfs -text
20+
21+
# Documents
22+
#*.pdf filter=lfs diff=lfs merge=lfs -text
23+
24+
# Images
25+
#*.gif filter=lfs diff=lfs merge=lfs -text
26+
#*.ico filter=lfs diff=lfs merge=lfs -text
27+
#*.jpg filter=lfs diff=lfs merge=lfs -text
28+
#*.pdf filter=lfs diff=lfs merge=lfs -text
29+
#*.png filter=lfs diff=lfs merge=lfs -text
30+
#*.psd filter=lfs diff=lfs merge=lfs -text
31+
#*.webp filter=lfs diff=lfs merge=lfs -text
32+
33+
# Fonts
34+
#*.woff2 filter=lfs diff=lfs merge=lfs -text
35+
36+
# Other
37+
#*.exe filter=lfs diff=lfs merge=lfs -text

0 commit comments

Comments
 (0)