Skip to content
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

N-API Improvements #405

Merged
merged 6 commits into from
Aug 12, 2018
Merged

N-API Improvements #405

merged 6 commits into from
Aug 12, 2018

Conversation

jschlight
Copy link
Contributor

This pull request implements a number of improvements to the node-pre-gyp N-API support for issue #402.

N-API builds for only those N-API versions supported by the Node instance

node-pre-gyp now verifies the N-API build versions being requested and builds only those versions supported by current Node instance. If no version can be built, an error message is generated.

New --build-latest-napi-version-only build argument

A new --build-latest-napi-version-only build argument instructs node-pre-gyp to build only the highest N-API version supported by the Node instance. This is useful in CI and test environments where only the most current N-API build is needed.

Support for NAN and N-API builds from the same project

This PR introduces the ability to build both N-API and NAN binaries from the same package.

Placing the configuration value {node_napi_label} in the package.json binary.package_name property instructs node-pre-gyp to build all viable N-API binaries supported by the current Node instance. If the current Node instance does not support N-API, node-pre-gyp will request a traditional, non-N-API build.

The configuration value {node_napi_label} is set by node-pre-gyp to the type of build created. For N-API builds, the string contains the N-API version with values like napi-v3. For traditional, non-N-API builds, the string contains the ABI version with values like node-v46.

The C/C++ symbol NAPI_VERSION can be used to distinguish N-API and non-N-API builds.

There are more details in the updated main README.md file.

Build support for Node 4

This PR fixes a JavaScript language issue that was preventing builds against some versions of Node 4.

Better recovery from build errors

A configure is no longer required in the case where a build fails.

NAPI_VERSION replaces NAPI_BUILD_VERSION

Previously, the documentation recommended defining the C/C++ symbol NAPI_BUILD_VERSION. The documentation now recommends the symbol NAPI_VERSION which is used by the N-API C/C++ headers to define the API for that specific N-API version.

Build failures no longer require a configure, wnairings for N-API versions not being built, code cleanup, README.md updated.
@springmeyer springmeyer added this to the v0.10.3 milestone Aug 12, 2018
@springmeyer
Copy link
Contributor

Thank you @jschlight

@springmeyer springmeyer merged commit 674fda7 into mapbox:master Aug 12, 2018
@jschlight jschlight deleted the napi-improvements branch August 14, 2018 17:51
hyj1991 pushed a commit to X-Profiler/node-pre-gyp that referenced this pull request Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants