schematika arithmetic with facets + multi-argument runtime polymorphism
  • C++ 94.2%
  • CMake 5.8%
Find a file
2025-12-14 17:16:05 -05:00
.github/workflows github: + libbsd-dev dep 2025-09-04 00:09:28 -04:00
_static/img xo-umbrella: + docs support files 2025-06-22 16:19:21 -05:00
cmake initial commit 2025-11-17 22:28:31 -05:00
docs xo-alloc2 xo-object: bugfix + refactor -> IGCObject_DList builds 2025-12-14 13:52:29 -05:00
etc xo-imgui: + example ex4a. resize working on ubuntu (ex4 broken tho) 2025-11-10 16:50:26 -05:00
pkgs nix build: xo-jit: build+install docs+examples: xo-jit.nix ++ 2025-09-22 12:55:49 -04:00
xo-alloc xo-alloc2: work on fomo Arena 2025-12-11 11:14:46 -05:00
xo-alloc2 xo-alloc2: header reorg redux 2025-12-14 17:16:05 -05:00
xo-allocutil xo-object: spaceship operator for gp<T> + gp<String> 2025-12-06 14:16:34 -05:00
xo-callback tidy: minor doc improvements + String::share() with explicit mm 2025-11-15 14:04:56 -05:00
xo-cmake xo-facet: header impl + docs 2025-12-10 20:17:21 -05:00
xo-distribution Add 'xo-distribution/' from commit '036ca5d817' 2025-05-11 15:52:36 -05:00
xo-expression xo-interpreter: handle litersl strings. Broken memory model. 2025-11-29 20:19:33 -05:00
xo-facet xo-alloc2 xo-object: bugfix + refactor -> IGCObject_DList builds 2025-12-14 13:52:29 -05:00
xo-flatstring xo-flatstring: build: install examples if XO_ENABLE_EXAMPLES 2025-09-22 12:29:29 -04:00
xo-imgui xo-alloc + xo-allocutil: refactor to shrink dep surface area 2025-12-01 01:20:49 -05:00
xo-indentlog xo-ordinaltree: 3-way comparison scaffolding. wip 2025-12-06 10:56:10 -05:00
xo-interpreter xo-alloc + xo-allocutil: refactor to shrink dep surface area 2025-12-01 01:20:49 -05:00
xo-jit fix unit tests to build on osx / clang16 2025-12-03 00:14:09 -05:00
xo-kalmanfilter Add 'xo-kalmanfilter/' from commit '2ced8429c0' 2025-05-11 16:22:42 -05:00
xo-object xo-object: 3way String compare for clang 16. 2025-12-08 23:42:25 -05:00
xo-object2 xo-alloc2: header reorg redux 2025-12-14 17:16:05 -05:00
xo-ordinaltree + docs in xo-alloc2/ + misc improvements 2025-12-11 22:18:09 -05:00
xo-printjson Add 'xo-printjson/' from commit '6743b9ef18' 2025-05-11 14:58:48 -05:00
xo-process xo-process: prefer xo::bp spelling to xo::ref::brw 2025-07-05 13:53:46 -05:00
xo-pydistribution Add 'xo-pydistribution/' from commit 'a142a0044c' 2025-05-11 15:57:32 -05:00
xo-pyexpression xo-interpreter: add Primitive object, to expose builtin functions 2025-11-27 11:03:41 -05:00
xo-pyjit xo-interpreter: add Primitive object, to expose builtin functions 2025-11-27 11:03:41 -05:00
xo-pykalmanfilter Add 'xo-pykalmanfilter/' from commit 'a9daaa3278' 2025-05-11 16:27:01 -05:00
xo-pyprintjson Add 'xo-pyprintjson/' from commit '36797a419a' 2025-05-11 15:05:03 -05:00
xo-pyprocess Add 'xo-pyprocess/' from commit 'c4af12c625' 2025-05-11 16:19:35 -05:00
xo-pyreactor Add 'xo-pyreactor/' from commit '50b8d529a7' 2025-05-11 15:14:43 -05:00
xo-pyreflect Add 'xo-pyreflect/' from commit '54d11b31a5' 2025-05-10 21:04:13 -05:00
xo-pyrprintjson Add 'xo-pyrprintjson/' from commit '36797a419a' 2025-05-11 15:02:26 -05:00
xo-pysimulator Add 'xo-pysimulator/' from commit 'f940051411' 2025-05-11 16:06:48 -05:00
xo-pyunit Add 'xo-pyunit/' from commit '4d0e708ea4' 2025-05-11 00:58:27 -05:00
xo-pyutil Add 'xo-pyutil/' from commit 'a2cb8ae60f' 2025-05-10 19:38:21 -05:00
xo-pywebsock + xo-pywebsock 2025-05-11 15:27:53 -05:00
xo-pywebutil Add 'xo-pywebutil/' from commit '578b3d724a' 2025-05-11 14:55:44 -05:00
xo-randomgen xo-randomgen: build: install examples with XO_ENABLE_EXAMPLES 2025-09-22 12:30:00 -04:00
xo-ratio xo-interpreter adds + explict mm arg to ctors (retiring Object::mm) 2025-11-16 20:10:23 -05:00
xo-reactor xo-ordinaltree: refactor: split -> multiple .hpp files 2025-11-30 18:12:03 -05:00
xo-reader xo-interpreter: handle litersl strings. Broken memory model. 2025-11-29 20:19:33 -05:00
xo-refcnt xo-alloc / xo-refcnt: feature flags for easy tests. 2025-11-19 12:38:54 -05:00
xo-reflect xo-alloc / xo-ordinaltree: + concepts + allocator-aware 2025-12-03 15:36:59 -05:00
xo-reflectutil fix unit tests to build on osx / clang16 2025-12-03 00:14:09 -05:00
xo-simulator pretty printing -- copmlete for xo::ast::GeneralizedExpression 2025-07-19 11:47:03 -05:00
xo-statistics Add 'xo-statistics/' from commit 'ae49d8896a' 2025-05-11 15:42:06 -05:00
xo-subsys Add 'xo-subsys/' from commit '57eee82fa5' 2025-05-10 18:38:12 -05:00
xo-symboltable Add 'xo-symboltable/' from commit '442d24805d' 2025-11-18 06:47:17 -05:00
xo-tokenizer xo-interpreter: apply expressions + llvm builtins working! 2025-11-28 19:32:56 -05:00
xo-unit xo-unit: bugfix: need ppdetail_atomic guard 2025-09-22 21:12:13 -04:00
xo-websock use xo::bp instead of xo::ref::brw 2025-07-05 13:55:00 -05:00
xo-webutil Add 'xo-webutil/' from commit '8e75838950' 2025-05-11 14:48:17 -05:00
.gitignore + .gitignore 2025-05-10 12:17:19 -05:00
CMakeLists.txt xo-alloc2: shallow_copy api + bugfixes [WIP] 2025-12-14 11:30:12 -05:00
conf.py + docs in xo-alloc2/ + misc improvements 2025-12-11 22:18:09 -05:00
default.nix xo-alloc2: streamlining + bugfixes [wip] 2025-12-12 19:44:38 -05:00
Doxyfile.in xo-umbrella: + docs support files 2025-06-22 16:19:21 -05:00
index.rst + docs in xo-alloc2/ + misc improvements 2025-12-11 22:18:09 -05:00
LICENSE + docs in xo-alloc2/ + misc improvements 2025-12-11 22:18:09 -05:00
README.md initial commit 2025-12-13 22:12:49 -05:00

