Qt Widget for WASM and CMake command line..
-
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 directory8.- 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.@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.
-
@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.
@Christian-Ehrlicher Hi..
yeah, thats right.. i was looking now into the Qt Creator wasm flags and found (image attached)
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-Ehrlicher Hi..
yeah, thats right.. i was looking now into the Qt Creator wasm flags and found (image attached)
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
@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. -
@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.@Christian-Ehrlicher good, thanks, i will try..
-
@Christian-Ehrlicher good, thanks, i will try..
-
@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 usingqt-cmake
you do not need to set the compilers to cmake. -
After adding the flags on command line.. i got this:
@Mesrine i tried using qt-cmake too.. this is the output..
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. -
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. -
@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..
-
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.