Compile VTK with Emscripten For Windows

Does anybody have a docker image or binaries that have VTK compiled for Emscripten for use on Windows? I have been able to compile it for Linux and create examples, but my current project is developed on Windows with Visual Studio.

Thanks

You can use that one: dockcross/web-wasm

That’s the one we use for building VTK examples

That shows up as a Linux OS:

I can run this docker image in Windows, but it still creates Linux libraries since it is a Linux session.

Actually, can I link to the generated library files when compiling an example in Windows with Emscripten? Are these Emscripten libraries that can be used on any platform?

image

My assumption is that you want the WebAssembly result that can work anywhere. But the in-between process, in someway should be irrelevant to the end result.

What I’m trying to say is that you should use the docker image to compile your code (on the Linux in docker using your Windows host) and produce the wasm file that you are looking for.

Thanks Sebastien. I have been able to compile my code in the docker on my Windows host. I was hoping to use the Emscripten toolchain that I installed on my Windows host to directly compile my code to WebAssembly by specifying the compiler toolchain in Visual Studio. I am going to attempt to compile VTK using my installed Emscripten toolchain to see if I can generate some Windows libraries. If that doesn’t work, at least I know I can compile with the docker image.

Thanks again!

Glad you have a path to compile wasm files.

It is kind of tricky to handle every OS and that’s why such docker was created. The ITK folks did a great job to streamline such process.

I hope you’ll figure out the build process on your Windows, otherwise using that docker is not that bad.

Hello, I have successfully compiled the VTK under the docker and successfully run the example. But when running other VTK examples, it shows that there is no InteractionImage module, so the imageViewr2 class cannot be used. Add - DVTK to the compilation command_ MODULE_ ENABLE_ VTK_ InteractionImage: STRING=YES has no effect; Do you have such questions;

Could you try the updated instructions from VTK/Documentation/dev/build_wasm_emscripten.md?