Skip to content

Commit b8fd442

Browse files
added Configuring Environments via package.json section to readme
1 parent 07fc798 commit b8fd442

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,40 @@ You can specify the Version of OpenCV you want to install via the script by sett
174174

175175
If you only want to build a subset of the OpenCV modules you can pass the *-DBUILD_LIST* cmake flag via the *OPENCV4NODEJS_AUTOBUILD_FLAGS* environment variable. For example `export OPENCV4NODEJS_AUTOBUILD_FLAGS=-DBUILD_LIST=dnn` will build only modules required for `dnn` and reduces the size and compilation time of the OpenCV package.
176176

177+
## Configuring Environments via package.json
178+
179+
It's possible to specify build environment variables by inserting them into the `package.json` as follows:
180+
181+
```json
182+
{
183+
"name": "my-project",
184+
"version": "0.0.0",
185+
"dependencies": {
186+
"opencv4nodejs": "^X.X.X"
187+
},
188+
"opencv4nodejs": {
189+
"disableAutoBuild": 1,
190+
"opencvIncludeDir": "C:\\tools\\opencv\\build\\include",
191+
"opencvLibDir": "C:\\tools\\opencv\\build\\x64\\vc14\\lib",
192+
"opencvBinDir": "C:\\tools\\opencv\\build\\x64\\vc14\\bin"
193+
}
194+
}
195+
```
196+
197+
The following environment variables can be passed:
198+
199+
- autoBuildBuildCuda
200+
- autoBuildFlags
201+
- autoBuildOpencvVersion
202+
- autoBuildWithoutContrib
203+
- disableAutoBuild
204+
- opencvIncludeDir
205+
- opencvLibDir
206+
- opencvBinDir
207+
177208
<a name="usage-with-docker"></a>
178209

179-
## Usage with Docker
210+
# Usage with Docker
180211

181212
### [opencv-express](https://github.com/justadudewhohacks/opencv-express) - example for opencv4nodejs with express.js and docker
182213

@@ -192,7 +223,7 @@ Different OpenCV 3.x base images can be found here: https://hub.docker.com/r/jus
192223

193224
<a name="usage-with-electron"></a>
194225

195-
## Usage with Electron
226+
# Usage with Electron
196227

197228
### [opencv-electron](https://github.com/justadudewhohacks/opencv-electron) - example for opencv4nodejs with electron
198229

@@ -213,7 +244,7 @@ const cv = require('opencv4nodejs');
213244

214245
<a name="usage-with-nwjs"></a>
215246

216-
## Usage with NW.js
247+
# Usage with NW.js
217248

218249
Any native modules, including opencv4nodejs, must be recompiled to be used with [NW.js](https://nwjs.io/). Instructions on how to do this are available in the **[Use Native Modules](http://docs.nwjs.io/en/latest/For%20Users/Advanced/Use%20Native%20Node%20Modules/)** section of the the NW.js documentation.
219250

0 commit comments

Comments
 (0)