After our real world experiences, I have decided to make numerous adjustments and improvements
Default to node-addon-api instead of nan
nan or in general the native node API may lead to subtle ABI issues and should be avoided (propose to officially discourage it)
Using N-API or node-addon-api solves this issue, because N-API or Node-API is an ABIs-stable C-API
Rename undocumented per-configuration option cmakeOptions to CMakeOptions (to match official name typing and globalCMakeOptions) and document it
Add name property to configurations and allow building specific configs via named-configs
Add dev property to configurations and allow building a dev config via dev-os-only
Add new build modes
named-configs only builds configs with matching name (multiple names may be specified)
dev-os-only builds the first config that has dev == true and os matches the current OS
Allow specify a subdirectory for the build per configuration via addonSubdirectory if you build addons for multiple architectures in high performance scenarios, you can put the addon inside another subdirectory (i.e. addonSubdirectory = avx2-generic => build/linux/x64/electron/97/addon.node becomes build/linux/x64/electron/97/avx2-generic/addon.node)
After our real world experiences, I have decided to make numerous adjustments and improvements
node-addon-api
instead ofnan
nan
or in general the native node API may lead to subtle ABI issues and should be avoided (propose to officially discourage it)N-API
ornode-addon-api
solves this issue, becauseN-API
orNode-API
is an ABIs-stable C-APIcmakeOptions
toCMakeOptions
(to match official name typing andglobalCMakeOptions
) and document itname
property to configurations and allow building specific configs vianamed-configs
dev
property to configurations and allow building a dev config viadev-os-only
named-configs
only builds configs with matching name (multiple names may be specified)dev-os-only
builds the first config that hasdev == true
andos
matches the current OSaddonSubdirectory
if you build addons for multiple architectures in high performance scenarios, you can put the addon inside another subdirectory (i.e.addonSubdirectory = avx2-generic
=>build/linux/x64/electron/97/addon.node
becomesbuild/linux/x64/electron/97/avx2-generic/addon.node
)