如何从源代码构建Qt [英] How to build qt out of source

查看:214
本文介绍了如何从源代码构建Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几天,我在Qt论坛和Google上进行了大量搜索,但是找不到这个问题的明显答案.

我发现可以提供-prefix选项(甚至在Windows上也没有记录)来配置以指定不同的安装目录,但这并不能完全清除源代码和二进制文件,因为构建仍在源目录,然后将安装所需的文件复制到安装目录.我尝试了此-prefix选项,但遇到了一些问题. (即,它不会将.pdb文件复制到安装目录.)

然后我发现此链接关于进行阴影构建,但是它有一个很大的限制,那就是构建目录必须与源目录处于同一级别.


我猜你没有尝试使 安装?所以尝试一下.它应该 将Qt安装到单独的目录 远离源头.

您是说在完成配置之后,我应该进行nmake安装,而不是仅仅进行nmake吗?我知道nmake将处理从qmake生成的makefile并将其放置在源Qt目录中,但是nmake install会确切地执行该操作,即将文件安装在哪个目录中以及如何指定文件的安装目录. /p>

请注意,我已经这样做了:

configure -prefix builddir -platform win32-msvc2005
nmake install

以上两行的效果是qt是在源目录中编译的,而不是直接编译到我用前缀指定的builddir中.然后将编译后的文件复制到我的builddir中.我希望可以将Qt文件直接构建到构建目录中,因为这样,在编译过程中我仍然需要4 Gb空间作为源目录.另外,pdb文件没有复制到我的buildir中,这是另一个问题.

解决方案

基本上,您只需要从构建目录中运行configure.exe.例如:

mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005

源位于\qt\4.5.2-sources中,这将导致该版本进入当前驱动器上的\qt\4.5.2-build中.

此外,您必须在PATH中包含perl,建议使用ActiveState Perl.

我以前没有听说过此限制,即构建目录和源目录必须处于同一级别.如果遇到此问题,则可以尝试通过创建符号链接来解决它(请参见mklink命令).

I was searching a lot through Qt forums and Google for the last few days, but I could not find any obvious answer to this question.

I found the -prefix option (not even documented on Windows) that can be supplied to configure to specify different install directory, but this is not clear separation of the sources and binaries at all, since the build is still done in the source directory and then the files needed for installation are copied to the install directoy. I tried this -prefix option, and came to some problems. (i.e It doesn't copy the .pdb files to the install directory.)

Then I found this link about doing shadow builds but it has the big limitation that the build dir must be at the same level as the source dir.


I'm guessing you didn't try make install? So try that. It should install Qt to a separate directory away from the sources.

Are you saying that after I do configure, I should do nmake install instead just nmake? I know that nmake will process the generated makefiles from qmake and will place them in the source Qt dir, but what nmake install will exactly do i.e in which directory will install the files and how to specify the directory where the files will be installed.

Note that I already do this:

configure -prefix builddir -platform win32-msvc2005
nmake install

The effect of the above two lines was that qt was compiled in the source dir and not directly to my builddir specified with prefix. Then the compiled files were copied in my builddir. I was hoping for something that will build my Qt files directly to the build dir, cause this way I stil need 4 Gb space for my source dir during the compilation. Also the pdb files were not copied to my buildir which is another issue.

解决方案

Basically, you just have to run configure.exe from your build directory. For example:

mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005

Where sources are in \qt\4.5.2-sources, that would cause the build to go into \qt\4.5.2-build on the current drive.

Also, you must have perl in your PATH, ActiveState Perl is suggested.

I had not previously heard of this limitation where the build and source directories must be at the same level. If you hit this problem you could try working around it by creating a symbolic link (see mklink command).

这篇关于如何从源代码构建Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