Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opencv-build

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencv-build - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

1

build/dirs.d.ts

@@ -9,2 +9,3 @@ export declare const dirs: {

opencvInclude: string;
opencv4Include: string;
opencvLibDir: string;

@@ -11,0 +12,0 @@ opencvBinDir: string;

@@ -12,2 +12,3 @@ "use strict";

var opencvInclude = path.join(opencvBuild, 'include');
var opencv4Include = path.join(opencvInclude, 'opencv4');
var opencvLibDir = utils_1.isWin() ? path.join(opencvBuild, 'lib/Release') : path.join(opencvBuild, 'lib');

@@ -24,2 +25,3 @@ var opencvBinDir = utils_1.isWin() ? path.join(opencvBuild, 'bin/Release') : path.join(opencvBuild, 'bin');

opencvInclude: opencvInclude,
opencv4Include: opencv4Include,
opencvLibDir: opencvLibDir,

@@ -26,0 +28,0 @@ opencvBinDir: opencvBinDir,

2

build/env.js

@@ -45,3 +45,3 @@ "use strict";

var autoBuildFile = JSON.parse(fs.readFileSync(dirs_1.dirs.autoBuildFile).toString());
if (!autoBuildFile.opencvVersion || !autoBuildFile.autoBuildFlags || !Array.isArray(autoBuildFile.modules)) {
if (!autoBuildFile.opencvVersion || !('autoBuildFlags' in autoBuildFile) || !Array.isArray(autoBuildFile.modules)) {
throw new Error('auto-build.json has invalid contents');

@@ -48,0 +48,0 @@ }

export { opencvModules } from './constants';
export { isAutoBuildDisabled, readAutoBuildFile } from './env';
export declare const opencvInclude: string;
export declare const opencv4Include: string;
export declare const opencvLibDir: string;

@@ -5,0 +6,0 @@ export declare const opencvBinDir: string;

@@ -15,2 +15,3 @@ "use strict";

exports.opencvInclude = dirs_1.dirs.opencvInclude;
exports.opencv4Include = dirs_1.dirs.opencv4Include;
exports.opencvLibDir = dirs_1.dirs.opencvLibDir;

@@ -17,0 +18,0 @@ exports.opencvBinDir = dirs_1.dirs.opencvBinDir;

@@ -39,2 +39,3 @@ "use strict";

var fs = require("fs");
var path = require("path");
var _1 = require(".");

@@ -162,2 +163,4 @@ var constants_1 = require("./constants");

};
log.info('install', 'writing auto-build file into directory: %s', dirs_1.dirs.autoBuildFile);
log.info('install', autoBuildFile);
fs.writeFileSync(dirs_1.dirs.autoBuildFile, JSON.stringify(autoBuildFile));

@@ -167,3 +170,3 @@ }

