8

In most of tutorials, they use gyp as the building system for C++ node.js add-on development. However, compared to gyp, CMake has a long history and have much much more documentations.

Therefore, my question is that: which one is better for node.js C++ addon development?

Thank you.

Lin Z
  • 171
  • 2
  • 9
  • Have a look at https://www.npmjs.com/package/nan and dont try to develop your add-on from scartch as they are likely to become out of date with the nodejs runtime – Soren Dec 21 '16 at 17:06

2 Answers2

12

I've just made available my new module today: CMake.js to support CMake based Node.js and io.js native addon development. It works exactly like node-gyp, please take a look at the readme and to the tutorial, then decide what's better for you.

unbornchikken
  • 344
  • 2
  • 13
  • I created a tutorial that shows how to use Qt Creator to create and debug CMake.js based native node addons: https://github.com/unbornchikken/cmake-js/wiki/TUTORIAL-02-Creating-CMake.js-based-native-addons-with-QT-Creator – unbornchikken Apr 14 '15 at 18:39
  • Does it get integrated into a regular workflow (like integrating the addon as part of a regular cmake project)? – Gopalakrishna Palem Jan 07 '16 at 03:39
  • 1
    @GopalakrishnaPalem this is my main problem with Cmake.js. I want to ship my NodeJs binding of my massive CMake based C++ project. With CMake.js you seem to call the cmake.js script which will call your cmake binary with some variables populated for linking nan, etc. Really, a find or config module for cmake would prevent me from telling every user of my project to create project files with cmake.js... – benzeno Apr 19 '16 at 04:35
  • 2
    It was designed to cover the regular npm+nodegyp workflow, with an ability to use CMake based projects as dependencies and features of CMake itself. If you want to ship anything to a node guy, he will give a pile of stinking crop on your huge makefiles and install instructions. He would like to see an npm module which is an "npm install" away. That's CMake.js job. – unbornchikken Dec 19 '16 at 11:58
1

gyp is really the only one that is supported and is what almost everyone in the node community uses. Also, both v8 and node use it.

mscdex
  • 104,356
  • 15
  • 192
  • 153