[Scons-users] Qt4 tool: adding variant dir to include path of source dir

Kyle J Strand Kyle.Strand at beckman.com
Fri Aug 10 12:55:23 EDT 2012


I'm trying to use the Qt4 tool to take interface files (*.ui) and build
the corresponding header files into a variant directory, rather than the
original source directory. These header files are then included by other
source files in the original source directory. Therefore I need to include
the variant dir in the include path for the source directory. Does anyone
know what the easiest and most SCons-ish way to do this would be? I don't
see any support for such an option in either the Qt4 tool itself or the
documentation for VariantDir(). Almost as useful would be functions to
just get the source directory and the variant directory that are currently
being used, which I could then feed into another set of functions to
generate the relative path from one to the other and then explicitly add
that path to the include path for the source directory.

If possible, I'd like to only modify the include path when I actually call
the Uic4() builder from the Qt4 tool, because I have a whole tree of
variant directories for intermediate build files (*.obj, etc) that mirrors
the original directory structure of my source tree, and I don't want to be
forced to have the entire intermediate file tree in the include path for
the entire source tree.

To clarify exactly what it is I want, here's some pseudocode for the way
I'll try to implement it if no such option is available. This code would
go inside of a method that would be used whenever I want to call Uic4().
VariantDir() will already have been called at this point.

current_dir = (os.getcwd())
# I've observed that cwd is actually inconsistent; sometimes it's in the
source tree,
# other times it's in the intermediate build tree. So I need to check
which is the case.
if current_dir is in the intermediate tree:
current_build_path = current_dir
current_source_path = GetCorrespondingSourceDir(current_dir)
# As far as I can tell, the only way to implement
GetCorrespondingSourceDir (above)
# would be to directly parse and manipulate the string version of
current_dir using
# functions from os.path. This shouldn't be terribly difficult, but it
would be a pain.
else:
current_source_path = current_dir
current_build_path = GetCorrespondingBuildDir(current_dir)
# Like GetCorrespondingSourceDir above, I'd have to implement
# GetCorrespondingBuildDir using os.path.
relative_build_path = relative path from current_source_path to
_current_build_path
# I already have a function to get the relative path needed above, so this
part is not a problem.
thisPackage.AddIncludePath(relative_build_path) # This function is also
already implemented.
interface_headers = env.Uic4(interface_list)



Thanks,
KJS

-----------------------------------------------------------------------
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036
The server made the following annotations

---------------------------------------------------------------------------------

This message contains information that may be privileged or confidential and is the property of Beckman Coulter, Inc. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

---------------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120810/619d6a92/attachment.html>


More information about the Scons-users mailing list