return __awaiter(this, void 0, void 0, function () {
var msbuild, cMakeFlags, tag;
var msbuild, cMakeFlags, tag, cmakeArgs, rmOpenCV, err_1, rmOpenCVContrib, err_2;
return __generator(this, function (_a) {

@@ -204,5 +207,8 @@ switch (_a.label) {

_a.sent();
return [4 /*yield*/, utils_1.spawn('cmake', getCmakeArgs(cMakeFlags), { cwd: dirs_1.dirs.opencvBuild })];
cmakeArgs = getCmakeArgs(cMakeFlags);
log.info('install', 'running cmake %s', cmakeArgs);
return [4 /*yield*/, utils_1.spawn('cmake', cmakeArgs, { cwd: dirs_1.dirs.opencvBuild })];
case 11:
_a.sent();
log.info('install', 'starting build...');
return [4 /*yield*/, getRunBuildCmd(utils_1.isWin() ? msbuild.path : undefined)()];

@@ -212,9 +218,32 @@ case 12:

writeAutoBuildFile();
return [4 /*yield*/, utils_1.exec(getRmDirCmd('opencv'), { cwd: dirs_1.dirs.opencvRoot })];
rmOpenCV = getRmDirCmd('opencv');
_a.label = 13;
case 13:
_a.sent();
return [4 /*yield*/, utils_1.exec(getRmDirCmd('opencv_contrib'), { cwd: dirs_1.dirs.opencvRoot })];
_a.trys.push([13, 15, , 16]);
return [4 /*yield*/, utils_1.exec(rmOpenCV, { cwd: dirs_1.dirs.opencvRoot })];
case 14:
_a.sent();
return [2 /*return*/];
return [3 /*break*/, 16];
case 15:
err_1 = _a.sent();
log.error('install', 'failed to clean opencv source folder:', err_1);
log.error('install', 'command was: %s', rmOpenCV);
log.error('install', 'consider removing the folder yourself: %s', path.join(dirs_1.dirs.opencvRoot, 'opencv'));
return [3 /*break*/, 16];
case 16:
rmOpenCVContrib = getRmDirCmd('opencv_contrib');
_a.label = 17;
case 17:
_a.trys.push([17, 19, , 20]);
return [4 /*yield*/, utils_1.exec(rmOpenCVContrib, { cwd: dirs_1.dirs.opencvRoot })];
case 18:
_a.sent();
return [3 /*break*/, 20];
case 19:
err_2 = _a.sent();
log.error('install', 'failed to clean opencv_contrib source folder:', err_2);
log.error('install', 'command was: %s', rmOpenCV);
log.error('install', 'consider removing the folder yourself: %s', path.join(dirs_1.dirs.opencvRoot, 'opencv_contrib'));
return [3 /*break*/, 20];
case 20: return [2 /*return*/];
}

@@ -221,0 +250,0 @@ });

{
"name": "opencv-build",
"version": "0.1.3",
"version": "0.1.4",
"description": "A simple script to auto build recent OpenCV + contrib version via npm",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

@@ -12,2 +12,3 @@ import * as path from 'path';

const opencvInclude = path.join(opencvBuild, 'include')
const opencv4Include = path.join(opencvInclude, 'opencv4')
const opencvLibDir = isWin() ? path.join(opencvBuild, 'lib/Release') : path.join(opencvBuild, 'lib')

@@ -25,2 +26,3 @@ const opencvBinDir = isWin() ? path.join(opencvBuild, 'bin/Release') : path.join(opencvBuild, 'bin')

opencvInclude,
opencv4Include,
opencvLibDir,

@@ -27,0 +29,0 @@ opencvBinDir,

@@ -47,3 +47,3 @@ import * as fs from 'fs';

const autoBuildFile = JSON.parse(fs.readFileSync(dirs.autoBuildFile).toString()) as AutoBuildFile
if (!autoBuildFile.opencvVersion || !autoBuildFile.autoBuildFlags || !Array.isArray(autoBuildFile.modules)) {
if (!autoBuildFile.opencvVersion || !('autoBuildFlags' in autoBuildFile) || !Array.isArray(autoBuildFile.modules)) {
throw new Error('auto-build.json has invalid contents')

@@ -50,0 +50,0 @@ }

@@ -12,2 +12,3 @@ import * as fs from 'fs';

export const opencvInclude = dirs.opencvInclude
export const opencv4Include = dirs.opencv4Include
export const opencvLibDir = dirs.opencvLibDir

@@ -14,0 +15,0 @@ export const opencvBinDir = dirs.opencvBinDir

import * as fs from 'fs';
import * as path from 'path';

@@ -6,6 +7,13 @@ import { getLibs } from '.';

import { dirs } from './dirs';
import { autoBuildFlags, numberOfCoresAvailable, opencvVersion, parseAutoBuildFlags, isWithoutContrib, buildWithCuda } from './env';
import {
autoBuildFlags,
buildWithCuda,
isWithoutContrib,
numberOfCoresAvailable,
opencvVersion,
parseAutoBuildFlags,
} from './env';
import { findMsBuild } from './findMsBuild';
import { AutoBuildFile } from './types';
import { exec, isWin, spawn, isCudaAvailable } from './utils';
import { exec, isCudaAvailable, isWin, spawn } from './utils';

@@ -110,2 +118,4 @@ const log = require('npmlog')

}
log.info('install', 'writing auto-build file into directory: %s', dirs.autoBuildFile)
log.info('install', autoBuildFile)
fs.writeFileSync(dirs.autoBuildFile, JSON.stringify(autoBuildFile))

@@ -136,3 +146,6 @@ }

await spawn('cmake', getCmakeArgs(cMakeFlags), { cwd: dirs.opencvBuild })
const cmakeArgs = getCmakeArgs(cMakeFlags)
log.info('install', 'running cmake %s', cmakeArgs)
await spawn('cmake', cmakeArgs, { cwd: dirs.opencvBuild })
log.info('install', 'starting build...')
await getRunBuildCmd(isWin() ? msbuild.path : undefined)()

@@ -142,4 +155,19 @@

await exec(getRmDirCmd('opencv'), { cwd: dirs.opencvRoot })
await exec(getRmDirCmd('opencv_contrib'), { cwd: dirs.opencvRoot })
const rmOpenCV = getRmDirCmd('opencv')
try {
await exec(rmOpenCV, { cwd: dirs.opencvRoot })
} catch (err) {
log.error('install', 'failed to clean opencv source folder:', err)
log.error('install', 'command was: %s', rmOpenCV)
log.error('install', 'consider removing the folder yourself: %s', path.join(dirs.opencvRoot, 'opencv'))
}
const rmOpenCVContrib = getRmDirCmd('opencv_contrib')
try {
await exec(rmOpenCVContrib, { cwd: dirs.opencvRoot })
} catch (err) {
log.error('install', 'failed to clean opencv_contrib source folder:', err)
log.error('install', 'command was: %s', rmOpenCV)
log.error('install', 'consider removing the folder yourself: %s', path.join(dirs.opencvRoot, 'opencv_contrib'))
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc