Skip to content

Commit bc05c64

Browse files
committed
Add an experimental AGENTS.md file
1 parent 542dfd7 commit bc05c64

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
## Build, Lint, Test, and Run Commands
6+
7+
### Build Commands
8+
1. **Using CMake directly**:
9+
- Configure:
10+
```bash
11+
cmake -S <path to cml-root> -G{generator name} -DBUILD_TESTING=On -DCMAKE_BUILD_TYPE=Release
12+
```
13+
- Build:
14+
```bash
15+
cmake --build . --config Release
16+
```
17+
- Parallel Build (e.g., 4 threads):
18+
```bash
19+
cmake --build . --config Release -- -j4
20+
```
21+
22+
2. **Using CMake Presets**:
23+
- List available presets:
24+
```bash
25+
cmake --list-presets=all
26+
```
27+
- Example preset-based build:
28+
```bash
29+
cmake --preset=windows-ninja-clangcl-mt-s-vcpkg
30+
cmake --build --preset=windows-ninja-clangcl-mt-s-vcpkg-release
31+
```
32+
33+
### Test Commands
34+
1. **Run all tests**:
35+
```bash
36+
ctest -C Release
37+
```
38+
2. **Parallel Test Execution**:
39+
```bash
40+
ctest -C Release -j4
41+
```
42+
43+
### Lint Commands
44+
No explicit linting commands were found in the analyzed files.
45+
46+
### Run Commands
47+
The project appears to be a library (header-only), so there are no explicit "run" commands for an application. However, the tests and timing executables can be run as described above.
48+
49+
## Code Style Guidelines
50+
1. **Formatting**:
51+
- **Column Limit**: 80 characters.
52+
- **Indentation**: 2 spaces, no tabs.
53+
- **Line Endings**: LF (Unix-style).
54+
- **Insert Newline at EOF**: Enabled.
55+
56+
2. **Braces**:
57+
- **After Class/Struct/Enum/Function**: Always place braces on a new line.
58+
- **Control Statements**: No braces for single-line statements.
59+
60+
3. **Alignment**:
61+
- **Trailing Comments**: Aligned.
62+
- **Operands**: No alignment.
63+
- **Pointer Alignment**: Left-aligned (`int* ptr`).
64+
65+
4. **Spaces**:
66+
- **Before Parentheses**: None (e.g., `if(condition)`).
67+
- **Around Operators**: Space before assignment operators.
68+
- **In Empty Blocks/Parentheses**: None.
69+
70+
5. **Includes**:
71+
- **Sorting**: Disabled.
72+
- **Blocks**: Preserve original order.
73+
74+
6. **Miscellaneous**:
75+
- **Short Functions**: Inline only.
76+
- **Short If Statements**: Allowed on a single line.
77+
- **Namespace Indentation**: None.
78+
- **Header Include Guards**: Use `#pragma once` only, never `#ifdef/#endif` guards.
79+
80+
7. **New Files**:
81+
- **File Naming**: Use descriptive names that reflect the content of the file.
82+
- **File Extension for C++**: `.cpp`, `.h`, `.inl`, `.tpp`, `.hpp`.
83+
- **File header**: Use the default file header for all new files.
84+
85+
8. **Comments**:
86+
- **C++ Comment Style**: Use C comment delimiters for C++ files.
87+
- **Short Comments**: Allowed on a single line if they are short.
88+
- **Long Comments**: Aligned at the beginning of the block.
89+
90+
91+
### Standard File Headers by Language
92+
1. C++:
93+
```cpp
94+
/*-------------------------------------------------------------------------
95+
@@COPYRIGHT@@
96+
*-----------------------------------------------------------------------*/
97+
```
98+
99+
2. Python
100+
```python
101+
#*-------------------------------------------------------------------------
102+
# @@COPYRIGHT@@
103+
#*-------------------------------------------------------------------------
104+
```
105+
106+
## Core Architecture and Components
107+
1. **Vectors (`cml/vector/`)**:
108+
- Provides various vector types (e.g., fixed, dynamic, external).
109+
- Includes operations like dot product, cross product, and normalization.
110+
- Supports expression templates for efficient computation.
111+
112+
2. **Matrices (`cml/matrix/`)**:
113+
- Implements matrix types and operations (e.g., inversion, transformation).
114+
- Includes support for fixed and dynamic sizes.
115+
- Provides utilities for matrix concatenation and basis generation.
116+
117+
3. **Quaternions (`cml/quaternion/`)**:
118+
- Encapsulates quaternion operations for rotations and transformations.
119+
- Includes scalar and vector operations on quaternions.
120+
- Provides utilities for normalization, inversion, and logarithmic operations.
121+
122+
4. **Storage (`cml/storage/`)**:
123+
- Defines storage strategies for vectors, matrices, and quaternions.
124+
- Includes dynamic, fixed, and external storage types.
125+
- Provides utilities for resizing and reshaping storage.
126+
127+
5. **Utilities (`cml/util/`)**:
128+
- Contains helper functions for printing and hashing.
129+
- Includes mathematical utilities for field-of-view conversions and more.
130+
131+
6. **Testing (`tests/`)**:
132+
- Organized into subdirectories for each core component (e.g., `vector`, `matrix`, `quaternion`).
133+
- Uses Catch2 for unit testing.
134+
- Includes timing tests for performance evaluation.
135+
136+
## Testing Setup
137+
1. **Framework**:
138+
- The project uses **Catch2** for unit testing.
139+
- The main entry point for tests is defined in [`tests/main/catch_main.cpp`](tests/main/catch_main.cpp:11), which initializes the Catch2 session.
140+
141+
2. **Test Organization**:
142+
- Tests are organized into subdirectories under `tests/`, corresponding to the core components.
143+
144+
3. **Test Execution**:
145+
- Build the tests:
146+
```bash
147+
cmake --build . --config Release
148+
```
149+
- Run the tests:
150+
```bash
151+
ctest -C Release
152+
```
153+
154+
4. **Timing Tests**:
155+
- Timing tests are conditionally included if `BUILD_TIMING` is enabled in the CMake configuration.
156+
- These tests are located in the `tests/timing/` directory.

0 commit comments

Comments
 (0)