Add experimental support for WebAssembly#20
Conversation
|
|
||
| 1. Get the source code (just like above) | ||
|
|
||
| 2. Install the "incoming" branch of emscripten. You can obtain emscripten by using [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). |
There was a problem hiding this comment.
Add a link to http://webassembly.org/getting-started/developers-guide/?
There was a problem hiding this comment.
Ok, something like that ?
2. Install the "incoming" branch of emscripten. You can obtain emscripten by using [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). At the time of writing, the current version of Emscripten does not support WebAssembly yet, so you will need to install the "incoming" branch (see as well WebAssembly’s [Developer’s Guide](http://webassembly.org/getting-started/developers-guide/) for a short introduction about WebAssembly).
| --- ./emscripten/master/src/embind/embind.js 2016-12-20 13:05:20.498980029 -0800 | ||
| +++ ./emscripten/master/src/embind/embind.js 2016-12-20 13:12:11.599146929 -0800 | ||
| --- ./src/embind/embind.js 2016-12-20 13:05:20.498980029 -0800 | ||
| +++ ./src/embind/embind.js 2016-12-20 13:12:11.599146929 -0800 |
There was a problem hiding this comment.
Is this file change needed?
There was a problem hiding this comment.
It makes the patch more generic, and usable with both emscripten/master and emscripten/incoming by changing just the patch command line (cf readme).
| basename = "cv" | ||
|
|
||
| destFiles = [ os.path.join('..', '..', 'build', basename + ext ) for ext in [ ".js", ".data", ".wasm" ] ] | ||
| opencv = destFiles[0] |
There was a problem hiding this comment.
How about following directory structure?
build
|----js
| |---- cv.js
| |---- cv.data
|----wasm
|----cv.wasm
|----cv.data
There was a problem hiding this comment.
Well, putting all the files in the same folder with different names seemed simpler to me for the time being, as the .js file generated by emscripten expects to find its related .data (and .wasm, in case of WebAssembly) in the same folder as the .html file.
Having all the files in the same folder with different names depending on the technology used (WebAssembly or asm.js) simplifies the use: the user can just copy everything in build/ to the folder of his/her .html file, and then either load cv.js or cv-wasm.js depending on what technology s/he wants to use.
…etter for Scalar values
…exists instead of bindings.cpp)
|
I think the compiled files are not up to date with the last source changes, are they? |
|
to be added. |
Just a few simple modifications to be able to compile to WebAssembly.