zebreus / qt-webassembly-docker

A container for building Qt applications for the web platform using Qt for WebAssembly.
MIT License
16 stars 8 forks source link

Does it support cache ? #1

Closed patrickelectric closed 4 years ago

patrickelectric commented 4 years ago

I'm running it with the emscript cache variable:

-v ~/.emscripten_cache:/root/.emscripten_cache

But it appears that it does not work .

Is it possible somehow to add any argument to improve the compilation time ?

zebreus commented 4 years ago

The default emscripten cache location (EM_CACHE) is set to /emsdk_portable/.data/cache. This directory already contains some precompiled system libraries. If you use your own cache location, your first build will be slower, as all system libraries will be created, but subsequent builds should be quite a bit faster.

You can add this to use a local directory as cache:

-v ~/.emscripten_cache:/emsdk_portable/.data/cache

If you use some of the emscripten ported libraries, you can reduce the build time by a few seconds by caching /emsdk_portable/.data/ports.

You can also increase the compilation speed a bit by using a parallel build (make -j).

If you disable all optimizations you can reduce your build time significantly . Just add this to your project file:

QMAKE_CXXFLAGS_RELEASE -= -O3
QMAKE_CXXFLAGS_RELEASE *= -O0

QMAKE_LFLAGS_RELEASE -= -O3
QMAKE_LFLAGS_RELEASE *= -O0
patrickelectric commented 4 years ago

Hi @Zebreus and thank you very much for your comments, it may be worth to add such instructions in the README they are really helpful for development.