bare-make
Reference for bare-make: an opinionated CMake-based build-system generator for Bare native addons, with a JS API and a CLI.
stable
bare-make is an opinionated build-system generator for Bare native addons. It drives CMake with Ninja and Clang for a consistent toolchain across platforms, while staying plain CMake underneath so you can eject. It ships both a JavaScript API and a CLI.
npm i -g bare-makeUsage
Builds happen in three steps—generate, build, install:
const make = require('bare-make')
await make.generate()
await make.build()
await make.install()Or from the command line:
bare-make generate
bare-make build
bare-make installAPI
await generate([options])
Generate the build system (the configure step).
| Option | Default | Description |
|---|---|---|
source | '.' | Path to the source tree |
build | 'build' | Path to the build tree |
platform | os.platform() | Target operating system platform |
arch | os.arch() | Target architecture |
simulator | false | Build for a simulator |
environment | Environment to build for | |
cache | true | Use the build variable cache |
preset | CMake preset to use | |
debug | Configure a debug build | |
sanitize | Enable a sanitizer | |
fuzz | Configure for fuzzing | |
withDebugSymbols | Release build with debug symbols | |
withMinimalSize | Release build with minimal size | |
define | Create or update a build variable cache entry | |
cwd | path.resolve('.') | Working directory |
verbose | false | Enable verbose output |
await build([options])
Compile the generated build system.
| Option | Default | Description |
|---|---|---|
build | 'build' | Path to the build tree |
target | Target to build | |
clean | false | Clean before building |
parallel | Number of parallel jobs | |
preset | CMake preset to use | |
cwd | path.resolve('.') | Working directory |
verbose | false | Enable verbose output |
await install([options])
Install the built artefacts.
| Option | Default | Description |
|---|---|---|
build | 'build' | Path to the build tree |
prefix | 'prebuilds' | Installation prefix |
component | Component to install | |
link | false | Link rather than copy files |
strip | false | Strip before installing |
parallel | Number of parallel jobs | |
cwd | path.resolve('.') | Working directory |
verbose | false | Enable verbose output |
await test([options])
Run tests for projects using CMake's enable_testing() / add_test(). Also available as bare-make test.
| Option | Default | Description |
|---|---|---|
build | 'build' | Path to the build tree |
timeout | 30 | Default test timeout in seconds |
parallel | Number of parallel jobs | |
preset | CMake preset to use | |
cwd | path.resolve('.') | Working directory |
verbose | false | Enable verbose output |
CLI
bare-make generate [flags]
--source|-s <path> Path to the source tree
--build|-b <path> Path to the build tree
--platform|-p <name> Target operating system platform
--arch|-a <name> Target architecture
--simulator Build for a simulator
--environment|-e <name> Environment to build for
--no-cache Disregard the build variable cache
--preset <name> CMake preset to use
--debug|-d Configure a debug build
--with-debug-symbols Release build with debug symbols
--with-minimal-size Release build with minimal size
--sanitize <name> Enable a sanitizer
--fuzz Configure for fuzzing
--define|-D <var>[:<type>]=<value> Create or update a build variable cache entry
--verbose Enable verbose output
--help|-h Show helpbare-make build [flags]
--build|-b <path> Path to the build tree
--target|-t <name> Target to build
--clean|-c Clean before building
--parallel|-j <number> Number of parallel jobs
--preset <name> CMake preset to use
--verbose Enable verbose output
--help|-h Show helpbare-make install [flags]
--build|-b <path> Path to the build tree
--prefix|-p <path> Installation prefix
--component|-c <name> Component to install
--link|-l Link rather than copy files
--strip|-s Strip before installing
--parallel|-j <number> Number of parallel jobs
--verbose Enable verbose output
--help|-h Show helpbare-make test [flags]
--build|-b <path> Path to the build tree
--timeout <seconds> Default test timeout
--parallel|-j <number> Number of parallel jobs
--preset <name> CMake preset to use
--verbose Enable verbose output
--help|-h Show helpRelated modules
Builds on bare-env, bare-fs, bare-os, bare-path, and bare-process.
See also
- Bundle a Bare app—where addon compilation fits in packaging.
bare-pack—bundles the compiled addons.- Bare modules—the full
bare-*catalog.