Fix build
This commit is contained in:
parent
40e4baeb56
commit
b05666869a
|
@ -60,7 +60,7 @@ jobs:
|
|||
run: npm ci
|
||||
|
||||
- name: Build Sample Addon
|
||||
run: npm run test-build
|
||||
run: npm run build-test
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: npm run test-ci
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
let napi = null;
|
||||
try {
|
||||
napi = require('node-addon-api');
|
||||
} catch (ex) {
|
||||
// do nothing
|
||||
}
|
||||
const path = require('node:path');
|
||||
|
||||
|
||||
const nameWindows = 'windows';
|
||||
const platformAndArch = `${process.platform}-${process.arch}`;
|
||||
|
@ -21,15 +17,8 @@ const platformName = platformNames[platformAndArch] || platformAndArch;
|
|||
|
||||
const isWindows = platformName === nameWindows;
|
||||
|
||||
const rootPath = __dirname.replace(/\\/g, '/');
|
||||
|
||||
|
||||
const napiInclude = napi ? napi.include_dir.replace(/\\/g, '/') : '';
|
||||
const thisInclude = `${rootPath}/include`;
|
||||
const includePath = `${napiInclude} ${thisInclude}`;
|
||||
|
||||
|
||||
const paths = (dir) => {
|
||||
const getPaths = (dir) => {
|
||||
dir = dir.replace(/\\/g, '/');
|
||||
|
||||
const bin = `${dir}/bin-${platformName}`;
|
||||
|
@ -43,9 +32,34 @@ const paths = (dir) => {
|
|||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
paths,
|
||||
bin: `bin-${platformName}`,
|
||||
platform: platformName,
|
||||
include: includePath,
|
||||
const getBin = () => {
|
||||
return `bin-${platformName}`;
|
||||
};
|
||||
|
||||
const getPlatform = () => {
|
||||
return platformName;
|
||||
};
|
||||
|
||||
const getInclude = () => {
|
||||
let napi = null;
|
||||
try {
|
||||
napi = require('node-addon-api');
|
||||
} catch (ex) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
const rootPath = path.resolve(`${__dirname}/..`).replace(/\\/g, '/');
|
||||
const napiInclude = napi ? napi.include_dir.replace(/\\/g, '/') : '';
|
||||
const thisInclude = `${rootPath}/include`;
|
||||
const includePath = `${napiInclude} ${thisInclude}`;
|
||||
|
||||
return includePath;
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
getPaths,
|
||||
getBin,
|
||||
getPlatform,
|
||||
getInclude,
|
||||
};
|
||||
|
|
|
@ -14,9 +14,8 @@ A snippet for **src/package.json**:
|
|||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"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')\""
|
||||
"build-all": "cd src && node-gyp rebuild -j max --silent && node -e \"require('addon-tools-raub/utils').cpbin('ADDON')\" && cd ..",
|
||||
"build-only": "cd src && node-gyp build -j max --silent && node -e \"require('addon-tools-raub/utils').cpbin('ADDON')\" && cd ..",
|
||||
},
|
||||
"dependencies": {
|
||||
"addon-tools-raub": "6.2.0",
|
||||
|
@ -44,7 +43,6 @@ In **package.json**:
|
|||
},
|
||||
"dependencies": {
|
||||
"addon-tools-raub": "^6.2.0",
|
||||
"adm-zip": "^0.5.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"node-addon-api": "^5.0.0"
|
||||
|
@ -55,7 +53,7 @@ Create the **install.js** file:
|
|||
|
||||
```
|
||||
'use strict';
|
||||
const install = require('addon-tools-raub/install');
|
||||
const { install } = require('addon-tools-raub/utils');
|
||||
const prefix = 'https://github.com/node-3d/glfw-raub/releases/download';
|
||||
const tag = '4.8.0';
|
||||
install(`${prefix}/${tag}`);
|
||||
|
@ -95,9 +93,9 @@ from **Addon Tools** is that it should be a zipped set of files/folders.
|
|||
|
||||
```
|
||||
'variables': {
|
||||
'bin': '<!(node -p "require(\'addon-tools-raub\').bin")',
|
||||
'DEPS_include': '<!(node -p "require(\'DEPS\').include")',
|
||||
'DEPS_bin': '<!(node -p "require(\'DEPS\').bin")',
|
||||
'bin': '<!(node -p "require(\'addon-tools-raub\').getBin()")',
|
||||
'DEPS_include': '<!(node -p "require(\'DEPS\').getInclude()")',
|
||||
'DEPS_bin': '<!(node -p "require(\'DEPS\').getBin()")',
|
||||
},
|
||||
```
|
||||
|
||||
|
@ -111,7 +109,7 @@ from **Addon Tools** is that it should be a zipped set of files/folders.
|
|||
|
||||
```
|
||||
'include_dirs' : [
|
||||
'<!@(node -p "require(\'addon-tools-raub\').include")',
|
||||
'<!@(node -p "require(\'addon-tools-raub\').getInclude()")',
|
||||
'<(DEPS_include)',
|
||||
],
|
||||
```
|
||||
|
|
4
index.js
4
index.js
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('./index');
|
||||
module.exports = {
|
||||
...require('./include/index'),
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"test": "jest --coverage=false --watch --config=conf/jest.json",
|
||||
"test-ci": "jest --ci --runInBand --coverage=false --forceExit --detectOpenHandles --config=conf/jest.json",
|
||||
"test-coverage": "rm -rf doc/jest && jest --coverage --silent --config=conf/jest.json",
|
||||
"test-build": "cd test-addon && node-gyp rebuild -j max --silent && cd .."
|
||||
"build-test": "cd test-addon && node-gyp rebuild -j max --silent && cd .."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
],
|
||||
'cflags_cc': ['-std=c++17', '-fno-exceptions'],
|
||||
'include_dirs': [
|
||||
'<!@(node -p "require(\'..\').include")',
|
||||
'<!@(node -p "require(\'..\').getInclude()")',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\_projects\addon-tools-raub\test\build\Release\test.node</FullPath>
|
||||
<FullPath>C:\_projects\addon-tools-raub\test-addon\build\Release\test.node</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,2 @@
|
|||
PlatformToolSet=v142:VCToolArchitecture=Native64Bit:VCToolsVersion=14.28.29910:TargetPlatformVersion=10.0.19041.0:
|
||||
Release|x64|C:\_projects\addon-tools-raub\test\build\|
|
||||
Release|x64|C:\_projects\addon-tools-raub\test-addon\build\|
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,17 +1,17 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2015
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|x64 = Release|x64
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}.Release|x64.ActiveCfg = Release|x64
|
||||
{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}.Release|x64.Build.0 = Release|x64
|
||||
{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}.Debug|x64.Build.0 = Debug|x64
|
||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Debug|x64.Build.0 = Debug|x64
|
||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Release|x64.ActiveCfg = Release|x64
|
||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CA6D0C46-51F8-CCC5-FA71-4D2E9A260624}</ProjectGuid>
|
||||
<ProjectGuid>{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>test</RootNamespace>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;UNICODE;_UNICODE;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
|
@ -73,7 +73,7 @@
|
|||
</Lib>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\\Users\\Luis\\AppData\\Local\\node-gyp\\Cache\\18.12.1\\x64\\node.lib"</AdditionalDependencies>
|
||||
<AdditionalOptions>/LTCG:INCREMENTAL /OPT:REF /OPT:ICF /LTCG /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/LTCG:INCREMENTAL /DEBUG:NONE /LTCG /OPT:NOREF /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
||||
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -85,7 +85,7 @@
|
|||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;UNICODE;_UNICODE;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -104,7 +104,7 @@
|
|||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<Optimization>Full</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;UNICODE;_UNICODE;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<StringPooling>true</StringPooling>
|
||||
|
@ -118,7 +118,7 @@
|
|||
</Lib>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\\Users\\Luis\\AppData\\Local\\node-gyp\\Cache\\18.12.1\\x64\\node.lib"</AdditionalDependencies>
|
||||
<AdditionalOptions>/LTCG:INCREMENTAL /OPT:REF /OPT:ICF /LTCG /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/LTCG:INCREMENTAL /DEBUG:NONE /LTCG /OPT:NOREF /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
||||
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -130,7 +130,7 @@
|
|||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;UNICODE;_UNICODE;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue