summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-08-07 06:07:04 (GMT)
committerSteven Knight <knight@baldmt.com>2004-08-07 06:07:04 (GMT)
commit885d6990898faedd07ad3c9e20320682e571ec7d (patch)
treea0df00d28472f3bb3cf7f35e52e2537fce8beb22 /src
parent31779f1d6730d32c4f799c7d1506ed5d7de257e0 (diff)
downloadSCons-885d6990898faedd07ad3c9e20320682e571ec7d.zip
SCons-885d6990898faedd07ad3c9e20320682e571ec7d.tar.gz
SCons-885d6990898faedd07ad3c9e20320682e571ec7d.tar.bz2
Qt fixes. (Christoph Wiedemann)
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Tool/qt.py42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py
index 0a45e55..ee55051 100644
--- a/src/engine/SCons/Tool/qt.py
+++ b/src/engine/SCons/Tool/qt.py
@@ -62,13 +62,23 @@ def checkMocIncluded(target, source, env):
moc = target[0]
cpp = source[0]
# looks like cpp.includes is cleared before the build stage :-(
- includes = SCons.Defaults.CScan(cpp, env)
+ # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/
+ path = SCons.Defaults.CScan.path_function(env, moc.cwd)
+ includes = SCons.Defaults.CScan(cpp, env, path)
if not moc in includes:
SCons.Warnings.warn(
GeneratedMocFileNotIncluded,
"Generated moc file '%s' is not included by '%s'" %
(str(moc), str(cpp)))
+def find_file(filename, paths, node_factory):
+ retval = None
+ for dir in paths:
+ node = node_factory(filename, dir)
+ if node.rexists():
+ return node
+ return None
+
class _Automoc:
"""
Callable class, which works as an emitter for Programs, SharedLibraries and
@@ -98,18 +108,14 @@ class _Automoc:
splitext = SCons.Util.splitext
objBuilder = getattr(env, self.objBuilderName)
- # To make the following work, we assume that we stay in the
- # root directory
- #old_os_cwd = os.getcwd()
- #old_fs_cwd = FS.getcwd()
- #FS.chdir(FS.Dir('#'), change_os_dir=1)
-
# some regular expressions:
# Q_OBJECT detection
q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
# cxx and c comment 'eater'
- comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)')
-
+ #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)')
+ # CW: something must be wrong with the regexp. See also bug #998222
+ # CURRENTLY THERE IS NO TEST CASE FOR THAT
+
# The following is kind of hacky to get builders working properly (FIXME)
objBuilderEnv = objBuilder.env
objBuilder.env = env
@@ -131,19 +137,21 @@ class _Automoc:
print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp)
# c or fortran source
continue
- cpp_contents = comment.sub('', cpp.get_contents())
+ #cpp_contents = comment.sub('', cpp.get_contents())
+ cpp_contents = cpp.get_contents()
h=None
for h_ext in header_extensions:
# try to find the header file in the corresponding source
# directory
hname = splitext(cpp.name)[0] + h_ext
- h = SCons.Node.FS.find_file(hname,
- (cpp.get_dir(),),
- FS.File)
+ h = find_file(hname,
+ (cpp.get_dir(),),
+ FS.File)
if h:
if debug:
print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
- h_contents = comment.sub('', h.get_contents())
+ #h_contents = comment.sub('', h.get_contents())
+ h_contents = h.get_contents()
break
if not h and debug:
print "scons: qt: no header for '%s'." % (str(cpp))
@@ -167,9 +175,6 @@ class _Automoc:
objBuilder.env = objBuilderEnv
env.Moc.env = mocBuilderEnv
- #os.chdir(old_os_cwd)
- #FS.chdir(old_fs_cwd)
-
return (target, out_sources)
AutomocShared = _Automoc('SharedObject')
@@ -233,7 +238,8 @@ def generate(env):
def uicEmitter(target, source, env):
adjustixes = SCons.Util.adjustixes
- bs = SCons.Util.splitext(str(source[0]))[0]
+ bs = SCons.Util.splitext(str(source[0].name))[0]
+ bs = os.path.join(str(target[0].get_dir()),bs)
# first target (header) is automatically added by builder
if len(target) < 2:
# second target is implementation