Skip to content

Commit 1729a0c

Browse files
committed
🚀 Initial commit
0 parents  commit 1729a0c

File tree

19 files changed

+623
-0
lines changed

19 files changed

+623
-0
lines changed

.clang-format

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
ColumnLimit: 100
4+
AllowShortFunctionsOnASingleLine: Inline
5+
SortIncludes: true
6+
ReflowComments: true
7+
SpacesBeforeTrailingComments: 1
8+
SpaceAfterCStyleCast: true

.clang-tidy

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Checks: >
2+
bugprone-*,
3+
performance-*,
4+
readability-*,
5+
modernize-*,
6+
cppcoreguidelines-*,
7+
-modernize-use-trailing-return-type,
8+
-cppcoreguidelines-owning-memory
9+
WarningsAsErrors: ''
10+
HeaderFilterRegex: '.*'
11+
FormatStyle: file
12+
CheckOptions:
13+
- key: modernize-use-nullptr.NullMacros
14+
value: 'NULL'
15+
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
16+
value: 'true'

.github/workflows/.deploy-book.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and deploy mdbook
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install mdBook
21+
run: cargo install mdbook --locked
22+
23+
- name: Install mdBook-katex
24+
run: cargo install mdbook-katex
25+
26+
- name: Install mdBook-admonish
27+
run: cargo install mdbook-admonish
28+
29+
- name: Build the book
30+
run: cd book && mdbook-admonish install && mdbook build
31+
32+
- name: Upload GitHub Pages artifact
33+
uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: book/book
36+
37+
deploy:
38+
if: github.event_name == 'push'
39+
needs: build
40+
runs-on: ubuntu-latest
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
steps:
45+
- name: Deploy to GitHub Pages
46+
id: deployment
47+
uses: actions/deploy-pages@v4

