|
4 | 4 |
|
5 | 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 | 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. |
| 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. |
| 8 | + |
| 9 | +# Developper guide |
| 10 | + |
| 11 | +## Spack |
| 12 | + |
| 13 | +We use spack to manage dependencies and build the projects. To get started, clone the repository and run: |
| 14 | + |
| 15 | +```bash |
| 16 | +git clone https://github.com/bstaber/cppplorers.git |
| 17 | +cd cppXplorers |
| 18 | +spack env activate . |
| 19 | +spack concretize -f |
| 20 | +spack install |
| 21 | +``` |
| 22 | + |
| 23 | +This will set up the environment and install the necessary packages. You can then enter the environment with: |
| 24 | + |
| 25 | +```bash |
| 26 | +spack env activate . |
| 27 | +``` |
| 28 | + |
| 29 | +Note that we set the CUDA dependency externally, so if you want to use CUDA, make sure to have it installed and configured properly. |
| 30 | + |
| 31 | +## Building |
| 32 | + |
| 33 | +Each crate has its own `CMakeLists.txt` file and can be built independently. However, we provide a top-level `CMakeLists.txt` that can be used to build all crates at once. To build all crates, run: |
| 34 | + |
| 35 | +```bash |
| 36 | +just |
| 37 | +``` |
| 38 | + |
| 39 | +This will run the `justfile` which builds all crates and runs all tests. |
| 40 | + |
| 41 | +## Adding a new crate |
| 42 | + |
| 43 | +To add a new crate, create a new directory under `crates/` and add a `CMakeLists.txt` file. You can use one of the existing crates as a template. Make sure to update the top-level `CMakeLists.txt` to include your new crate. |
| 44 | + |
| 45 | +## Documenting a crate |
| 46 | +We use `mdbook` to document each crate. You can find the book source files in the `books/` directory. To build and serve the book, run: |
| 47 | + |
| 48 | +```bash |
| 49 | +just serve-book |
| 50 | +``` |
| 51 | + |
| 52 | +This will build the book and serve it at `http://localhost:3000`. You can then navigate to the book in your web browser. |
| 53 | + |
| 54 | +## Just |
| 55 | + |
| 56 | +We use `just` as a task runner to automate common tasks. You can find the `justfile` in the root directory. Some common tasks include: |
| 57 | + |
| 58 | +- `just build`: Build all crates |
| 59 | +- `just test`: Run all tests |
| 60 | +- `just serve-book`: Build and serve the documentation book |
| 61 | +- `just clean`: Clean all build artifacts |
| 62 | +- `just fmt`: Format all code using `clang-format` |
| 63 | +- `just lint`: Run `clang-tidy` on all code |
| 64 | +- `just configure`: Configure all crates with CMake |
| 65 | +- `just`: Configure, build, and test all crates |
0 commit comments