Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node-gyp platform specific addon

Is it possible to specify that a certain native addon is only meant to be build for a certain platform (e.g: win32)?

Currently I have a C++ addon that makes use of the Windows API, but node-gyp attempts to build that for UNIX based systems as well.

I've been searching in node-gyp documentation and NodeJS C/C++ addon documentation section without any luck.

like image 458
jviotti Avatar asked Dec 30 '25 21:12

jviotti


1 Answers

Yes.

You can add an "os" section to your package.json to restrict which platforms your addon is compatible with.

Here is the OS package.json documentation.

like image 161
justin.m.chase Avatar answered Jan 01 '26 13:01

justin.m.chase