Update info
This commit is contained in:
parent
eafb17d791
commit
5d4708dfdf
|
@ -82,11 +82,11 @@
|
||||||
"no-console": [0],
|
"no-console": [0],
|
||||||
"node/no-unsupported-features/es-builtins": [
|
"node/no-unsupported-features/es-builtins": [
|
||||||
"error",
|
"error",
|
||||||
{ "version": ">=16.17.0" }
|
{ "version": ">=18.12.1" }
|
||||||
],
|
],
|
||||||
"node/no-unsupported-features/node-builtins": [
|
"node/no-unsupported-features/node-builtins": [
|
||||||
"error",
|
"error",
|
||||||
{ "version": ">=16.17.0" }
|
{ "version": ">=18.12.1" }
|
||||||
],
|
],
|
||||||
"func-names": [
|
"func-names": [
|
||||||
"error",
|
"error",
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/**",
|
"${workspaceFolder}/**",
|
||||||
"${LocalAppData}/node-gyp/Cache/16.17.0/include/node"
|
"${LocalAppData}/node-gyp/Cache/16.17.0/include/node",
|
||||||
|
"${LocalAppData}/node-gyp/Cache/18.12.1/include/node"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"UNICODE",
|
"UNICODE",
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
This is a part of [Node3D](https://github.com/node-3d) project.
|
This is a part of [Node3D](https://github.com/node-3d) project.
|
||||||
|
|
||||||
[![NPM Package][npm]][npm-url]
|
[](https://badge.fury.io/js/addon-tools-raub)
|
||||||
[](https://www.npmjs.com/package/addon-tools-raub)
|
|
||||||
[](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
|
[](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -22,7 +22,7 @@ require('addon-tools-raub').include // a string
|
||||||
### Helpers in **addon-tools.hpp**:
|
### Helpers in **addon-tools.hpp**:
|
||||||
|
|
||||||
Usually all the helpers work within the context of a method. In this case we
|
Usually all the helpers work within the context of a method. In this case we
|
||||||
have `CallbackInfo info` passed as an argument. And we can return `undefined`
|
have `Napi::CallbackInfo info` passed as an argument. And we can return `undefined`
|
||||||
in case a problem has occured. So most of these macros are only usable
|
in case a problem has occured. So most of these macros are only usable
|
||||||
within `Napi::Value`-returning functions.
|
within `Napi::Value`-returning functions.
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ within `Napi::Value`-returning functions.
|
||||||
* `RET_NUM(VAL)` - return `Napi::Number`, expected `VAL` is of numeric type.
|
* `RET_NUM(VAL)` - return `Napi::Number`, expected `VAL` is of numeric type.
|
||||||
* `RET_EXT(VAL)` - return `Napi::External`, expected `VAL` is a pointer.
|
* `RET_EXT(VAL)` - return `Napi::External`, expected `VAL` is a pointer.
|
||||||
* `RET_BOOL(VAL)` - return `Napi::Boolean`, expected `VAL` is convertible to bool.
|
* `RET_BOOL(VAL)` - return `Napi::Boolean`, expected `VAL` is convertible to bool.
|
||||||
|
* `RET_ARRAY_STR(VAL)` - return `Napi::Array`, expected `VAL` is `std::vector<std::string>`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
@ -150,6 +151,7 @@ That extrapolates well to all the helpers below:
|
||||||
| `REQ_ARRAY_ARG` | `object` | `Napi::Array` | - |
|
| `REQ_ARRAY_ARG` | `object` | `Napi::Array` | - |
|
||||||
| `USE_ARRAY_ARG` | `object` | `Napi::Array` | - |
|
| `USE_ARRAY_ARG` | `object` | `Napi::Array` | - |
|
||||||
| `LET_ARRAY_ARG` | `object` | `Napi::Array` | `[]` |
|
| `LET_ARRAY_ARG` | `object` | `Napi::Array` | `[]` |
|
||||||
|
| `LET_ARRAY_STR_ARG` | `object` | `std::vector<std::string>` | `std::vector<std::string>()` |
|
||||||
| `REQ_FUN_ARG` | `function` | `Napi::Function` | - |
|
| `REQ_FUN_ARG` | `function` | `Napi::Function` | - |
|
||||||
| `REQ_ARRV_ARG` | `ArrayBuffer` | `Napi::ArrayBuffer` | - |
|
| `REQ_ARRV_ARG` | `ArrayBuffer` | `Napi::ArrayBuffer` | - |
|
||||||
| `REQ_BUF_ARG` | `Buffer` | `Napi::Buffer<uint8_t>` | - |
|
| `REQ_BUF_ARG` | `Buffer` | `Napi::Buffer<uint8_t>` | - |
|
||||||
|
|
142
doc/snippets.md
142
doc/snippets.md
|
@ -14,10 +14,12 @@ A snippet for **src/package.json**:
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node-gyp rebuild && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
|
"build": "node-gyp rebuild"
|
||||||
|
"build-dev": "node-gyp build && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
|
||||||
|
"rebuild-dev": "node-gyp rebuild && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"addon-tools-raub": "6.0.0",
|
"addon-tools-raub": "6.1.0",
|
||||||
"DEPS": "1.0.0"
|
"DEPS": "1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,26 +36,32 @@ In **package.json** use the `"postinstall"` script to download the libraries.
|
||||||
For example the following structure might work. Note that **Addon Tools** will
|
For example the following structure might work. Note that **Addon Tools** will
|
||||||
append any given URL with `/${platform}.zip`
|
append any given URL with `/${platform}.zip`
|
||||||
|
|
||||||
|
In **package.json**:
|
||||||
|
|
||||||
```
|
```
|
||||||
"config" : {
|
|
||||||
"install" : "v1.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "install",
|
"postinstall": "node install",
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"addon-tools-raub": "^6.0.2",
|
||||||
|
"adm-zip": "^0.5.9"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"node-addon-api": "^5.0.0"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here `config.install` is the tag name to download the binaries from.
|
Create the **install.js** file:
|
||||||
To use it, create the *install.js* file in your addon:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
'use strict';
|
||||||
const install = require('addon-tools-raub/install');
|
const install = require('addon-tools-raub/install');
|
||||||
const prefix = 'https://github.com/USER/ADDON/releases/download';
|
const prefix = 'https://github.com/node-3d/glfw-raub/releases/download';
|
||||||
const tag = process.env.npm_package_config_install;
|
const tag = '4.8.0';
|
||||||
install(`${prefix}/${tag}`);
|
install(`${prefix}/${tag}`);
|
||||||
```
|
```
|
||||||
|
|
||||||
**Addon Tools** will unzip the downloaded file into the platform binary
|
**Addon Tools** will unzip (using **adm-zip**) the downloaded file into the platform binary
|
||||||
directory. E.g. on Windows it will be **bin-windows**.
|
directory. E.g. on Windows it will be **bin-windows**.
|
||||||
|
|
||||||
* For a dependency package:
|
* For a dependency package:
|
||||||
|
@ -76,7 +84,7 @@ directory. E.g. on Windows it will be **bin-windows**.
|
||||||
Publishing binaries is done by attaching a zipped platform folder to the GitHub
|
Publishing binaries is done by attaching a zipped platform folder to the GitHub
|
||||||
release. Zip file must NOT contain platform folder as a subfolder, but rather
|
release. Zip file must NOT contain platform folder as a subfolder, but rather
|
||||||
contain the final binaries. The tag of the release should be the same as in
|
contain the final binaries. The tag of the release should be the same as in
|
||||||
`npm_package_config_install` - that is the way installer will find it.
|
**install.js**.
|
||||||
|
|
||||||
> NOTE: You can publish your binaries to anywhere, not necessarily GitHub.
|
> NOTE: You can publish your binaries to anywhere, not necessarily GitHub.
|
||||||
Just tweak **YOUR install.js** script as appropriate. The only limitation
|
Just tweak **YOUR install.js** script as appropriate. The only limitation
|
||||||
|
@ -128,70 +136,58 @@ dependency include path(s).
|
||||||
'DEPS_include' : '<!(node -p "require(\'DEPS\').include")',
|
'DEPS_include' : '<!(node -p "require(\'DEPS\').include")',
|
||||||
'DEPS_bin' : '<!(node -p "require(\'DEPS\').bin")',
|
'DEPS_bin' : '<!(node -p "require(\'DEPS\').bin")',
|
||||||
},
|
},
|
||||||
'targets': [
|
'targets': [{
|
||||||
{
|
'target_name' : 'ADDON',
|
||||||
'target_name' : 'bullet',
|
'sources' : [
|
||||||
'sources' : [
|
'cpp/addon.cpp',
|
||||||
'cpp/addon.cpp',
|
],
|
||||||
],
|
'include_dirs' : [
|
||||||
'include_dirs' : [
|
'<!@(node -p "require(\'addon-tools-raub\').include")',
|
||||||
'<!@(node -p "require(\'addon-tools-raub\').include")',
|
'<(DEPS_include)',
|
||||||
'<(DEPS_include)',
|
],
|
||||||
],
|
'defines': ['UNICODE', '_UNICODE'],
|
||||||
'library_dirs' : [ '<(DEPS_bin)' ],
|
'library_dirs': ['<(DEPS_bin)'],
|
||||||
'libraries' : [ '-lDEPS' ],
|
'libraries': ['-lDEPS' ],
|
||||||
'cflags!': ['-fno-exceptions'],
|
'cflags_cc': ['-std=c++17'],
|
||||||
'cflags_cc!': ['-fno-exceptions'],
|
'conditions': [
|
||||||
'conditions': [
|
['OS=="linux"', {
|
||||||
|
'libraries': [
|
||||||
[
|
"-Wl,-rpath,'$$ORIGIN'",
|
||||||
'OS=="linux"',
|
"-Wl,-rpath,'$$ORIGIN/../node_modules/DEPS/<(bin)'",
|
||||||
{
|
"-Wl,-rpath,'$$ORIGIN/../../DEPS/<(bin)'",
|
||||||
'libraries': [
|
|
||||||
"-Wl,-rpath,'$$ORIGIN'",
|
|
||||||
"-Wl,-rpath,'$$ORIGIN/../node_modules/DEPS/<(bin)'",
|
|
||||||
"-Wl,-rpath,'$$ORIGIN/../../DEPS/<(bin)'",
|
|
||||||
],
|
|
||||||
'defines': ['__linux__'],
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
|
'defines': ['__linux__'],
|
||||||
[
|
}],
|
||||||
'OS=="mac"',
|
['OS=="mac"', {
|
||||||
{
|
'libraries': [
|
||||||
'libraries': [
|
'-Wl,-rpath,@loader_path',
|
||||||
'-Wl,-rpath,@loader_path',
|
'-Wl,-rpath,@loader_path/../node_modules/DEPS/<(bin)',
|
||||||
'-Wl,-rpath,@loader_path/../node_modules/DEPS/<(bin)',
|
'-Wl,-rpath,@loader_path/../../DEPS/<(bin)',
|
||||||
'-Wl,-rpath,@loader_path/../../DEPS/<(bin)',
|
|
||||||
],
|
|
||||||
'defines': ['__APPLE__'],
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
|
'MACOSX_DEPLOYMENT_TARGET': '10.9',
|
||||||
[
|
'defines': ['__APPLE__'],
|
||||||
'OS=="win"',
|
'CLANG_CXX_LIBRARY': 'libc++',
|
||||||
{
|
'OTHER_CFLAGS': ['-std=c++17'],
|
||||||
'defines' : [
|
}],
|
||||||
'WIN32_LEAN_AND_MEAN',
|
['OS=="win"', {
|
||||||
'VC_EXTRALEAN',
|
'defines' : [
|
||||||
'_WIN32',
|
'WIN32_LEAN_AND_MEAN',
|
||||||
],
|
'VC_EXTRALEAN',
|
||||||
'msvs_settings' : {
|
'_WIN32',
|
||||||
'VCCLCompilerTool' : {
|
],
|
||||||
'AdditionalOptions' : [
|
'msvs_settings' : {
|
||||||
'/GL', '/GF', '/EHsc', '/GS', '/Gy', '/GR-',
|
'VCCLCompilerTool' : {
|
||||||
]
|
'AdditionalOptions' : [
|
||||||
},
|
'/GL', '/GF', '/EHsc', '/GS', '/Gy', '/GR-',
|
||||||
'VCLinkerTool' : {
|
]
|
||||||
'AdditionalOptions' : ['/RELEASE','/OPT:REF','/OPT:ICF','/LTCG'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
'VCLinkerTool' : {
|
||||||
|
'AdditionalOptions' : ['/RELEASE','/OPT:REF','/OPT:ICF','/LTCG'],
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
]
|
}],
|
||||||
|
],
|
||||||
|
}],
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
"typescript": "^4.9.3"
|
"typescript": "^4.9.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.17.0",
|
"node": ">=18.12.1",
|
||||||
"npm": ">=8.15.0"
|
"npm": ">=8.19.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"adm-zip": "^0.5.9",
|
"adm-zip": "^0.5.9",
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.17.0",
|
"node": ">=18.12.1",
|
||||||
"npm": ">=8.15.0"
|
"npm": ">=8.19.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"eslint": "eslint .",
|
"eslint": "eslint .",
|
||||||
|
|
|
@ -1,53 +1,38 @@
|
||||||
{
|
{
|
||||||
'targets': [
|
'targets': [{
|
||||||
{
|
'target_name': 'test',
|
||||||
'target_name': 'test',
|
'sources': [
|
||||||
'sources': [
|
'test.cpp',
|
||||||
'test.cpp',
|
],
|
||||||
],
|
'defines': ['UNICODE', '_UNICODE'],
|
||||||
'defines': [
|
'cflags_cc': ['-std=c++17'],
|
||||||
'UNICODE', '_UNICODE'
|
'include_dirs': [
|
||||||
],
|
'<!@(node -p "require(\'..\').include")',
|
||||||
'include_dirs': [
|
],
|
||||||
'<!@(node -p "require(\'..\').include")',
|
'conditions': [
|
||||||
],
|
['OS=="linux"', {
|
||||||
'cflags_cc': ['-std=c++17'],
|
'defines': ['__linux__'],
|
||||||
'conditions': [
|
}],
|
||||||
[
|
['OS=="mac"', {
|
||||||
'OS=="linux"',
|
'MACOSX_DEPLOYMENT_TARGET': '10.9',
|
||||||
{
|
'defines': ['__APPLE__'],
|
||||||
'defines': ['__linux__'],
|
'CLANG_CXX_LIBRARY': 'libc++',
|
||||||
}
|
'OTHER_CFLAGS': ['-std=c++17'],
|
||||||
],
|
}],
|
||||||
[
|
['OS=="win"', {
|
||||||
'OS=="mac"',
|
'defines' : ['WIN32_LEAN_AND_MEAN', 'VC_EXTRALEAN', '_WIN32'],
|
||||||
{
|
'msvs_settings' : {
|
||||||
'defines': ['__APPLE__'],
|
'VCCLCompilerTool' : {
|
||||||
'OTHER_CFLAGS': ['-std=c++17'],
|
'AdditionalOptions' : [
|
||||||
}
|
'/O2','/Oy','/GL','/GF','/Gm-', '/std:c++17',
|
||||||
],
|
'/EHsc','/MT','/GS','/Gy','/GR-','/Gd',
|
||||||
[
|
]
|
||||||
'OS=="win"',
|
|
||||||
{
|
|
||||||
'defines' : [
|
|
||||||
'WIN32_LEAN_AND_MEAN',
|
|
||||||
'VC_EXTRALEAN',
|
|
||||||
'_WIN32',
|
|
||||||
],
|
|
||||||
'msvs_settings' : {
|
|
||||||
'VCCLCompilerTool' : {
|
|
||||||
'AdditionalOptions' : [
|
|
||||||
'/O2','/Oy','/GL','/GF','/Gm-',
|
|
||||||
'/EHsc','/MT','/GS','/Gy','/GR-','/Gd',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
'VCLinkerTool' : {
|
|
||||||
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
'VCLinkerTool' : {
|
||||||
],
|
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
}],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue