-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add experimental support for WebAssembly #20
base: master
Are you sure you want to change the base?
Conversation
README.md
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a link to http://webassembly.org/getting-started/developers-guide/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about following directory structure?
build
|----js
| |---- cv.js
| |---- cv.data
|----wasm
|----cv.wasm
|----cv.data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.