Build is an opinionated c++ build-tool. It uses git and node.js. It's made
for use with the datcxx project.
C++ build tools and package managers are highly ambitious and try to solve a larger set of problems than needed for this project. Let's make something that...
- Uses a subset of
package.json. - No semver, or package-locks, use git commit hashes.
- No login, no users, no analytics, no fancy features.
npm install -g datcxx/buildAll projects must have a package.json.
build -hUse the init command to automatically create a package.json file.
build initUse the add command to add a dependency.
build add foo/barAdding a dependency with a hash will lock the dependency and install that exact commit at install-time. Without a hash, the dependency will get assigned the latest commit hash of the remote at install-time.
build add foo/bar ceda12fUse the i command to recursively install dependencies.
build iTo build your project, don't specify any commands just type build. Use the
DEBUG=true environment variable if you want to print what the compiler is
being asked to do.
buildWhen no command is specified, all flags are passed to the compiler. For example following flags are sent to the compiler.
build -g -O0Name is required. But unlike npm the name and version do not create a unique identity in the world for your package. In fact, version is not used at all.
Put a description in it. It’s a string. This helps you remember what the package does.
A list of files to include. Nothing is included by default. Does not currently support globs.
A string that specifies the place where the code lives. This is helpful for people who want to contribute.
The “scripts” property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point. The following scripts are supported.
installRun AFTER the package is installed.testRun by the npm test command.
You can also create your own arbitrary scripts and run them with the command
build run <script-name>.
{
"name": "hypercore",
"description": "Hypercore is a secure, distributed append-only log.",
"repository": "git@github.com:datcxx/cxx-hypercore.git",
"dependencies": {
"git@github.com:datcxx/cxx-flat-tree": "c051eac4"
},
"scripts": {
"test": "c++ -std=c++2a test/index.cxx lib/hypercore.so -o test/index && ./test/index",
"greeting": "echo Hello, World"
},
"flags": [
"-shared",
"-o ./lib/hypercore.so",
"-std=c++2a",
"-ferror-limit=2"
],
"files": [
"index.hxx",
"index.cxx"
]
}Nice to have - as of now there is no caching strategy.