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. Setting up a .pro file that works for wasm_singlethread and wasm_multithread
Forum Updated to NodeBB v4.3 + New Features

Setting up a .pro file that works for wasm_singlethread and wasm_multithread

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
4 Posts 2 Posters 500 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.
  • M Offline
    M Offline
    Matthew Daskilewicz
    wrote last edited by
    #1

    I'm trying to set up a .pro file that works for both wasm_singlethread and wasm_multithread. But right now it fails on "Qt += concurrent" when using wasm_singlthread, since that module is not available. How can I do this? E.g. is there a separate scope that distinguishes wasm single vs multi? Or a scope block that would otherwise explicitly check if the concurrent module is available?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SimonSchroeder
      wrote last edited by
      #2

      QtConcurrent relies on multiple threads. It cannot work with wasm_singlethread. If you want single-threaded code, you need to write single threaded code.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Matthew Daskilewicz
        wrote last edited by
        #3

        Yes, i know. The question is how to set up a project file for qmake so that it will only run the line "Qt += concurrent" if the concurrent module exists.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SimonSchroeder
          wrote last edited by
          #4

          Now I understand a little better what you are asking. I am not sure if there is such a thing as querying if a module exists. I'm also not using wasm and don't know if you can actually distinguish between singlethreaded and multithreaded.

          Here is the easiest workaround that comes to mind: Create a CONFIG variable like singlethreaded. Then you can check for it:

          CONFIG(singlethreaded): {
          }
          else: {
            QT += concurrent
          }
          

          On the "command line" you just add qmake CONFIG+=singlethreaded ... to your call to qmake. In QtCreator under "Projects" for the wasm_singlethreaded kit you just add CONFIG+=singlethreaded as "Additional arguments" under the qmake build step.

          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