From 59b0314a0ef49d407f78742fc44fdc19bd20bf0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebasti=C3=A1n=20Gurin?= Date: Mon, 5 Aug 2019 09:41:59 -0300 Subject: [PATCH] Merge pull request #15221 from cancerberoSgx:master OpenCv.js docker container build instructions (#15221) * emscripten docker container * docker * typo * typo * whitespace issue --- .../js_setup/js_setup/js_setup.markdown | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/js_tutorials/js_setup/js_setup/js_setup.markdown b/doc/js_tutorials/js_setup/js_setup/js_setup.markdown index 5f6b43b..3740a74 100644 --- a/doc/js_tutorials/js_setup/js_setup/js_setup.markdown +++ b/doc/js_tutorials/js_setup/js_setup/js_setup.markdown @@ -7,6 +7,9 @@ Installing Emscripten [Emscripten](https://github.com/kripken/emscripten) is an LLVM-to-JavaScript compiler. We will use Emscripten to build OpenCV.js. +@note +While this describes installation of required tools from scratch, there's a section below also describing an alternative procedure to perform the same build using docker containers which is often easier. + To Install Emscripten, follow instructions of [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). For example: @@ -103,3 +106,25 @@ Building OpenCV.js from Source @note It requires `node` installed in your development environment. + +Building OpenCV.js with Docker +--------------------------------------- + +Alternatively, the same build can be can be accomplished using [docker](https://www.docker.com/) containers which is often easier and more reliable, particularly in non linux systems. You only need to install [docker](https://www.docker.com/) on your system and use a popular container that provides a clean well tested environment for emscripten builds like this, that already has latest versions of all the necessary tools installed. + +So, make sure [docker](https://www.docker.com/) is installed in your system and running. The following shell script should work in linux and MacOS: + +@code{.bash} +git clone https://github.com/opencv/opencv.git +cd opencv +docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:latest" python ./platforms/js/build_js.py build_js +@endcode + +In Windows use the following PowerShell command: + +@code{.bash} +docker run --rm --workdir /code -v "$(get-location):/code" "trzeci/emscripten:latest" python ./platforms/js/build_js.py build_js +@endcode + +@note +The example uses latest version of [trzeci/emscripten](https://hub.docker.com/r/trzeci/emscripten) docker container. At this time, the latest version works fine and is `trzeci/emscripten:sdk-tag-1.38.32-64bit` \ No newline at end of file -- 2.7.4