Introduction

Local nix build for xo libraries. Intended for local development work, with source in immediate subdirectories.

Features

  • native c++
  • deterministic simulation
  • reflection
  • python bindings

Getting Started

(Alternatively, see xo-umbrella2/docs/install.rst for similar content)

Nix shell (reproducible development environment)

If nix is available, can get several reproducible build environments.

Pick one for a session:

$ cd xo-umbrella2
$ nix-shell -A shell0  # just nix stdenv: make,gcc,bash etc.
$ nix-shell -A shell1  # stable environment
$ nix-shell -A shell2  # stable environment + emacs + lsp
$ nix-shell -A shell3  # stable environment + emacs + lsp + xorg/opengl/vulkan/imgui stack (wsl2-only)
$ nix-shell -A shell4  # wsl2-specific. like shell3, vkcube works (at least on WSL)
$ nix-shell -A shell5  # wsl2-specific. uses dxg driver for "hardware acceleration"
$ nix-shell -A shell   # (deprecated) bleeding edge environment

Run emacs (for example) from within chosen seesion. We need this ordering because nix-shell determines vital details like location of shared libraries, including libraries used by running IDE.

$ emacs

Can use nix-shell to get reproducible environment for cmake build, see Cmake Build. Alternatively can use full nix build, see Nix Build

Cmake build

If nix is available, you probably prefer the nix build, unless working on XO itself. Otherwise continue reading..

The cmake build has two phases, because it needs to bootstrap generated xo-cmake-config, xo-build helpers.

$ cd xo
$ PREFIX=/path/to/say/usr/local
# phase 1
$ cmake -B .build0 -S xo-cmake -DCMAKE_INSTALL_PREFIX=${PREFIX}
$ cmake --build .build0
$ cmake --install .build0
# phase 2
$ cmake -B .build -S . -DCMAKE_INSTALL_PREFIX=${PREFIX} -DXO_ENABLE_EXAMPLES=1 -DXO_ENABLE_DOCS=1 -DCMAKE_BUILD_TYPE=debug
$ cmake --build .build --verbose
$ cmake --install .build

or with Vulkan examples

# at start of phase 2
$ cmake -B .build -S . -DCMAKE_INSTALL_PREFIX=${PREFIX} -DXO_ENABLE_EXAMPLES=1 -DXO_ENABLE_VULKAN=1

Cmake build documentation

Documentation relies on doxygen, sphinx and breathe.

