gyf304 / cura-emscripten

4 stars 1 forks source link

Reproducable build: How was curaworker.wasm compiled? #1

Open D1plo1d opened 5 years ago

D1plo1d commented 5 years ago

This is a very cool proof of concept and I would like to re-use the emscripten work you've done here as part of a larger open source 3D printing software (https://tegh.io).

My issue is that I would like to compile a newer version of Cura and I am somewhat stuck without documentation on how this build was created.

If you have any documentation on how you built Cura with emscripten that you could share it would be greatly appreciated.

Cheers, Rob

gyf304 commented 5 years ago

Hi! This is a while back and I don't really recall how I got it to compile in the first place. CuraEngine has evolved quite a bit since then. I will suggest first try installing emcc and exporting CC=emcc and CXX=emcc as environment variables and see how far you can go with the build. I'm happy to help and I will see if I can revisit this and put some documentation / script in the repo.

D1plo1d commented 5 years ago

That's great, thanks @gyf304. I will try emcc + env varaibles as soon as I can but I've hit a bit of an issue.

I tried downloading emscripten but I'm in quite a remote area at the moment and the download's stalling at 7%. I think I'll have to get back to you once I'm somewhere with real bandwidth.

Can't wait to see if we can get this compiling though. Give you a shout when I've got proper wifi again!

D1plo1d commented 4 years ago

After a tiny 1 year hiatus I took a stab at this today. So far this gets me a build where when I load it up I can see the cura engine help output in the firefox console. Work in progress but progress none the less!

git clone https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine
mkdir build
cd build
emcmake cmake .. -DENABLE_ARCUS=OFF
emmake make
Wakeful-Cloud commented 4 years ago

@D1plo1d Not to steal gyf304's thunder and you may have already figured this out/moved on, but you may want to check out GitHub.com/Cloud-CNC/cura-wasm/blob/master/docker/Make.sh

Relevant code:

export EMMAKEN_CFLAGS="-O3 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_ES6=1 -s EXPORT_NAME='CuraEngine' -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"callMain\", \"FS\"]' -s INVOKE_RUN=0 -s MODULARIZE=1 -s SINGLE_FILE=1 -s USE_ES6_IMPORT_META=0"
emcmake cmake -DENABLE_ARCUS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF ..

I built everything in Docker so it should be fairly easy to reproduce, the Dockerfile is here.

D1plo1d commented 4 years ago

Thanks @Wakeful-Cloud! Oh wow, so it sounds like we may be working on similar projects - check it out: https://tegapp.io/

Wakeful-Cloud commented 4 years ago

@D1plo1d Will do, thanks!