Creating a Visual Studio Project of qtbase for QT 5
-
As I want to change the functionality of a certain feature of the QT library (more exactly qtbase), I want to create Visual Studio project files from the source code. Unfortunaltely I have to do this for QT 5 (more exactly QT 5.15.2). So I want to know what is the intended method for creating VS project files from the source code. For past duties I created such files also for QT 6, which was straight forward using qt-cmake, using the right generator and having CMakeLists.txt files (although also here errors occured which happily could be ignored). This gave me a whole hirarchy of projects with a "super"-project called "ALL_BUILD.vcxproj". This I want here too if possible. For Qt 5 this does, however, not seem to be so easy as there are only .pro files present. I tried to create the Visual Studio project files the for .pro files intended way using
<path to qmake.exe>\qmake.exe -tp vc -r <path to qtbase.pro>\qtbase.pro
, but got an error that QMAKE_MSC_VER is not set. I set it then to 1940 (my Visual Studio version is Visual Studio 2022, version 17.10.1.) in the msvc-version.conf-file but still got the error, but only the first time I executed the code written above. Executing this code a second time, this part worked. Afterwards, however, another error "Project ERROR: Library 'pcre2' is not defined." popped up. I also think that this is not the intended way for qtbase, as in "https://forum.qt.io/topic/114743/problem-building-qtbase-from-source/4" SGaist wrote that qtbase is not built with qmake. Any help is greatly appreciated. -
Using "nmake" in subdirectories of qtbase with a Makefile in the configured directory, I am able now to build single dlls. Still needs a few minutes, but its managable. @Christian-Ehrlicher Thank you for the idea.
-
I would simply build it on the command line and then create a solution with the testcase. This is much easier.
-
That is an solution, true. But then I would have to wait half an hour or so each time after debugging to recompile the whole of qtbase, without recompiling only say widgets or core. As I am not the most familiar with Qt yet, and there is still a lot of trial and error, I would rather favour a Visual Studio project. But thank you nevertheless!
-
@sefo said in Creating a Visual Studio Project of qtbase for QT 5:
That is an solution, true. But then I would have to wait half an hour or so each time after debugging to recompile the whole of qtbase, without recompiling
Why? When you change something in QtWidgets a
ninja Widgets
builds in seconds (when not a global header was touched)... -
@Christian-Ehrlicher Oh, I did not know that this is possible. Thank you, I will try that tomorrow.
-
Using "nmake" in subdirectories of qtbase with a Makefile in the configured directory, I am able now to build single dlls. Still needs a few minutes, but its managable. @Christian-Ehrlicher Thank you for the idea.
-
-
Use ninja instead nmake as cmake generator
-
Your original problem most likely stems from the fact that you didn't have MSVC properly set up in your command line. One way is to start the Developer Command Prompt for your Visual Studio version and execute qmake.exe inside that prompt. Another way is to call something like
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
on your command line to set up MSVC and after that call qmake.exe.