[Scons-users] Qt tools can't find generated headers using VariantDir

Strand, Kyle J kyle.strand at beckman.com
Tue Feb 26 15:56:53 EST 2013


Thanks for your reply. That is indeed the workaround I mentioned; I was hoping it wouldn't be necessary, but it looks like it is.

________________________________
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036
________________________________
From: scons-users-bounces at scons.org [scons-users-bounces at scons.org] on behalf of Dirk Bächle [tshortik at gmx.de]
Sent: Saturday, February 23, 2013 3:59 AM
To: SCons users mailing list
Subject: Re: [Scons-users] Qt tools can't find generated headers using VariantDir

Hi Kyle,

On 23.02.2013 00:04, Strand, Kyle J wrote:
This is actually kind of a repeat of a question I've asked before on the mailing list, but it appears that the Qt4 and Qt5 tools don't properly handle using VariantDir with the duplicate set to false. Included in the Qt4 tool's test directory is a simple setup that uses VariantDir. If you change the VariantDir() call to have duplicate=0, the build fails with the error "Cannot open include file: 'ui_anUiFile.h': No such file or directory". I assume this is because when duplicate is set to false, SCons attempts to adjust pathnames according to whether they are targets or source files, and the paths to header files generated by the Qt tool are somehow improperly handled. The workaround I've found is to explicitly make the build directory an include path for files in the source directory, but this doesn't seem like it should be necessary. Is there a more appropriate way to make this work? Is this a bug in the Qt tools?


I don't think it's a bug. It's just what happens when you spread your build over two directories, without adjusting the search path for includes accordingly. ;)
Based on your "duplicate=0", SCons doesn't create a copy of MyForm.h/cpp in the build dir as was done before.
So, when the compiler looks for "ui_anUiFile.h" in the current folder (which is "." for MyForm.*), it can't be found.

For reference, here's the complete SConstruct file from the Qt4 tool's test directory, with the appropriate modification to make it fail:

import qtenv

qtEnv = qtenv.createQtEnvironment()
qtEnv.EnableQt4Modules(['QtCore','QtGui'])

qtEnv.VariantDir('bld', '.',duplicate=0)
qtEnv.Uic4('bld/anUiFile.ui')
qtEnv.Program('bld/test_realqt', ['bld/mocFromCpp.cpp',
'bld/mocFromH.cpp',
'bld/MyForm.cpp',
'bld/main.cpp'])

Note that it still fails if you use the Qt5 tool instead.


Please add a

qtEnv.Append(CPPPATH=['bld'])

, it makes the build pass on my side.

Best regards,

Dirk



Please be advised that this email may contain confidential
information. If you are not the intended recipient, please notify us
by email by replying to the sender and delete this message. The
sender disclaims that the content of this email constitutes an offer
to enter into, or the acceptance of, any agreement; provided that the
foregoing does not invalidate the binding effect of any digital or
other electronic reproduction of a manual signature that is included
in any attachment.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130226/7b9e6ca9/attachment.html>


More information about the Scons-users mailing list