shuriken/README.md

2.1 KiB

shuriken

A simplistic C++ build tool based on Ninja with first-class support for C++20 modules.

It's written in Python with minimal dependencies (so far only PyYAML) and as a single file, to allow for easy integration into a project and quick customizability if needed.

Design goals

First and foremost, the goal of this project is to have a simple C++ build script for my own personal projects. It is not designed as a general purpose build system, but specifically tailored to my own use cases.

That being said, feel free to use it in your own projects if it works for you, and tell me your feedback.

The main design goals are as follows:

  • Keep it simple by relying on conventions rather than supporting every possible use case.
  • Support C++20 modules for structuring code without header files, but without supporting every possible use case of modules.
  • Allow building for multiple targets (e.g. Linux, Windows, WebAssembly).
  • Allow overriding config values with a local override file instead of modifying the build config.
  • Autodetect source files instead of listing them all manually.

Requirements / conventions

Projects need to follow some rules to allow building them with shuriken.

  • All source code must be in a source directory (defaults to src, configurable with source_dir).
  • All build artifacts will be created in a build directory (defaults to build, configurable with build_dir) with subdirectories for each target (e.g. build/linux/).
  • C++ source files must use the extension .cppm if they define a module, .cpp otherwise.
  • Modules must be defined in source files using the same path and name as the module, replacing . with /. (For example, the module foo.bar.baz must be defined in src/foo/bar/baz.cppm.)
  • Modules can only be defined in one file. Splitting module interface and implementation is not supported.
  • Clang should be used as the compiler for the default target. While the compiler itself is configurable, the build dependency detection for modules uses clang-scan-deps. Other targets can use other compilers, since dependency detection is always done using the default target.