.github/workflows/cpp-tests.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: C++ / Spack / CTest
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-22.04
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
compiler: [gcc, clang]
17+
18+
env:
19+
CMAKE_BUILD_TYPE: Release
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set compiler
26+
run: |
27+
if [ "${{ matrix.compiler }}" = "clang" ]; then
28+
sudo apt-get update
29+
sudo apt-get install -y clang
30+
echo "CC=clang" >> $GITHUB_ENV
31+
echo "CXX=clang++" >> $GITHUB_ENV
32+
else
33+
echo "CC=gcc" >> $GITHUB_ENV
34+
echo "CXX=g++" >> $GITHUB_ENV
35+
fi
36+
37+
- name: Setup CMake
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y cmake
41+
42+
- name: Setup Spack
43+
uses: spack/setup-spack@v2
44+
45+
- name: Concretize & install (from spack.yaml)
46+
shell: spack-bash {0}
47+
run: |
48+
spack env create lobxp ./spack.yaml
49+
spack env activate lobxp
50+
spack concretize -f
51+
spack install -j "$(nproc)"
52+
spack find -dlv
53+
54+
- name: Configure
55+
shell: spack-bash {0}
56+
run: |
57+
spack env activate lobxp
58+
cmake -S . -B build -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
59+
60+
- name: Build
61+
run: cmake --build build -j $(nproc)
62+
63+
- name: Test
64+
run: ctest --test-dir build --output-on-failure

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/build/
2+
/cmake-build/
3+
/dist/
4+
/*.egg-info
5+
*.pyc
6+
__pycache__/
7+
/.vscode/
8+
/.idea/
9+
.spack-env/
10+
cmake/
11+
book/book
12+
book/mdbook-admonish.css

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
# Project configuration
4+
project(cppxplorers LANGUAGES CXX)
5+
6+
# Set C++ standard
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
set(CMAKE_CXX_EXTENSIONS OFF)
10+
11+
# Dependencies from Spack
12+
# Spack's "view: true" ensures these are in CMAKE_PREFIX_PATH automatically
13+
find_package(Eigen3 REQUIRED NO_MODULE)
14+
15+
# Enable tests
16+
include(CTest) # sets BUILD_TESTING option
17+
enable_testing() # actually turns testing on
18+
19+
# Add crates subdirectory
20+
add_subdirectory(crates)

Justfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -------------------------
2+
# Config
3+
# -------------------------
4+
# Override on the CLI like: just BUILD_TYPE=Release build
5+
BUILD_DIR := "cmake-build"
6+
BUILD_TYPE := "Release" # Debug | Release | RelWithDebInfo | MinSizeRel
7+
GENERATOR := "" # e.g., -G Ninja
8+
CMAKE_FLAGS := "-DCMAKE_BUILD_TYPE={{BUILD_TYPE}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
9+
10+
# If you set an install prefix, uncomment the next line (useful for pybind11 modules):
11+
# INSTALL_PREFIX ?= "{{pwd()}}/.local"
12+
# INSTALL_FLAG := "-DCMAKE_INSTALL_PREFIX={{INSTALL_PREFIX}}"
13+
14+
# -------------------------
15+
# Default
16+
# -------------------------
17+
default: configure build test
18+
19+
# -------------------------
20+
# CMake lifecycle
21+
# -------------------------
22+
configure:
23+
cmake -S . -B {{BUILD_DIR}} {{GENERATOR}} {{CMAKE_FLAGS}}
24+
25+
build: configure
26+
cmake --build {{BUILD_DIR}} -j
27+
28+
install: build
29+
cmake --install {{BUILD_DIR}}
30+
31+
test: build
32+
ctest --test-dir {{BUILD_DIR}} --output-on-failure
33+
34+
clean:
35+
rm -rf {{BUILD_DIR}}
36+
37+
# -------------------------
38+
# Run binaries (examples)
39+
# -------------------------
40+
# Add more run-* recipes as we add crates
41+
run-kalman:
42+
{{BUILD_DIR}}/crates/kf_linear/kf_demo
43+
44+
# -------------------------
45+
# Linting & formatting
46+
# -------------------------
47+
lint: build
48+
clang-tidy crates/*/src/*.cpp -p {{BUILD_DIR}} -- -std=c++17
49+
50+
fmt:
51+
find crates -type f \( -name '*.cpp' -o -name '*.hpp' \) -exec clang-format -i {} +
52+
53+
fmt-check:
54+
find crates -type f \( -name '*.cpp' -o -name '*.hpp' \) -exec clang-format --dry-run --Werror {} +
55+

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# cppXplorers : Explorations in C++ for applied sciences
2+
3+
`cppXplorers` is a collection of experiments and examples in modern C++, with a focus on applied sciences and engineering. The project is organized as a mono-repository, where each crate is independent and self-contained.
4+
5+
The purpose of this repository is to provide a space for exploring numerical methods, algorithms, and patterns in C++ in a practical and modular way. It is not intended as a tutorial or comprehensive learning resource, but rather as a set of working examples and references.
6+
7+
Contributions are welcome. If you spot an issue, find an area that could be improved, or want to add your own example, feel free to open an issue or submit a pull request.

book/book.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[book]
2+
authors = ["Brian Staber"]
3+
language = "en"
4+
src = "src"
5+
title = "cppXplorers"
6+
7+
[preprocessor.katex]
8+
after = ["links"]
9+
10+
[preprocessor.admonish]
11+
command = "mdbook-admonish"
12+
assets_version = "3.1.0" # do not edit: managed by `mdbook-admonish install`
13+
14+
[output.html]
15+
additional-css = ["./mdbook-admonish.css"]
16+
17+
[output.html.fold]
18+
enable = true
19+
level = 1

book/src/SUMMARY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- [Introduction](introduction.md)
2+
- [Kalman filter](kf_linear.md)
3+
- [Class definition]()
4+
- [Class implementation]()
5+
- [Python bindings]()

0 commit comments

Comments
 (0)