Skip to content

A collection of headers containing useful tools and gadgets for building C++ programs

License

Notifications You must be signed in to change notification settings

bad-alloc-heavy-industries/substrate

substrate

GitHub Actions codecov Coverity Status Contributor Covenant

Supported platforms, language versions, and compilers

Platform C++ Standard Compiler
G++ Clang
7 8 9 10 11 9 10 11 12 13 14 15
Linux C++ 11 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
C++ 14 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
C++ 17 ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
C++ 20 ✔️ ✔️
NetBSD C++ 11 ✔️
C++ 14 ✔️
C++ 17 ✔️
Platform C++ Standard Compiler
G++ Apple Clang
7 8 9 10 11 10.15 11.6
macOS C++ 11 ✔️ (1) ✔️ (1) ✔️ ✔️ ✔️ ✔️ ✔️
C++ 14 ✔️ (1) ✔️ (1) ✔️ ✔️ ✔️ ✔️ ✔️
C++ 17 ✔️ (1) (2) ✔️ (1) (2) ✔️ ✔️ ✔️ ✔️ ✔️
C++ 20 ✔️

(1): Programs built on Big Sur may crash on exception handle: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98805 (2): Using fd constructors based on std::filesystem::path or the command_line module requires C++17, a minimum target OS of macOS 10.15, iOS/tvOS 13, or watchOS 6, and (if using GCC) GCC 9 or higher. The build system will detect this automatically.

Platform C++ Standard Compiler
MSYS G++ MSYS Clang MSVC
mingw64 ucrt64 clang64 16.11 17.0
Windows C++ 11 ✔️ ✔️ ✔️ N/A
C++ 14 ✔️ ✔️ ✔️ ✔️ ✔️
C++ 17 ✔️ ✔️ ✔️ ✔️ ✔️
C++ 20 ✔️ ✔️ ✔️ ✔️

Getting Started

There are two ways to use this library: installation and embedding.

Installing substrate

To install substrate, it really is as simple as:

meson setup build
meson install -C build

Though, if you want to install to a specific location such as /usr, then you might want to specify --prefix=/usr to meson during the meson setup step.

Embedding substrate

To embed substrate, add the project as a submodule to your project, then set up your build system to view the 'substrate' folder in this repo as part of your compiler's include path.

Using meson this is acomplished by declaring a subproject dependency and grab the dependency with:

substrate = subproject(
  'substrate',
).get_variable(
  'substrate_dep'
)

To be included in your root meson.build. You would then specify substrate as a dependency of any library or executable using the library.

Variables defined by the Meson dependency object

The Meson dependency object defines the following variables you can access with substrate.get_variable():

  • compile_args: Compiler arguments required to build against the library if building custom compiler invocations
  • link_args: Linker arguments required to build against the library if build custom linker invocations
  • command_line_enabled: Set to 'true' if the command line parser is enabled in a build, 'false' otherwise

There are two dependency objects available from the Meson subproject. These are designed for cross-compilation, with the 'substrate_dep' providing a dependency for the target system, and substrateNative_dep providing a dependency for the build host system.