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.4k 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 Offline
    1 Offline
    1XU7
    wrote on 16 Dec 2023, 22:29 last edited by
    #1

    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.

    C 1 Reply Last reply 17 Dec 2023, 07:14
    0
    • 1 1XU7
      16 Dec 2023, 22:29

      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.

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 17 Dec 2023, 07:14 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 17 Dec 2023, 12:51
      1
      • C Christian Ehrlicher
        17 Dec 2023, 07:14

        @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 17 Dec 2023, 12:51 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

        C 1 Reply Last reply 17 Dec 2023, 12:53
        0
        • 1 1XU7
          17 Dec 2023, 12:51

          @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

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 17 Dec 2023, 12:53 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 17 Dec 2023, 12:59
          1
          • C Christian Ehrlicher
            17 Dec 2023, 12:53

            @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 17 Dec 2023, 12:59 last edited by
            #5

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

            M 1 Reply Last reply 17 Dec 2023, 14:03
            0
            • 1 1XU7
              17 Dec 2023, 12:59

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

              M Offline
              M Offline
              Mesrine
              wrote on 17 Dec 2023, 14:03 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 17 Dec 2023, 21:15
              1
              • M Mesrine
                17 Dec 2023, 14:03

                @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 17 Dec 2023, 21:15 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

                M 1 Reply Last reply 18 Dec 2023, 07:22
                0
                • 1 1XU7
                  17 Dec 2023, 21:15

                  @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

                  M Offline
                  M Offline
                  Mesrine
                  wrote on 18 Dec 2023, 07:22 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 18 Dec 2023, 11:34
                  1
                  • M Mesrine
                    18 Dec 2023, 07:22

                    @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 18 Dec 2023, 11:34 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..

                    M 1 Reply Last reply 18 Dec 2023, 13:33
                    0
                    • 1 1XU7
                      18 Dec 2023, 11:34

                      @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..

                      M Offline
                      M Offline
                      Mesrine
                      wrote on 18 Dec 2023, 13:33 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 18 Dec 2023, 22:40
                      0
                      • M Mesrine
                        18 Dec 2023, 13:33

                        @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 18 Dec 2023, 22:40 last edited by
                        #11

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

                        1 Reply Last reply
                        0

                        5/11

                        17 Dec 2023, 12:59

                        • Login

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