@u4/opencv-build
Advanced tools
Comparing version 0.3.7 to 0.3.8
{ | ||
"name": "@u4/opencv-build", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "A simple script to auto build recent OpenCV + contrib version via npm 2021 Edition", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"publishConfig": {"access": "public"}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf build", | ||
"build": "tsc", | ||
"build3x": "tsc && node ./build/main.js --keepsource", | ||
"do-install": "node ./build/main.js", | ||
"cleanbuild": "rimraf build && tsc", | ||
"build3x": "tsc && node lib/main.js --keepsource", | ||
"install_4_5_4": "node bin/main.js --version 4.5.4", | ||
"do-install": "node lib/main.js", | ||
"cleanbuild": "rimraf lib && tsc", | ||
"postinstallDISABLED": "npm run do-install", | ||
@@ -19,2 +22,5 @@ "prepare": "npm run build", | ||
}, | ||
"bin": { | ||
"opencv-build-npm": "bin/main.js" | ||
}, | ||
"repository": { | ||
@@ -52,5 +58,5 @@ "type": "git", | ||
"files": [ | ||
"build", | ||
"lib", | ||
"Find-VS2017.cs" | ||
] | ||
} |
122
README.md
@@ -8,9 +8,10 @@ # npm-opencv-build | ||
## Changes in this fork | ||
## Main changes from the original project | ||
- OpenCV build is not triggered by npm install but by `new OpenCVBuilder().install()` | ||
- OpenCV build is explicitly build by `./bin/main.js` or it's alias `opencv-build-npm` and accepting parametes see `opencv-build-npm --help` | ||
- OpenCV build can now be configured with `new OpenCVBuilder({autoBuildOpencvVersion: "3.4.16", autoBuildBuildCuda: true, autoBuildWithoutContrib: false }).install()` | ||
- Each OPENCV_VERSION will be build in his own directory. | ||
- Each AUTOBUILD_FLAGS will be build in his own directory. (induce massive time gain during development) | ||
- if MSBuild.exe localisation for VS 2019 | ||
- All build can now be build outside node_modules using `OPENCV_BUILD_ROOT` environement variable. | ||
- Fix MSBuild.exe localisation for VS 2019 | ||
- Script output is now colorized. | ||
@@ -22,2 +23,4 @@ - Add some usefull log. | ||
Each OpenCV build will take around 2Gb on your drive, so I recommand you to define the `OPENCV_BUILD_ROOT` environement variable to avoid duplicate buildsand avoid node_modules auto flushs. | ||
## Install | ||
@@ -43,11 +46,22 @@ | ||
A `prebuild` options can be provide to avoid any recompilation, acceptex values are: `"latestBuild"`, `"latestVersion"`, `"oldestBuild"`, `"oldestVersion"`. | ||
the `prebuild` option intend to be use at runtime. | ||
It's possible to specify build environment variables by passing argument to the builder script | ||
all the argument used to be provided in the `opencv4nodejs` section of a package.json can also be provide in OpenCVBuildEnv Options. | ||
```bash | ||
node build/main.js --version 4.5.4 --buildRoot ~/openCV | ||
``` | ||
## Environment Variables | ||
with flags, do not forget the quotes `"` | ||
It's possible to specify build environment variables by inserting them into the `package.json` where the dependency is declared an object like: | ||
```bash | ||
node build/main.js --version 4.5.4 --buildRoot ~/openCV --flags "-DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_PC_FILE_NAME=opencv.pc" | ||
``` | ||
Using the bin alias | ||
```bash | ||
opencv-build-npm --version 4.5.5 | ||
``` | ||
Or by inserting them into the `package.json` where the dependency is declared an object like: | ||
```json | ||
@@ -62,10 +76,51 @@ { | ||
The following opencv4nodejs parameters can be passed: | ||
By using environement varaibles. | ||
```bash | ||
export OPENCV4NODEJS_AUTOBUILD_FLAGS="-DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_PC_FILE_NAME=opencv.pc" | ||
export OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION="4.5.4" | ||
export OPENCV_BUILD_ROOT="~/openCV" | ||
node build/main.js | ||
``` | ||
### prebuild | ||
the `prebuild` is a smart version selector, to avoid futher re-compilation, accepted values are: | ||
- `"latestBuild"` use the last built version | ||
- `"latestVersion"` use the highest version number built | ||
- `"oldestBuild"` use the olderst built version | ||
- `"oldestVersion"` use the lowest version number built | ||
the `prebuild` option intend to be use at runtime, so you do not have to keep trak of the version you want to use. | ||
this parameter can only be provide in `OpenCVBuildEnv` constructor options. | ||
### autoBuildOpencvVersion | ||
Choose the openCV version you want to build, default is 3.4.6, | ||
This option value can be provide using: | ||
- The `--version` in build script | ||
- The `autoBuildOpencvVersion` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `autoBuildOpencvVersion` field in the current package.json `opencv4nodejs` object. | ||
- The `OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION` environement variable. | ||
### buildRoot | ||
The `buildRoot` is a the directory used to build openCV, Default value is the npm-opencv-build directory. | ||
You may want to use this value to persist your files out of your `node_modules` directory. | ||
This option value can be provide using: | ||
- The `--buildRoot` in build script | ||
- The `buildRoot` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `OPENCV_BUILD_ROOT` environement variable. | ||
### autoBuildBuildCuda | ||
Can be set using the environment variables *OPENCV4NODEJS_BUILD_CUDA* | ||
Set any value to enable, the following cMake flag will be added: | ||
set any value to enable, the following cMake flag will be added: | ||
- DWITH_CUDA=ON | ||
@@ -76,26 +131,44 @@ - DBUILD_opencv_cudacodec=OFF // video codec (NVCUVID) is deprecated in cuda 10, so don't add it | ||
This option value can be enable using: | ||
- The `--cuda` in build script | ||
- The `autoBuildBuildCuda` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `autoBuildBuildCuda` field in the current package.json `opencv4nodejs` object. | ||
- The `OPENCV4NODEJS_BUILD_CUDA` environement variable. | ||
### autoBuildFlags | ||
Can be set using the environment variables *OPENCV4NODEJS_AUTOBUILD_FLAGS* | ||
Append option to CMake flags. | ||
### autoBuildOpencvVersion | ||
This option value can be enable using: | ||
Can be set using the environment variables *OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION* | ||
- The `--flags` in build script | ||
- The `autoBuildFlags` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `autoBuildFlags` field in the current package.json `opencv4nodejs` object. | ||
- The `OPENCV4NODEJS_AUTOBUILD_FLAGS` environement variable. | ||
Choose the openCV version you want to build default value is `3.4.16`. | ||
### autoBuildWithoutContrib | ||
Can be set using the environment variables *OPENCV4NODEJS_AUTOBUILD_WITHOUT_CONTRIB* | ||
Set any value to enable, this option will skip openCV Contribs. | ||
This option value can be enable using: | ||
- The `--nocontrib` in build script | ||
- The `autoBuildWithoutContrib` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `autoBuildWithoutContrib` field in the current package.json `opencv4nodejs` object. | ||
- The `OPENCV4NODEJS_AUTOBUILD_WITHOUT_CONTRIB` environement variable. | ||
### disableAutoBuild | ||
Set any value to disable compilation from sources. | ||
This option value can be enable using: | ||
- The `--nobuild` in build script | ||
- The `disableAutoBuild` options field provided to `OpenCVBuildEnv` constructor options. | ||
- The `disableAutoBuild` field in the current package.json `opencv4nodejs` object. | ||
- The `OPENCV4NODEJS_DISABLE_AUTOBUILD` environement variable. | ||
Can be set using the environment variables *OPENCV4NODEJS_DISABLE_AUTOBUILD* | ||
Set any value to disable compilation from sources. | ||
### opencvIncludeDir | ||
@@ -116,8 +189,7 @@ | ||
```bash | ||
OPENCV4NODEJS_AUTOBUILD_FLAGS=-DBUILD_LIST=core,imgproc,imgcodecs,videoio,highgui,video,calib3d,features2d,objdetect,dnn,ml,flann,photo,stitching,gapi | ||
npm run build && OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION=3.4.15 OPENCV4NODEJS_AUTOBUILD_WITHOUT_CONTRIB=1 npm run do-install | ||
opencv-build-npm --flags="-DBUILD_LIST=core,imgproc,imgcodecs,videoio,highgui,video,calib3d,features2d,objdetect,dnn,ml,flann,photo,stitching,gapi" --version=3.4.15 --nocontrib | ||
``` | ||
```bash | ||
npm run build && OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION=4.5.4 OPENCV4NODEJS_AUTOBUILD_WITHOUT_CONTRIB=1 npm run do-install | ||
opencv-build-npm --version=4.5.4 --nocontrib | ||
``` |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
113769
1348
190
34
2