This repository has been archived by the owner on Jul 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
WIDL NAN Command Line Options
Kenny Yuan edited this page Sep 11, 2016
·
1 revision
./node_modules/widl-nan/bin/widl-nan.js -h
Usage: widl-nan [options] [widl] [widl...]
Options:
-h, --help output usage information
-V, --version output the version number
-c, --clean cleanup generated files under `gen` directory
-d, --dest [dir] destination directory of generated C++ code
-i, --init init the directory to make it ready for node-gyp build
-o, --override allow override C++ implementation files (those generated files without the 'nan__' prefix)
A few explanations
- To build a Node.js addon, WIDL-NAN generate 3 sets of C++ files:
- Nan wrapper files: these files are named with
nan__
(2 underbars) prefix, the number of them depends on the number of interfaces defined in *.widl files. e.g. forinterface FooBar{};
the generated files would begen/nan__foo_bar.h
andgen/nan__foo_bar.cpp
- Implementation files: these files are name without
nan__
prefix, there name suggest which interface they're implementing. e.g. forinterface FooBar{};
the generated files would begen/dont-build/foo_bar.h
&gen/dont-build/foo_bar.cpp
. These files are only with skeletons that are supposed to be filled up by developers. If there is-i/--init
option specified, WIDL-NAN will copy these files undergen/dont-build/
into project root. - Helper files, e.g. to make it easy to use Promise/Array/Dictionary/etc., there are a few helpers generated.
- Nan wrapper files: these files are named with
-
binding.gyp
,addon.cpp
& implementation files are necessary fornode-gyp build/rebuild
, those files will be always generated ingen/dont-build/
directory, and will be copied to project root if there is-i/--init
option specified. The-i/--init
option is supposed to use only once in most cases. - When the interface defined in
*.widl
files are changed, WIDL-NAN will overwrite NAN wrapper files ingen/
directory andgen/dont-build/
directory. Developers are expected to manually merge the difference between old implementation files & new implementation files (the generated skeletons for implementation files are always generated ingen/dont-build
directory for developer's reference)