# phase 2
$ cd xo-umbrella2
$ cmake -B .build -S . -DXO_ENABLE_DOCS=1
$ cmake --build .build -- docs

Create Html docs in .build/sphinx/html/index.html

Cmake build with coverage

Prepare build

# phase 2
$ cmake -B .build -S . -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_BUILD_TYPE=coverage

Run coverage-enabled unit tests

$ (cd .build && ctest)

Generate coverage report

$ .build/gen-ccov

Html report left in .build/ccov/html/index.html

Nix Build

Nix build uses toplevel default.nix, along with top-level pkgs/xo-foo.nix for each subproject foo. It doesn't interact with toplevel CMakeLists.txt.

$ nix-build -A xo-userenv

This builds all xo subprojects, assembles sandbox under ./result.

$ tree -L 1 ./result
./result
├── bin
│   ├── xo-build
│   ├── xo-cmake-config
│   └── xo-cmake-lcov-harness
└── share
    ├── cmake
    │   └── xo_macros
    │       ├── code-coverage.cmake
    │       ├── xo-project-macros.cmake
    │       └── xo_cxx.cmake
    ├── etc
    │   └── xo
    │       └── subsystem-list
    └── xo-macros
        ├── Doxyfile.in
        ├── gen-ccov.in
        └── xo-bootstrap-macros.cmake

For completeness' sake: can also use

$ nix-build -A xo-userenv-slow

Same result as $nix-build -A xo-userenv, but builds each package serially using xo-build.

Nix + SDL2 + Vulkan + ImGui

Currently (Nov 2025) only affects xo-umbrella2/xo-imgui.

For OSX, imgui works with assistance from motlenvk. Build xo-imgui with

$ cd xo-umbrella2
$ nix-shell -A shell4-osx   # see xo-umrbella2/default.nix for impl

For linux and/or wsl build need extra care:

  1. must use host OS for gpu drivers. nixpkgs has drivers, but they're setup to work from nixos.
  2. want to use nixpkgs for the GPU-independent portion of graphics stack.

Complication because host gpu drivers in a "big swimming pool" such as /usr/lib/x86_64-linux-gnu/ that contains both libraries that must come from host OS (e.g. libGLX_nvidia) and libraries that must come from nixpkgs (e.g. libc)

Finesse by introducing a directory-of-symlinks, see xo-umbrella2/etc/{hostegl, hostubuntu}. These currently setup by hand, so likely to need manual attention on another host.

An ordinary cmake build may cheerfully use the host-provided graphics stack, in return for higher risk of DLL hell.

To build for ubuntu with nvidia gpu:

$ cd xo-umbrella2
$ nix-shell -A shell4-nvidia
# then regular cmake:
$ cmake -B .build -S . -DXO_ENABLE_VULKAN=1 -DXO_ENABLE_EXAMPLES=1 -DCMAKE_INSTALL_PREFIX=$PREFIX

To build for wsl:

$ cd xo-umbrella2
$ nix-shell -A shell4-wsl
# then regular cmake:
$ cmake -B .build -S . -DXO_ENABLE_VULKAN=1 -DXO_ENABLE_EXAMPLES=1 -DCMAKE_INSTALL_PREFIX=$PREFIX

Currently not supporting a nix sandbox build for xo-imgui

Directory Layout

(not in alphabetical order)

xo-umbrella2/
|
+- CMakeLists.txt                 top-level cmake config
+- cmake
|  \- xo-bootstrap-macros.cmake   configure xo cmake support for build
+- compile_commands.json          symlink to path/to/build/compile_commands.json for LSP
|
+- conf.py                        sphinx config for project documentation
+- index.rst                      root of xo-umbrella2 doc tree
+- Doxyfile.in                    doxygen config template; cmake will prepare Doxyfile in build dir
+- _static/                       static inputs to sphinx
|
+- etc
|  +- hostegl/                    sample video driver symlinks for WSL2
|  \- hostubuntu/                 sample video driver symlinks for ubuntu
|
+- default.nix                    top-level nix build (works w/ stock nixpkgs 25.05)
+- pkgs/                          per-satellite nix builds. see xo-umbrella2/default.nix
|  +- xo-callback.nix             nix build for xo-umbrella2/xo-callback
|  ..etc..
|  \- xo-webutil.nix
|
+- xo-alloc/                      xo-alloc subproject. independent git repo, using git subtree
+- xo-alloc2/                     xo-alloc2 subproject.
..etc..
\- xo-webutil/

To view docs from WSL

  1. find wsl IP address
$ hostname -I
  1. run nix build
$ nix-build -A xo-userenv
  1. serve docs from some available port
$ (cd result && python3 -m http.server 3000)
  1. browse to ":3000/share/doc/xo-flatstring/html" from windows

To add a new satellite repo

  1. check clone in clean state (all local changes committed or unwound)

  2. add satellite as remote

$ git remote add xo-foo git@github.com:Rconybea/xo-foo.git
$ git fetch xo-foo main
  1. checkout satellite repo
$ git subtree add --prefix=xo-foo xo-foo main