mapbox / mapbox/node-pre-gyp

Support for alternative build tools (node-cmake)

Open
#205 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.2k
Forks
271
Avg merge
23h 40m
Merged PRs (30d)
2

Description

In an effort to ditch the python dependency of node-gyp, we've been experimenting with node-cmake, which is a thin wrapper around cmake.

It's use is quite straightforward if you're already using CMake. We just added this:

https://github.com/mapbox/route-annotator/blob/b07d7751988419482b84e536ec84205543466c88/CMakeLists.txt#L44-L62

and we can build our .node binary with:

./node_modules/.bin/ncmake --build

After this is run, all the usual node-pre-gyp package, node-pre-gyp publish commands work as expected.

With a little bit of hackery, I added support for ncmake to node-pre-gyp build by providing an alternative to lib/util/compile.js that calls the appropriate ncmake commands instead of their node-gyp equivalents.

Would it make sense to support alternative build tools like this in node-pre-gyp on a larger scale? The publishing logic is well established and independent of the build tool.

An alternative might be to fork node-pre-gyp into node-pre-cmake.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading lib/util/compile.js and the linked CMakeLists.txt section, then compare the existing node-gyp build path with the ncmake commands described in the issue. Determine whether the requested scope is a general alternative-build-tool interface or support specifically for ncmake; done means the chosen approach builds successfully while preserving the existing packaging and publishing commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, javascript, nodejs
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.