Skip to content

Commit 310cf93

Browse files
committed
Add Rerun C++ template files
0 parents  commit 310cf93

18 files changed

+4903
-0
lines changed

.clang-format

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
BasedOnStyle: Google
2+
3+
# Make it slightly more similar to Rust.
4+
# Based loosely on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4
5+
AccessModifierOffset: -2
6+
AlignAfterOpenBracket: BlockIndent
7+
AllowAllArgumentsOnNextLine: false
8+
AllowShortBlocksOnASingleLine: false
9+
AllowShortCaseLabelsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: Empty
11+
AllowShortIfStatementsOnASingleLine: Never
12+
AlwaysBreakAfterReturnType: None
13+
AlwaysBreakBeforeMultilineStrings: true
14+
BinPackArguments: false
15+
BreakStringLiterals: false
16+
ColumnLimit: 100
17+
ContinuationIndentWidth: 4
18+
DerivePointerAlignment: false
19+
EmptyLineBeforeAccessModifier: LogicalBlock
20+
IndentWidth: 4
21+
IndentWrappedFunctionNames: true
22+
InsertBraces: true
23+
InsertTrailingCommas: Wrapped
24+
MaxEmptyLinesToKeep: 1
25+
NamespaceIndentation: All
26+
PointerAlignment: Left
27+
ReflowComments: false
28+
SeparateDefinitionBlocks: Always
29+
SpacesBeforeTrailingComments: 1
30+
31+
# Don't change include blocks, we want to control this manually.
32+
# Sorting headers however is allowed as all our headers should be standalone.
33+
IncludeBlocks: Preserve
34+
SortIncludes: CaseInsensitive

.github/workflows/cpp.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copied from https://github.com/rerun-io/rerun_template
2+
on: [push, pull_request]
3+
4+
name: C++
5+
6+
jobs:
7+
cpp-check:
8+
name: C++
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: prefix-dev/[email protected]
14+
with:
15+
pixi-version: v0.19.0
16+
cache: true
17+
18+
- run: pixi run build
19+
20+
- run: pixi run cpp-fmt-check

.github/workflows/labels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copied from https://github.com/rerun-io/rerun_template
2+
3+
# https://github.com/marketplace/actions/require-labels
4+
# Check for existence of labels
5+
# See all our labels at https://github.com/rerun-io/rerun/issues/labels
6+
7+
name: PR Labels
8+
9+
on:
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
- labeled
16+
- unlabeled
17+
18+
jobs:
19+
label:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check for a "do-not-merge" label
23+
uses: mheap/github-action-required-labels@v3
24+
with:
25+
mode: exactly
26+
count: 0
27+
labels: "do-not-merge"

.github/workflows/links.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copied from https://github.com/rerun-io/rerun_template
2+
on: [push, pull_request]
3+
4+
name: Link checker
5+
6+
jobs:
7+
link-checker:
8+
name: Check links
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Restore link checker cache
14+
uses: actions/cache@v3
15+
with:
16+
path: .lycheecache
17+
key: cache-lychee-${{ github.sha }}
18+
restore-keys: cache-lychee-
19+
20+
# Check https://github.com/lycheeverse/lychee on how to run locally.
21+
- name: Link Checker
22+
id: lychee
23+
uses: lycheeverse/[email protected]
24+
with:
25+
fail: true
26+
lycheeVersion: "0.14.3"
27+
# When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
28+
args: |
29+
--base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"

.github/workflows/typos.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copied from https://github.com/rerun-io/rerun_template
2+
3+
# https://github.com/crate-ci/typos
4+
# Add exceptions to `.typos.toml`
5+
# install and run locally: cargo install typos-cli && typos
6+
7+
name: Spell Check
8+
on: [pull_request]
9+
10+
jobs:
11+
run:
12+
name: Spell Check
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Actions Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Check spelling of entire workspace
19+
uses: crate-ci/typos@master

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Mac stuff:
2+
.DS_Store
3+
4+
# C++ build directory
5+
build
6+
7+
# Rust compile target directories:
8+
target
9+
target_ra
10+
target_wasm
11+
12+
# https://github.com/lycheeverse/lychee
13+
.lycheecache
14+
15+
# Pixi environment
16+
.pixi
17+
18+
# Python stuff:
19+
__pycache__
20+
.mypy_cache
21+
.ruff_cache
22+
venv
23+
24+
# LSP stuff:
25+
compile_commands.json
26+
27+
# ROS stuff:
28+
humble_ws

.typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://github.com/crate-ci/typos
2+
# install: cargo install typos-cli
3+
# run: typos
4+
5+
[default.extend-words]
6+
teh = "teh" # part of @teh-cmc

.vscode/extensions.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"charliermarsh.ruff",
6+
"gaborv.flatbuffers",
7+
"github.vscode-github-actions",
8+
"josetr.cmake-language-support-vscode",
9+
"ms-python.mypy-type-checker",
10+
"ms-python.python",
11+
"ms-vscode.cmake-tools",
12+
"ms-vscode.cpptools-extension-pack",
13+
"ms-vsliveshare.vsliveshare",
14+
"polymeilex.wgsl",
15+
"rust-lang.rust-analyzer",
16+
"serayuzgur.crates",
17+
"streetsidesoftware.code-spell-checker",
18+
"tamasfe.even-better-toml",
19+
"vadimcn.vscode-lldb",
20+
"wayou.vscode-todo-highlight",
21+
"webfreak.debug",
22+
"xaver.clang-format", // C++ formatter
23+
"zxh404.vscode-proto3",
24+
"esbenp.prettier-vscode"
25+
]
26+
}

.vscode/launch.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
// Python
8+
{
9+
"name": "Python Debugger: Current File",
10+
"type": "debugpy",
11+
"request": "launch",
12+
"program": "${file}",
13+
"console": "integratedTerminal"
14+
},
15+
// Rust:
16+
{
17+
"name": "Debug 'PROJ_NAME'",
18+
"type": "lldb",
19+
"request": "launch",
20+
"cargo": {
21+
"args": [
22+
"build"
23+
],
24+
"filter": {
25+
"name": "PROJ_NAME",
26+
"kind": "bin"
27+
}
28+
},
29+
"args": [],
30+
"cwd": "${workspaceFolder}",
31+
"env": {
32+
"RUST_LOG": "debug"
33+
}
34+
},
35+
{
36+
"name": "Launch Rust tests",
37+
"type": "lldb",
38+
"request": "launch",
39+
"cargo": {
40+
"args": [
41+
"test",
42+
"--no-run",
43+
"--lib",
44+
"--all-features"
45+
],
46+
"filter": {
47+
"kind": "lib"
48+
}
49+
},
50+
"cwd": "${workspaceFolder}",
51+
"env": {
52+
"RUST_LOG": "debug"
53+
}
54+
},
55+
]
56+
}

.vscode/settings.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.semanticTokenColorCustomizations": {
4+
"rules": {
5+
"*.unsafe:rust": "#eb5046"
6+
}
7+
},
8+
"files.autoGuessEncoding": true,
9+
"files.insertFinalNewline": true,
10+
"files.trimTrailingWhitespace": true,
11+
// don't share a cargo lock with rust-analyzer.
12+
// see https://github.com/rerun-io/rerun/pull/519 for rationale
13+
"rust-analyzer.check.overrideCommand": [
14+
"cargo",
15+
"cranky",
16+
"--target-dir=target_ra",
17+
"--workspace",
18+
"--message-format=json",
19+
"--all-targets",
20+
"--all-features"
21+
],
22+
"rust-analyzer.cargo.buildScripts.overrideCommand": [
23+
"cargo",
24+
"check",
25+
"--quiet",
26+
"--target-dir=target_ra",
27+
"--workspace",
28+
"--message-format=json",
29+
"--all-targets",
30+
"--all-features",
31+
],
32+
// Our build scripts are generating code.
33+
// Having Rust Analyzer do this while doing other builds can lead to catastrophic failures.
34+
// INCLUDING attempts to publish a new release!
35+
"rust-analyzer.cargo.buildScripts.enable": false,
36+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", // Use cmake-tools to grab configs.
37+
"C_Cpp.autoAddFileAssociations": false,
38+
"cmake.buildDirectory": "${workspaceRoot}/build/debug",
39+
"cmake.generator": "Ninja", // Use Ninja, just like we do in our just/pixi command.
40+
"rust-analyzer.showUnlinkedFileNotification": false,
41+
"ruff.format.args": [
42+
"--config=pyproject.toml"
43+
],
44+
"ruff.lint.args": [
45+
"--config=pyproject.toml"
46+
],
47+
"prettier.requireConfig": true,
48+
"prettier.configPath": ".prettierrc.toml",
49+
"[python]": {
50+
"editor.defaultFormatter": "charliermarsh.ruff"
51+
},
52+
}

0 commit comments

Comments
 (0)