How to have my .pro depend on qt.pro ?
-
So i've finally been able to build the Qt sources (mac).
Now i'd like to open the "qt.pro" file (or whatever is appropriate), and have MY project "depend" on it, such that, in Qt Creator, i can edit any Qt code, and then just hit the "start debugging of startup project" button, and it will compile any Qt sources i've edited, stage them into place wherever they need to go, then compile and link my project to them, and launch.
How do i accomplish this?
attempting to open "qt.pro" results in a hang of my system, with the "issues" panel becoming overloaded with problems.
-
@davecotter There is no need to open qt.pro file to debug into Qt sources. You need to add your Qt sources in QtCreator "Options/Debugger/Source Paths Mapping" -> click on "Add Qt Sources". Then build your app using Qt you built from the sources you added.
-
Thank you, but I have that part already figured out.
The part that I need to answer this question is how do I edit the source code of the QT frameworks, and then just press the run button and have it all compile and link to my app?
I want to do this all from within QT creator.
-
@davecotter said in How to have my .pro depend on qt.pro ?:
The part that I need to answer this question is how do I edit the source code of the QT frameworks, and then just press the run button and have it all compile and link to my app?
It does not work that easy. If you want to change Qt code then you need to rebuild the modules you change.
There is no need to open top qt.pro file. Build only the modules you change. -
Are you saying that it is impossible to do this within QT creator? If it is possible, then how?
Say for example that I know that I want to be editing things within the multimedia module. Is there a way to add that into my QT creator project as a dependency?
-
@davecotter said in How to have my .pro depend on qt.pro ?:
Are you saying that it is impossible to do this within QT creator?
No. I never tried to load top level qt.pro file. It might be simply too much for QtCreator.
And as I said: there is no need to do so. Open the pro file from the module you want to change."Is there a way to add that into my QT creator project as a dependency?" - yes, the usual way "QT += multimedia multimediawidgets". But I guess it is not what you mean? I don't see what the point of adding the QtMultimedia aproject at source code level (the pro file from the multimedia project) to your project is.
As I said: build the Qt module you change, that's all. -
@davecotter said in How to have my .pro depend on qt.pro ?:
attempting to open "qt.pro" results in a hang of my system, with the "issues" panel becoming overloaded with problems.
When Qt Creator loads a .pro file, it expects you to specify one or more existing versions of Qt to use to build that .pro file.
However, you don't want to use an existing version of Qt to build Qt. That's the core issue.
Now i'd like to open the "qt.pro" file (or whatever is appropriate), and have MY project "depend" on it, such that, in Qt Creator, i can edit any Qt code, and then just hit the "start debugging of startup project" button, and it will compile any Qt sources i've edited, stage them into place wherever they need to go, then compile and link my project to them, and launch.
I doubt that's possible. Instead,
- Use your console to build Qt from source (you've done this already)
- In Qt Creator, set up a new Kit to use your custom build.
- In Qt Creator, set up your project to use your custom Kit.
Now, every time you edit the Qt sources,
- Use your console to run
make
and update the Qt binaries in your custom Kit. - In Qt Creator, hit the "start debugging of startup project" button. This will launch your app, linked to your updated Qt binaries.
-
@davecotter said in How to have my .pro depend on qt.pro ?:
Are you saying that it is impossible to do this within QT creator? If it is possible, then how?
Build Qt on the command line. Open the relevant project(s) from the source tree, but for the love of god don't open the root one it's going to take forever. When you're prompted to configure the project "Import build" from the directory where the
Makefile
is generated.Note 1: Dependencies for subprojects are not imported, so you need to do that manually from the creator's interface.
Note 2: You may need to point creator to the sources if it's an out of source build (e.g. not a-developer-build
)For the user project - what @JKSH wrote - configure your kit with the
qmake
you'd created. It knows the paths to Qt, so it's a breeze. Then you can build it with your own Qt build and if you wish you can make it depend (again from creator's UI) on the module you're hacking into. -
Okay, i've done as everyone suggested, and this is where i am now:
so for example, i wish to edit things in the
QtMultimedia
... what is it called? package? project? module? Anyway so at the point after i have opened the project "qtmultimedia.pro", it asks to configure the project. so i UN-check the default kit, and then next to "import build from", i click "details" then "choose", and i pick the folder in the build dir calledqtmultimedia
, the one containing theMakeFile
, then click "configure project".Seems legit. However, there seems to be a couple of problems:
First problem: as you can see, doing the above creates a new kit, but suddenly all my kits now have warnings:
Here is the warning:
It says
CMake 3.19
(the one that comes with Qt Creator) is unsupported, that i must upgrade toCMake 3.14
. (??!?). I imagine i can PROBABLY ignore this.But it also says that since CMake is unconfigured, that the CMake generator will be ignored. That seems like something I will not be able to get away with. Note i'm using Qt5, not Qt6, so is it true i'm still using Qmake and not CMake? so maybe i CAN ignore this?
Second: a problem comes along after I get the
multimedia
project opened: it seems to have loaded bothexamples
andtests
, which i do not care about or want. Does this mean that i should NOT be opening.../Src/qtmultimedia/qtmultimedia.pro
and instead should be opening.../Src/qtmultimedia/src/src.pro
? If so, when i attempt to build that within Qt Creator, i get identical errors of "error: library pulseaudio not defined"Third: what's the recommendation about
-developer-build
? I understand that regardless of "-prefix" setting, it will build within theSrc
tree, which is exactly what you do NOT want assuming you're using Git to submit your changes?Fourth: the .pro.user file is created within the
Src
tree, which is not okay with Git. How do i force Qt Creator to put that somewhere else?Fifth: assuming all the above gets straightened out, when i build in Qt Creator, note i do not do "make install". does that happen automatically? do i need a "post build step" on the "qtmultimedia/src" project to stage that into place for debug builds?
-
Hi,
@davecotter said in How to have my .pro depend on qt.pro ?:
Third: what's the recommendation about -developer-build ? I understand that regardless of "-prefix" setting, it will build within the Src tree, which is exactly what you do NOT want assuming you're using Git to submit your changes?
Out of source builds are the key.
@davecotter said in How to have my .pro depend on qt.pro ?:
Fourth: the .pro.user file is created within the Src tree, which is not okay with Git. How do i force Qt Creator to put that somewhere else?
Usually ignored by the .gitignore file.
@davecotter said in How to have my .pro depend on qt.pro ?:
Fifth: assuming all the above gets straightened out, when i build in Qt Creator, note i do not do "make install". does that happen automatically? do i need a "post build step" on the "qtmultimedia/src" project to stage that into place for debug builds?
You need a custom build step indeed.