xo-umbrella2/xo-cmake
2026-10-04 12:22:33 -04:00
..
.github/workflows git subrepo clone git@github.com:Rconybea/xo-cmake.git xo-cmake 2026-06-06 21:19:03 -04:00
bin xo-cmake: generate python module #includes [HYGIENE] 2026-09-13 12:00:21 -04:00
cmake/xo_macros xo-cmake: defend vs bad headers in src mapping [BUILD] 2026-09-27 19:16:35 -04:00
docs/history/2026 git subrepo clone git@github.com:Rconybea/xo-cmake.git xo-cmake 2026-06-06 21:19:03 -04:00
etc/xo xo-cmake: + missing subsystem edges 2026-10-04 12:22:33 -04:00
share/xo-macros xo-cmake: reconfigure knows XO_ENABLE_SOURCE_MAP [FEATURE] 2026-09-27 23:47:57 -04:00
utest xo-cmake: defend vs bad headers in src mapping [BUILD] 2026-09-27 19:16:35 -04:00
.gitignore xo-cmake: gitignore python bytecode from the xo-loc utests [BUILD] 2026-08-03 00:41:18 -04:00
.gitrepo git subrepo push xo-cmake 2026-07-25 13:43:36 -04:00
CMakeLists.txt xo-cmake: per-subsystem types.json [META] 2026-09-27 17:50:02 -04:00
FAQ git subrepo clone git@github.com:Rconybea/xo-cmake.git xo-cmake 2026-06-06 21:19:03 -04:00
README.md xo-cmake: + xo-loc codesize visualizer [SDLC] [UX] 2026-08-03 10:50:37 -04:00

XO cmake modules

Collects cmake macros to be shared across XO projects (e.g. indentlog, reflect, kalman, ..)

Features

  • support for both manyrepo and monorepo projects
  • support for generating cmake xxxConfig.cmake files, so cmake find_package() works reliably
  • support for header-only libraries
  • support for pybind11 libraries
  • documentation generation using doxygen + breathe + sphinx
  • code coverage using ccov + lcov

Getting Started

copy repo

$ git clone https://github.com:rconybea/xo-cmake.git

configure + install

$ cd xo-cmake
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -B .build -S .   # ..or desired prefix
$ cmake --install .build

use from a cmake project

In some project foo:

$ cd foo
$ mkdir cmake
$ cp $PREFIX/share/xo-macros/xo-bootstrap-macros.cmake cmake/

xo-bootstrap-macros-cmake has two vital jobs:

  1. set XO_CMAKE_CONFIG_EXECUTABLE (locate xo-cmake-config)
  2. set CMAKE_MODULE_PATH (obtained from xo-cmake-config --cmake-module-path)

then in foo/CMakeLists.txt:

include(cmake/xo-bootstrap-macros.cmake)

xo_cxx_toplevel_options3()

Now as long as $PREFIX/bin is in PATH:

$ cd mybuild
$ cmake path/to/foo/source

or set XO_CMAKE_CONFIG_EXECUTABLE and CMAKE_MODULE_PATH

In some project foo:

$ cd mybuild
$ cmake -DXO_CMAKE_CONFIG_EXECUTABLE=xo-cmake-config -DCMAKE_MODULE_PATH=$(xo-cmake-config --cmake-module-path) path/to/foo/source

Tools

Installed to $PREFIX/bin.

xo-loc

Treemap of the xo subsystem world: one tile per subsystem, area proportional to lines of code, color by artifact kind. Sibling to xo-deps.

$ xo-loc                              # svg of the whole tree
$ xo-loc --format=html                # interactive: hover for numbers, click to focus
$ xo-loc --color=complexity           # shade Code tiles by complexity per kLOC
$ xo-loc --format=csv                 # the underlying table
$ xo-loc xo-gc xo-arena               # just these subsystems

Requires scc (>= 3.5.0) on PATH; the tree is counted live on every run, so there is no snapshot file to go stale. The walk always starts at the source root — found via --root, $XO_SOURCE_ROOT, git, then an upward search — so it works from any directory, and subsystem arguments filter the output rather than the walk.

By default the map shows hand-written code: vendored third-party code and generated code are excluded, and every exclusion is reported on stderr. Use --include-vendored and --include-generated to put them back.

Tiles are subdivided by kind only when each part is worth drawing: a kind must be at least 1/8 of its own subsystem, and the resulting rectangle must be big enough to label and not a splinter. Anything folded away is reported too.