question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for alternative build tools (node-cmake)

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
TheMarexcommented, Jan 17, 2017

Current work-a-round we use in node-osrm for this is adding the following to the package.json:

{
  "scripts": {
    "preinstall": "npm install node-pre-gyp",
    "install": "node-pre-gyp install --fallback-to-build=false || make"
  }
}

That way we defer to the makefile in case we need to actually compile code and run our own cmake based toolchain.

0reactions
markandruscommented, Dec 30, 2017

@danpat would you consider sharing your changes to lib/util/compile.js? I am also preferring node-cmake these days (in part, due to CLion’s nice CMake support).

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMake.js - Welcome to the Node-API Resource
CMake.js is good build tool alternative to node-gyp. CMake.js is based on the CMake tool which must be installed. Pros.
Read more >
node-cmake - npm
CMake, like gyp, is a meta-build system, generating build files for the actual build tools and IDEs on each platform.
Read more >
CMake.js · The Node-API Resource - GitHub Pages
CMake.js is good build tool alternative to node-gyp. CMake.js is based on the CMake tool which must be installed. Pros Uses the CMake...
Read more >
Master Index CMake 2.8.12
CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a ...
Read more >
Building Modern Native Add-ons for Node.js in 2020 - Medium
js build tool is an attractive alternative for building Node.js native add-ons. We have recently added an example of an add-on built using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found