CMake or gyp for node.js addon development
Asked Answered
F

2

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.

Fiddling answered 29/4, 2014 at 3:22 Comment(1)
Have a look at 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 runtimeEdraedrea
L
13

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.

Loxodromics answered 5/4, 2015 at 13:55 Comment(4)
I created a tutorial that shows how to use Qt Creator to create and debug CMake.js based native node addons: github.com/unbornchikken/cmake-js/wiki/…Loxodromics
Does it get integrated into a regular workflow (like integrating the addon as part of a regular cmake project)?Hawthorn
@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...Cleavage
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.Loxodromics
S
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.

Stakhanovism answered 29/4, 2014 at 3:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.