Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Qt Widget for WASM and CMake command line..
Forum Updated to NodeBB v4.3 + New Features

Qt Widget for WASM and CMake command line..

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
11 Posts 3 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 1XU7

    Hello!

    I'm looking to compile my wasm cmake qt widget project from command line, since there are a lot of stuffs to do with Cmake (most probable), i have created a new project in Qt Creator and wanted to use from command line:

    1- Created a new Qt Widget project
    2- Used CMake
    3- Selected Web Assembly kit
    4.- Qt worked in background, its looks like it prepared Cmake environment (or something like that)
    5.- tried an example and ran well..
    6.- I have closed then Qt Creator and went to Windows's command line console.
    7- cd to my project directory

    8.- tried this:

    cmake.exe -S . -B .\build\
    
    but then i get this output:
    -- Building for: Visual Studio 17 2022
    -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22000.
    -- The CXX compiler identification is MSVC 19.38.33133.0
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Error at CMakeLists.txt:12 (find_package):
      Could not find a configuration file for package "QT" that is compatible
      with requested version "".
    
      The following configuration files were considered but not accepted:
        C:/F/Qt/6.6.1/wasm_multithread/lib/cmake/Qt6/Qt6Config.cmake, version: 6.6.1 (32bit)
    -- Configuring incomplete, errors occurred!
    

    Why CMake worked in Qt Creator and not in Command line?.. it is just the same command.
    thanks in advance.

    Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @1XU7 said in Qt Widget for WASM and CMake command line..:

    C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe

    This does not look like it's the correct compiler for wasm. Check what's set for in QtCreator and use this on the command line too.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    1 1 Reply Last reply
    1
    • Christian EhrlicherC Christian Ehrlicher

      @1XU7 said in Qt Widget for WASM and CMake command line..:

      C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe

      This does not look like it's the correct compiler for wasm. Check what's set for in QtCreator and use this on the command line too.

      1 Offline
      1 Offline
      1XU7
      wrote on last edited by
      #3

      @Christian-Ehrlicher Hi..

      yeah, thats right.. i was looking now into the Qt Creator wasm flags and found (image attached)

      compiler.jpg

      that CMAKE_C_COMPILER is emscripten so i need somehow tell to CMake that flag with that path, maybe Mscv is selected automagicaly.

      Do i need to set all those Qt Creator WASM flags manually in the command line?.. (is not a problem at all just curious)

      Thanks

      Christian EhrlicherC 1 Reply Last reply
      0
      • 1 1XU7

        @Christian-Ehrlicher Hi..

        yeah, thats right.. i was looking now into the Qt Creator wasm flags and found (image attached)

        compiler.jpg

        that CMAKE_C_COMPILER is emscripten so i need somehow tell to CMake that flag with that path, maybe Mscv is selected automagicaly.

        Do i need to set all those Qt Creator WASM flags manually in the command line?.. (is not a problem at all just curious)

        Thanks

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #4

        @1XU7 said in Qt Widget for WASM and CMake command line..:

        Do i need to set all those Qt Creator WASM flags manually in the command line?.. (is not a problem at all just curious)

        Yes. Clean build dir. add -DCMAKE_C_COMPILER=... -DCMAKE_CXX_COMPILER=... to your cmake call.
        When calling 'Run cmake' in QtCreator you should also see the complete command line used to generate the project.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          @1XU7 said in Qt Widget for WASM and CMake command line..:

          Do i need to set all those Qt Creator WASM flags manually in the command line?.. (is not a problem at all just curious)

          Yes. Clean build dir. add -DCMAKE_C_COMPILER=... -DCMAKE_CXX_COMPILER=... to your cmake call.
          When calling 'Run cmake' in QtCreator you should also see the complete command line used to generate the project.

          1 Offline
          1 Offline
          1XU7
          wrote on last edited by
          #5

          @Christian-Ehrlicher good, thanks, i will try..

          MesrineM 1 Reply Last reply
          0
          • 1 1XU7

            @Christian-Ehrlicher good, thanks, i will try..

            MesrineM Offline
            MesrineM Offline
            Mesrine
            wrote on last edited by
            #6

            @1XU7
            It is better if you use

            /F/Qt/6.6.1/wasm_multithread/bin/qt-cmake
            

            Instead of raw cmake. That will add the needed configuration for qt projects.
            If using qt-cmake you do not need to set the compilers to cmake.

            1 1 Reply Last reply
            1
            • MesrineM Mesrine

              @1XU7
              It is better if you use

              /F/Qt/6.6.1/wasm_multithread/bin/qt-cmake
              

              Instead of raw cmake. That will add the needed configuration for qt projects.
              If using qt-cmake you do not need to set the compilers to cmake.

              1 Offline
              1 Offline
              1XU7
              wrote on last edited by
              #7

              @Christian-Ehrlicher

              After adding the flags on command line.. i got this:
              cmake2.jpg

              @Mesrine i tried using qt-cmake too.. this is the output..

              cmake3.jpg

              MesrineM 1 Reply Last reply
              0
              • 1 1XU7

                @Christian-Ehrlicher

                After adding the flags on command line.. i got this:
                cmake2.jpg

                @Mesrine i tried using qt-cmake too.. this is the output..

                cmake3.jpg

                MesrineM Offline
                MesrineM Offline
                Mesrine
                wrote on last edited by
                #8

                @1XU7

                The cmake methods from Qt could not read the \F\emdsk/.emscripten file.

                This is a configuration file to find everything related to emscripten.
                You need to check that the file exists and have the right to read it.
                Could be also something related to /\ in the path, I can not help you with that because I do not know how Windows works.

                1 1 Reply Last reply
                1
                • MesrineM Mesrine

                  @1XU7

                  The cmake methods from Qt could not read the \F\emdsk/.emscripten file.

                  This is a configuration file to find everything related to emscripten.
                  You need to check that the file exists and have the right to read it.
                  Could be also something related to /\ in the path, I can not help you with that because I do not know how Windows works.

                  1 Offline
                  1 Offline
                  1XU7
                  wrote on last edited by
                  #9

                  @Mesrine hi, thanks..

                  yes, file exists, but you are right, there is something wrong with / it looks like \ is being considered as escape sequence or something like that.. do you know where can i edit that path?..i could use the unix based pathname..

                  MesrineM 1 Reply Last reply
                  0
                  • 1 1XU7

                    @Mesrine hi, thanks..

                    yes, file exists, but you are right, there is something wrong with / it looks like \ is being considered as escape sequence or something like that.. do you know where can i edit that path?..i could use the unix based pathname..

                    MesrineM Offline
                    MesrineM Offline
                    Mesrine
                    wrote on last edited by
                    #10

                    @1XU7

                    This is strange, you can edit the file cmake is complaining

                    /Qt/6.7.0/wasm_singlethread/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake
                    

                    Adapt to your system the previous path.

                    I can not say this is a bug of Qt for Windows but it looks like it.

                    1 1 Reply Last reply
                    0
                    • MesrineM Mesrine

                      @1XU7

                      This is strange, you can edit the file cmake is complaining

                      /Qt/6.7.0/wasm_singlethread/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake
                      

                      Adapt to your system the previous path.

                      I can not say this is a bug of Qt for Windows but it looks like it.

                      1 Offline
                      1 Offline
                      1XU7
                      wrote on last edited by
                      #11

                      @Mesrine i will try using linux and comment..
                      thanks.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved