Add aarch64

This commit is contained in:
Luis Blanco 2022-12-24 17:10:35 +04:00
parent d4ed519e71
commit a274cd227e
8 changed files with 95 additions and 88 deletions

View File

@ -36,7 +36,7 @@ jobs:
name: Unit Tests
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-11]
os: [ubuntu-20.04, windows-2022, macos-11, [self-hosted, linux, ARM64]]
runs-on: ${{ matrix.os }}

View File

@ -11,6 +11,7 @@ with
```
#include <addon-tools.hpp>
```
In **GYP**, the include directory should be set for your addon.
An actual path to the directory is exported from the module
and is accessible like this:

View File

@ -19,7 +19,7 @@ A snippet for **src/package.json**:
"rebuild-dev": "node-gyp rebuild && node -e \"require('addon-tools-raub/cpbin')('ADDON')\""
},
"dependencies": {
"addon-tools-raub": "6.1.0",
"addon-tools-raub": "6.2.0",
"DEPS": "1.0.0"
}
}
@ -43,8 +43,8 @@ In **package.json**:
"postinstall": "node install",
},
"dependencies": {
"addon-tools-raub": "^6.0.2",
"adm-zip": "^0.5.9"
"addon-tools-raub": "^6.2.0",
"adm-zip": "^0.5.10"
},
"devDependencies": {
"node-addon-api": "^5.0.0"
@ -146,9 +146,9 @@ dependency include path(s).
'<(DEPS_include)',
],
'defines': ['UNICODE', '_UNICODE'],
'cflags_cc': ['-std=c++17', '-fno-exceptions'],
'library_dirs': ['<(DEPS_bin)'],
'libraries': ['-lDEPS' ],
'cflags_cc': ['-std=c++17'],
'conditions': [
['OS=="linux"', {
'libraries': [
@ -167,22 +167,19 @@ dependency include path(s).
'MACOSX_DEPLOYMENT_TARGET': '10.9',
'defines': ['__APPLE__'],
'CLANG_CXX_LIBRARY': 'libc++',
'OTHER_CFLAGS': ['-std=c++17'],
'OTHER_CFLAGS': ['-std=c++17', '-fno-exceptions'],
}],
['OS=="win"', {
'defines' : [
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
'_WIN32',
],
'defines' : ['WIN32_LEAN_AND_MEAN', 'VC_EXTRALEAN', '_WIN32', '_HAS_EXCEPTIONS=0'],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : [
'/GL', '/GF', '/EHsc', '/GS', '/Gy', '/GR-',
'/O2','/Oy','/GL','/GF','/Gm-', '/std:c++17',
'/EHa-s-c-r-','/MT','/GS','/Gy','/GR-','/Gd',
]
},
'VCLinkerTool' : {
'AdditionalOptions' : ['/RELEASE','/OPT:REF','/OPT:ICF','/LTCG'],
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
},
},
}],

21
index.d.ts vendored
View File

@ -6,29 +6,30 @@ declare module "addon-tools-raub" {
export const paths: (dir: string) => Readonly<{
/**
* Path to binaries
* Platform binary directory absolute path
* Platform binary directory absolute path for this `dir`
*/
bin: string;
/**
* Path to include
* Include directory for this dir
* Include directory for this `dir`
*/
include: string;
}>;
type TPlatformName = 'windows' | 'linux' | 'osx' | 'aarch64' | 'unknown';
type TPlatformDir = `bin-${TPlatformName}`;
/**
* Binary folder name
* Platform-dependent binary directory name
*/
export const bin: string;
/**
* Platform name
* One of: 'windows', 'linux', 'osx'
*/
export const platform: string;
export const bin: TPlatformDir;
export const platform: TPlatformName;
/**
* Main include directories
* Both 'addon-tools-raub' and 'node-addon-api' include paths.
* Use with node -p through list context command expansion <!@(...).
* For binding.gyp: `'<!@(node -p "require(\'addon-tools-raub\').include")'`
*/
export const include: string;
}

View File

@ -7,20 +7,28 @@ try {
// do nothing
}
const nameWindows = 'windows';
const nameUnknown = 'unknown';
const platformNames = {
win32: 'windows',
win32: nameWindows,
linux: 'linux',
darwin: 'osx',
'linux-arm64': 'aarch64',
};
const platformName = platformNames[process.platform];
const isWindows = process.platform === 'win32';
const platformName = (
platformNames[process.platform] ||
platformNames[`${process.platform}-${process.arch}`] ||
'unknown'
);
if (!platformName) {
if (platformName === nameUnknown) {
console.log(`Error: UNKNOWN PLATFORM "${process.platform}"`);
}
const isWindows = platformName === nameWindows;
const rootPath = __dirname.replace(/\\/g, '/');

102
package-lock.json generated
View File

@ -1,28 +1,28 @@
{
"name": "addon-tools-raub",
"version": "6.1.1",
"version": "6.2.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "addon-tools-raub",
"version": "6.1.1",
"version": "6.2.0",
"license": "MIT",
"devDependencies": {
"adm-zip": "^0.5.9",
"eslint": "^8.29.0",
"eslint-plugin-jest": "^27.1.6",
"adm-zip": "^0.5.10",
"eslint": "^8.30.0",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.3.1",
"node-addon-api": "^5.0.0",
"typescript": "^4.9.3"
"typescript": "^4.9.4"
},
"engines": {
"node": ">=18.12.1",
"npm": ">=8.19.2"
},
"peerDependencies": {
"adm-zip": "^0.5.9",
"adm-zip": "^0.5.10",
"node-addon-api": "^5.0.0"
},
"peerDependenciesMeta": {
@ -646,15 +646,15 @@
"dev": true
},
"node_modules/@eslint/eslintrc": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz",
"integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.4.0",
"globals": "^13.15.0",
"globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
@ -669,9 +669,9 @@
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
"integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
@ -1456,9 +1456,9 @@
}
},
"node_modules/adm-zip": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz",
"integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==",
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz",
"integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==",
"dev": true,
"engines": {
"node": ">=6.0"
@ -2004,13 +2004,13 @@
}
},
"node_modules/eslint": {
"version": "8.29.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz",
"integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==",
"version": "8.30.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz",
"integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.11.6",
"@eslint/eslintrc": "^1.4.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
@ -2029,7 +2029,7 @@
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
@ -2103,9 +2103,9 @@
}
},
"node_modules/eslint-plugin-jest": {
"version": "27.1.6",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.6.tgz",
"integrity": "sha512-XA7RFLSrlQF9IGtAmhddkUkBuICCTuryfOTfCSWcZHiHb69OilIH05oozH2XA6CEOtztnOd0vgXyvxZodkxGjg==",
"version": "27.1.7",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.7.tgz",
"integrity": "sha512-0QVzf+og4YI1Qr3UoprkqqhezAZjFffdi62b0IurkCXMqPtRW84/UT4CKsYT80h/D82LA9avjO/80Ou1LdgbaQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/utils": "^5.10.0"
@ -2569,9 +2569,9 @@
}
},
"node_modules/globals": {
"version": "13.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
"integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
"version": "13.19.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
"integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@ -5125,15 +5125,15 @@
"dev": true
},
"@eslint/eslintrc": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz",
"integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.4.0",
"globals": "^13.15.0",
"globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
@ -5142,9 +5142,9 @@
}
},
"@humanwhocodes/config-array": {
"version": "0.11.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
"integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
@ -5763,9 +5763,9 @@
"requires": {}
},
"adm-zip": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz",
"integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==",
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz",
"integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==",
"dev": true
},
"ajv": {
@ -6160,13 +6160,13 @@
"dev": true
},
"eslint": {
"version": "8.29.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz",
"integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==",
"version": "8.30.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz",
"integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.11.6",
"@eslint/eslintrc": "^1.4.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
@ -6185,7 +6185,7 @@
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
@ -6234,9 +6234,9 @@
}
},
"eslint-plugin-jest": {
"version": "27.1.6",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.6.tgz",
"integrity": "sha512-XA7RFLSrlQF9IGtAmhddkUkBuICCTuryfOTfCSWcZHiHb69OilIH05oozH2XA6CEOtztnOd0vgXyvxZodkxGjg==",
"version": "27.1.7",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.7.tgz",
"integrity": "sha512-0QVzf+og4YI1Qr3UoprkqqhezAZjFffdi62b0IurkCXMqPtRW84/UT4CKsYT80h/D82LA9avjO/80Ou1LdgbaQ==",
"dev": true,
"requires": {
"@typescript-eslint/utils": "^5.10.0"
@ -6566,9 +6566,9 @@
}
},
"globals": {
"version": "13.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
"integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
"version": "13.19.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
"integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"

View File

@ -1,7 +1,7 @@
{
"author": "Luis Blanco <luisblanco1337@gmail.com>",
"name": "addon-tools-raub",
"version": "6.1.1",
"version": "6.2.0",
"description": "Helpers for Node.js addons and dependency packages",
"license": "MIT",
"main": "index.js",
@ -67,7 +67,7 @@
"url": "https://github.com/node-3d/addon-tools-raub.git"
},
"peerDependencies": {
"adm-zip": "^0.5.9",
"adm-zip": "^0.5.10",
"node-addon-api": "^5.0.0"
},
"peerDependenciesMeta": {
@ -75,12 +75,12 @@
"node-addon-api": { "optional": true }
},
"devDependencies": {
"adm-zip": "^0.5.9",
"eslint-plugin-jest": "^27.1.6",
"adm-zip": "^0.5.10",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-node": "^11.1.0",
"eslint": "^8.29.0",
"eslint": "^8.30.0",
"jest": "^29.3.1",
"node-addon-api": "^5.0.0",
"typescript": "^4.9.3"
"typescript": "^4.9.4"
}
}

8
test/binding.gyp vendored
View File

@ -5,7 +5,7 @@
'test.cpp',
],
'defines': ['UNICODE', '_UNICODE'],
'cflags_cc': ['-std=c++17'],
'cflags_cc': ['-std=c++17', '-fno-exceptions'],
'include_dirs': [
'<!@(node -p "require(\'..\').include")',
],
@ -17,15 +17,15 @@
'MACOSX_DEPLOYMENT_TARGET': '10.9',
'defines': ['__APPLE__'],
'CLANG_CXX_LIBRARY': 'libc++',
'OTHER_CFLAGS': ['-std=c++17'],
'OTHER_CFLAGS': ['-std=c++17', '-fno-exceptions'],
}],
['OS=="win"', {
'defines' : ['WIN32_LEAN_AND_MEAN', 'VC_EXTRALEAN', '_WIN32'],
'defines' : ['WIN32_LEAN_AND_MEAN', 'VC_EXTRALEAN', '_WIN32', '_HAS_EXCEPTIONS=0'],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : [
'/O2','/Oy','/GL','/GF','/Gm-', '/std:c++17',
'/EHsc','/MT','/GS','/Gy','/GR-','/Gd',
'/EHa-s-c-r-','/MT','/GS','/Gy','/GR-','/Gd',
]
},
'VCLinkerTool' : {