@u4/opencv-build
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -54,2 +54,3 @@ /** | ||
*/ | ||
private logOnce; | ||
get optHash(): string; | ||
@@ -56,0 +57,0 @@ get rootDir(): string; |
@@ -94,3 +94,3 @@ "use strict"; | ||
npmlog_1.default.info('applyEnvsFromPackageJson', 'the following opencv4nodejs environment variables are set in the package.json:'); | ||
envKeys.forEach((key) => npmlog_1.default.info('applyEnvsFromPackageJson', `${key}: ${packageEnv[key]}`)); | ||
envKeys.forEach((key) => npmlog_1.default.info('applyEnvsFromPackageJson', `${(0, utils_1.highlight)(key)}: ${utils.formatNumber(packageEnv[key] || '')}`)); | ||
} | ||
@@ -164,10 +164,14 @@ this.autoBuildFlags = this.resolveValue(opts, packageEnv, 'autoBuildFlags', 'OPENCV4NODEJS_AUTOBUILD_FLAGS'); | ||
*/ | ||
logOnce = false; | ||
get optHash() { | ||
let optArgs = this.autoBuildFlags; | ||
if (!optArgs) { | ||
npmlog_1.default.info('init', `${utils.highlight("OPENCV4NODEJS_AUTOBUILD_FLAGS")} is not defined, No extra flags will be append to the build command`); | ||
if (!this.logOnce) { | ||
if (!optArgs) { | ||
npmlog_1.default.info('init', `${utils.highlight("OPENCV4NODEJS_AUTOBUILD_FLAGS")} is not defined, No extra flags will be append to the build command`); | ||
} | ||
else { | ||
npmlog_1.default.info('init', `${utils.highlight("OPENCV4NODEJS_AUTOBUILD_FLAGS")} is defined, as ${utils.formatNumber("%s")}`, optArgs); | ||
} | ||
this.logOnce = true; | ||
} | ||
else { | ||
npmlog_1.default.info('init', `${utils.highlight("OPENCV4NODEJS_AUTOBUILD_FLAGS")} is defined, as ${utils.formatNumber("%s")}`, optArgs); | ||
} | ||
if (this.buildWithCuda) | ||
@@ -174,0 +178,0 @@ optArgs += 'cuda'; |
@@ -30,4 +30,12 @@ "use strict"; | ||
npmlog_1.default.silly('find-msbuild', 'sdk', vsSetup.sdk); | ||
let testPAth = path_1.default.join(vsSetup.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe'); | ||
if (!fs_1.default.existsSync(testPAth)) { | ||
testPAth = path_1.default.join(vsSetup.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe'); | ||
} | ||
if (!fs_1.default.existsSync(testPAth)) { | ||
npmlog_1.default.error('find-msbuild', 'can not find msbuild.exe (see findMsBuild.findVs2017() for details)'); | ||
throw new Error('can not find msbuild.exe (see findMsBuild.findVs2017() for details)'); | ||
} | ||
const build = { | ||
path: path_1.default.join(vsSetup.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe'), | ||
path: testPAth, | ||
version: 15 | ||
@@ -34,0 +42,0 @@ }; |
@@ -14,2 +14,8 @@ "use strict"; | ||
const primraf = (0, util_1.promisify)(rimraf_1.default); | ||
const protect = (txt) => { if (txt.includes(' ')) { | ||
return `"${txt}"`; | ||
} | ||
else { | ||
return txt; | ||
} }; | ||
class SetupOpencv { | ||
@@ -30,10 +36,20 @@ builder; | ||
if (msbuildExe) { | ||
if (!fs_1.default.existsSync(msbuildExe)) { | ||
npmlog_1.default.error('install', 'invalid msbuildExe path" %s', msbuildExe); | ||
throw Error('invalid msbuildExe path ' + msbuildExe); | ||
} | ||
return async () => { | ||
await (0, utils_js_1.spawn)(`${msbuildExe}`, this.getMsbuildCmd('./OpenCV.sln'), { cwd: env.opencvBuild }); | ||
await (0, utils_js_1.spawn)(`${msbuildExe}`, this.getMsbuildCmd('./INSTALL.vcxproj'), { cwd: env.opencvBuild }); | ||
const buildSLN = this.getMsbuildCmd('./OpenCV.sln'); | ||
npmlog_1.default.info('install', 'spawning in %s: %s %s', protect(env.opencvBuild), protect(msbuildExe), buildSLN.map(protect).join(' ')); | ||
await (0, utils_js_1.spawn)(`${msbuildExe}`, buildSLN, { cwd: env.opencvBuild }); | ||
const buildVcxproj = this.getMsbuildCmd('./INSTALL.vcxproj'); | ||
npmlog_1.default.info('install', 'spawning in %s: %s %s', protect(env.opencvBuild), protect(msbuildExe), buildVcxproj.map(protect).join(' ')); | ||
await (0, utils_js_1.spawn)(`${msbuildExe}`, buildVcxproj, { cwd: env.opencvBuild }); | ||
}; | ||
} | ||
return async () => { | ||
npmlog_1.default.info('install', 'spawning in %s: make', env.opencvBuild); | ||
await (0, utils_js_1.spawn)('make', ['install', `-j${env.numberOfCoresAvailable()}`], { cwd: env.opencvBuild }); | ||
// revert the strange archiving of libopencv.so going on with make install | ||
npmlog_1.default.info('install', 'spawning in %s: make all', env.opencvBuild); | ||
await (0, utils_js_1.spawn)('make', ['all', `-j${env.numberOfCoresAvailable()}`], { cwd: env.opencvBuild }); | ||
@@ -153,3 +169,3 @@ }; | ||
const cmakeArgs = this.getCmakeArgs(cMakeFlags); | ||
npmlog_1.default.info('install', 'running cmake %s', cmakeArgs.join(' ')); | ||
npmlog_1.default.info('install', 'running in %s cmake %s', protect(env.opencvBuild), cmakeArgs.map(protect).join(' ')); | ||
await (0, utils_js_1.spawn)('cmake', cmakeArgs, { cwd: env.opencvBuild }); | ||
@@ -156,0 +172,0 @@ npmlog_1.default.info('install', 'starting build...'); |
{ | ||
"name": "@u4/opencv-build", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A simple script to auto build recent OpenCV + contrib version via npm 2021 Edition", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -14,2 +14,3 @@ # npm-opencv-build | ||
- Each AUTOBUILD_FLAGS will be build in his own directory. (induce massive time gain during development) | ||
- if MSBuild.exe localisation for VS 2019 | ||
- Script output is now colorized. | ||
@@ -16,0 +17,0 @@ - Add some usefull log. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
97442
1200
111
1