Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to configure Qt Creator with emscripten compiler?



  • I downloaded the Qt5.12 beta and follow the wiki page https://wiki.qt.io/Qt_for_WebAssembly#Building_Qt.
    But, now I would like to configure the Qt creator with emscripten.

    How to configure those tabs:
    Tools->Options->Kits(Options)->compiler
    Tools->Options->Kits(Options)->Qt versions
    I included the qmake /home/Qt/5.12.0/Srcqtbase/bin/qmake
    Tools->Options->Kits(Options)->kits
    0_1539180211370_fb2ef26e-3c30-41e9-b0fa-a35593d951db-image.png

    Doesn´t matter which compiler you use. It always use emcc/em++. I think this is caused by Qt mkspec.



  • I have follow the instruction from https://gist.github.com/blockspacer/698fbca13c01ab977256849daa6cc084
    Compiled folder for my Qt-Wasm : ~/qt5
    and emscripten: ~/emsdk/emscripten/1.38.30
    for sample project : ~/qt-webassembly-examples
    And everything work well.

    I use fedora 29 and Qt 5.12. And for Qt Creator I use these configuration:

    1. Option->CMake , add the new configuration :
      Name: System Make at /usr/bin/make
      Path: /usr/bin/make

    2. Option->Compilers, Add->Custom->C and C++
      For C
      Name: EMCC
      Compiler Path: ~/emsdk/emscripten/1.38.30/emcc
      Make Path: /usr/bin/make
      ABI: x86 - linux - generic - elf - 64bit

      For C++
      Name: EMCC
      Compiler Path: ~/emsdk/emscripten/1.38.30/em++
      Make Path: /usr/bin/make
      ABI: x86 - linux - generic - elf - 64bit

    3. Option->Qt Versions, Add new configuration
      Version name: Qt %{Qt:Version} (qt5) wasm-emscripten
      qmake location: ~/qt5/qtbase/bin/qmake

    4. Option->Kits, Add new configuration
      Name: emscripten
      File system name: leave empty
      Compiler: C: EMCC, C++: EM++
      Qt Version: choose from we filled before (Qt %{Qt:Version} (qt5) wasm-emscripten), in my system is : Qt 5.12.3 (qt5) wasm-emscripten
      Qt mkspec: leave empty
      CMake Tool: System Make at /usr/bin/make

    Now try "Run qmake" on project than "Build"
    The project builder maybe at build- {project_name}-emscripten-Debug/Profile/Release.
    Go to that folder from terminal, and run using "python -mSimpleHTTPServer"

    don't forget to set kit Build&Run Setting into "emscripten"
    for test project i use the project "gui_multicanvas", u can open it from qt creator.


Log in to reply