[Solved] How to build Qt into a separate directory from the source ?
-
Like Qt Creator do.
e.g. I pull the source into dir D:\Qt\qt_source, I want to build it into D:\Qt\build0421.I found this when I type configure -help
@
-prefix <dir> ...... This will install everything relative to <dir>
(default $QT_INSTALL_PREFIX)
@But it seems no use.
I cd into D:/Qt/build0421, and configure:
@
..\qt_source\configure -prefix ..\build0421 -debug-and-release <some_other_options>
@Then I opened d:\build0421\qtbase\include\QtCore\qabstractanimation.h, it contains:
@
#include "../../../../qt_source/qtbase/src/corelib/animation/qabstractanimation.h"
@It is obviously wrong to have 'qt_source' in the include path.
I had many tries. The include path always contains 'qt_source' as long as I configure Qt outside the source directory.
How can I build Qt into a separate directory?
Thank you !
-
Did you try to use the forward slash '/' as separator in your path?
-
Do you mean this?
@
..\qt_source\configure -prefix ../build0421/ -debug-and-release <some_other_options>
@Just tried. The result d:\build0421\qtbase\include\QtCore\qabstractanimation.h still wrong. (contains ‘qt_source’)
Because I'm actually in the directory D:/Qt/build0421, so I also tried:
@
..\qt_source\configure -prefix ./ -debug-and-release <some_other_options>
@Still wrong.
Besides, ../qt_source/configure <xxxxx> do not work, because Windows command prompt doesn't recognize it.
-
Tried absolute path so I can use forward slash:
@
D:\Qt\build0421>d:/Qt/qt_source/configure -prefix D:/Qt/build0421/ -debug-and-release -opensource -mp -nomake examples -nomake tests -nomake webkit -no-vcproj
@Still wrong..
Do you successfully built Qt into a separate directory on Windows?
Thank you !
-
[quote author="weiyuemin" date="1366547924"]Tried absolute path so I can use forward slash:
@
D:\Qt\build0421>d:/Qt/qt_source/configure -prefix D:/Qt/build0421/ -debug-and-release -opensource -mp -nomake examples -nomake tests -nomake webkit -no-vcproj
@Still wrong..
Do you successfully built Qt into a separate directory on Windows?
Thank you ![/quote]
Yes, it did build Qt 4.8.4 about 2 month ago and I have used a build directory. The guide I had used and updated afterwards is this "wiki entry.":http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW
Apparently, I have not used the prefix. At least it is not reported in configure.cache. However, following more or less the recipe of the wiki was successful.
-
I've read that wiki entry and tried again using configure.cache and configure -redo
Still the same results.My build0421\qtbase\include\QtCore\qabstractanimation.h: (a single line)
@
#include "../../../../qt_source/qtbase/src/corelib/animation/qabstractanimation.h"
@I think it should copy the qt_source/qtbase/src/corelib/animation/qabstractanimation.h to the build directory, not use such a strange include method.
One difference is I'm using msvc command prompt and you're using mingw.
BTW, I'm not familiar with mingw. If I built Qt using mingw, was that means I can't use it via vsaddin and I can only use it via QtCreator?
-
I have been using msvc2005 with vsaddin over a couple of years. In general the building process shouldn't make much difference. Especially the configure itself at the begin is the same for msvc and mingw. So, I do not really expect a difference there.
Last year I decided to give Qt creator a shot. Especially you can use it also on other platforms (e.g. linux). It should save stupid fiddling around there, when bringing over my source.
MinGW supports C++11 standard at least to some point AFAIK.
Looking back it was not the best time to make a switch to MinGW and creator, because of the MinGW compiler support from Qt.To answer your question. When using MinGW compiler you should use Qt creator as IDE. I am not aware that you can even use it with msvc IDE, even so I think you can use other compilers such as from Intel.
You did not indicate which Qt version you plan to use. With Qt 5 it is the easiest at the time being. There is the complete SDK bundled with MinGW V4.7 compiler and Qt creator.
For the use of Qt4 with MinGW, you have o be aware that those libs are created with MinGW 4.4 which you cannot officially download from MinGW's pages. You need to dig a bit here in devnet. Not too long ago someone posted the link for MinGW V4.4 compiler. However, you need this if you are planning to use it with the currently downloadable pre-build of Qt 4.8.4.
In general you need to have the proper matching compiler and its versions. You cannot mix. Neither within MinGW nor within different msvc versions.
BTW which msvc do you plan to use?
For starting the pre-builds are in my opinion the best option. -
Thank you for writing so long :)
I'm using msvc2010.
I've tried 5.0.0, 5.0.1, 5.0.2 (pre-builds), 5.1alpha, and some versions from git before 5.1alpha.
I'm eager to use these new versions because of QWidget::createWindowContainer.But recently I found 5.1alpha contains some critical bugs so I plan to come back to 5.0.2. I downloaded the windowContainer from https://codereview.qt-project.org/#change,44285 , patching it onto 5.0.2.
While compiling these version, I found building within the source directory makes the directory dirty. i.e. If I built it again, it will probably fail. Besides, I would like to copy the build result to my partners, so if I could build it in other directory, the size of the directory would be smaller.
I also think there wouldn't be much difference between msvc and mingw, at lease in the configure step. Anyway, it would not be a barrier for me. So I've already moved on to other problems, skipping this problem.
Thank you :)
-
I don't know why it isn't mentioned in docs (or maybe I haven't found it) my friend told me to do this: when you set the prefix in configure settings and then run nmake, you have to, when it's finished, run
bq. nmake install
and it will copy builded files to your directory. Ofc the qt_source folder you can remove after that.
-
Hi bee.
Your method do achieve what I need !
Thank you :)