File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,18 @@ scripts/format.sh
6363It pins clang-format 18; a different major version formats differently and CI
6464will reject the result.
6565
66+ ## Compile-time limits
67+
68+ motionkit uses fixed-size storage to keep its core algorithms allocation-free.
69+ The following public limits are intentionally fixed and cannot currently be
70+ overridden through CMake:
71+
72+ | Constant | Defining header | Limit |
73+ | ---| ---| ---:|
74+ | ` kMaxPathKnots ` | ` motionkit/core/cartesian.hpp ` | 65 |
75+ | ` kMaxWaypoints ` | ` motionkit/core/cartesian.hpp ` | 16 |
76+ | ` kMaxObstacles ` | ` motionkit/core/collision.hpp ` | 32 |
77+
6678## Use it downstream
6779
6880``` cmake
Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ FetchContent_MakeAvailable(googletest)
1010
1111include (GoogleTest )
1212
13+ add_test (NAME readme_limits
14+ COMMAND ${CMAKE_COMMAND }
15+ -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
16+ -P ${CMAKE_CURRENT_SOURCE_DIR } /check_readme_limits.cmake )
17+ set_tests_properties (readme_limits PROPERTIES LABELS unit)
18+
1319add_executable (motionkit_tests
1420 test_vec3.cpp
1521 test_so3.cpp
Original file line number Diff line number Diff line change 1+ file (READ "${PROJECT_SOURCE_DIR } /README.md" readme )
2+
3+ function (check_limit name header )
4+ file (READ "${PROJECT_SOURCE_DIR } /include/${header} " declaration )
5+ string (REGEX MATCH "${name} = ([0-9]+)" match "${declaration} " )
6+ if (NOT match)
7+ message (FATAL_ERROR "Could not find ${name} in ${header} " )
8+ endif ()
9+ set (value "${CMAKE_MATCH_1} " )
10+ string (FIND "${readme} " "| `${name} ` | `${header} ` | ${value} |" documented)
11+ if (documented EQUAL -1)
12+ message (FATAL_ERROR
13+ "README limit for ${name} does not match ${header} (${value} )" )
14+ endif ()
15+ endfunction ()
16+
17+ check_limit (kMaxPathKnots motionkit/core/cartesian.hpp )
18+ check_limit (kMaxWaypoints motionkit/core/cartesian.hpp )
19+ check_limit (kMaxObstacles motionkit/core/collision.hpp )
You can’t perform that action at this time.
0 commit comments