-
-
Notifications
You must be signed in to change notification settings - Fork 483
Include-path-juggle node_api.h instead of napi.h (#41) #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
``` | ||
|
||
2. Reference this package's include directory and gyp file in `binding.gyp`: | ||
```gyp | ||
'include_dirs': ["<!(node -p \"require('node-addon-api').include\")"], | ||
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the @
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It indicates that the output of the command is to be used to fill out an array. In this case, it uses the double quotes I add in index.js to correctly split the output into array elements, stripping the quotes, so the paths are not misinterpreted.
README.md
Outdated
@@ -16,13 +16,13 @@ To use N-API in a native module: | |||
1. Add a dependency on this package to `package.json`: | |||
```json | |||
"dependencies": { | |||
"node-addon-api": "github:nodejs/node-addon-api", | |||
"node-addon-api": "github:nodejs/node-api", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting this repo would actually get renamed to node-addon-api
. @mhdawson what do you think?
Instead of making the path from which napi.h is included conditional upon the Node.js version, make the path of node_api.h thusly conditional. This way, no additional modification needs to be made to a dependent's binding.gyp in order to add the EXTERNAL_NAPI preprocessor directive when the C++ wrappers are not used. By this mechanism the C++ wrapper napi.h will also refer to the correct version of node_api.h. Fixes #41
@jasongin the PR no longer changes the README.md example showing how to depend on the repo. |
@gabrielschulhof I published |
Instead of making the path from which napi.h is included conditional
upon the Node.js version, make the path of node_api.h thusly
conditional. This way, no additional modification needs to be made to a
dependent's binding.gyp in order to add the EXTERNAL_NAPI preprocessor
directive when the C++ wrappers are not used.
By this mechanism the C++ wrapper napi.h will also refer to the correct
version of node_api.h.
Fixes #40Fixes #41