Enable multithreading in CMake
-
@Ivan4587
First you need to compile Qt from source enabling multithreading as you said.Then you need to enable emscripten code generation for pthreads in your Cmake project like this.
I normally put this on my root CMakeLists.txt
if(EMSCRIPTEN) target_compile_options(target PRIVATE -pthread) target_link_options(target PRIVATE -pthread -sPTHREAD_POOL_SIZE=8) endif()
And this work for firefox, but not for Chrome(I think)
-
@Ivan4587 But it is not clear if you have manage to compile qt from source enabling multithreading.
In that case my previous answer will help you after you do that.
In your cmake project you need to link to the qt wasm libraries compiled with multithreading support(by using the configure flag). You should not add multi threading support to Qt libraries from your CMake project.
-
@Ivan4587 said in Enable multithreading in CMake:
-feature-thread
if you have the pro file and are able to build it with the flag, you can find out where it is added in Makefile. From there, you will be able to figure out where to add it in the cmake file.
-
@Ivan4587 said in Enable multithreading in CMake:
as i known, it is not open source anymore
It is open source. You can get Qt6 source code in exact same way as Qt5.
-