LogoPear Docs
ReferencesBareModules

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-make

Usage

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 install

API

await generate([options])

Generate the build system (the configure step).

OptionDefaultDescription
source'.'Path to the source tree
build'build'Path to the build tree
platformos.platform()Target operating system platform
archos.arch()Target architecture
simulatorfalseBuild for a simulator
environmentEnvironment to build for
cachetrueUse the build variable cache
presetCMake preset to use
debugConfigure a debug build
sanitizeEnable a sanitizer
fuzzConfigure for fuzzing
withDebugSymbolsRelease build with debug symbols
withMinimalSizeRelease build with minimal size
defineCreate or update a build variable cache entry
cwdpath.resolve('.')Working directory
verbosefalseEnable verbose output

await build([options])

Compile the generated build system.

OptionDefaultDescription
build'build'Path to the build tree
targetTarget to build
cleanfalseClean before building
parallelNumber of parallel jobs
presetCMake preset to use
cwdpath.resolve('.')Working directory
verbosefalseEnable verbose output

await install([options])

Install the built artefacts.

OptionDefaultDescription
build'build'Path to the build tree
prefix'prebuilds'Installation prefix
componentComponent to install
linkfalseLink rather than copy files
stripfalseStrip before installing
parallelNumber of parallel jobs
cwdpath.resolve('.')Working directory
verbosefalseEnable verbose output

await test([options])

Run tests for projects using CMake's enable_testing() / add_test(). Also available as bare-make test.

OptionDefaultDescription
build'build'Path to the build tree
timeout30Default test timeout in seconds
parallelNumber of parallel jobs
presetCMake preset to use
cwdpath.resolve('.')Working directory
verbosefalseEnable 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 help

bare-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 help

bare-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 help

bare-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 help

Builds on bare-env, bare-fs, bare-os, bare-path, and bare-process.

See also

On this page