User 'FRAMEWORKS' instead of 'LIBS' on darwin (macosx)
[qtscons.git] / qt4.py
diff --git a/qt4.py b/qt4.py
index 2e02775..e91702b 100644 (file)
--- a/qt4.py
+++ b/qt4.py
@@ -199,8 +199,9 @@ AutomocStatic = _Automoc('StaticObject')
 
 def _detect(env):
     """Not really safe, but fast method to detect the QT library"""
-    try: return env['QTDIR']
+    try: env['QTDIR']
     except KeyError: pass
+    else: return env.Dir(env.subst('$QTDIR')).abspath
 
     try: return os.environ['QTDIR']
     except KeyError: pass
@@ -469,19 +470,18 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
     if sys.platform in ["darwin", "linux2"] and not crosscompiling :
         if debug : debugSuffix = '_debug'
         for module in modules :
-            if module not in pclessModules : continue
-            self.AppendUnique(LIBS=[module+debugSuffix])
-            self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])
+            if sys.platform == "darwin":
+                self.AppendUnique(FRAMEWORKS=[module+debugSuffix])
+                self.AppendUnique(FRAMEWORKPATH=[os.path.join("$QTDIR","lib")])
+            else:
+                self.AppendUnique(LIBS=[module+debugSuffix])
+                self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])
             self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4")])
             self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4",module)])
-        pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ]
-        if 'QtDBus' in pcmodules:
+        if 'QtDBus' in modules:
             self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4","QtDBus")])
-        if "QtAssistant" in pcmodules:
+        if "QtAssistant" in modules:
             self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt4","QtAssistant")])
-            pcmodules.remove("QtAssistant")
-            pcmodules.append("QtAssistantClient")
-        self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules))
         self["QT4_MOCCPPPATH"] = self["CPPPATH"]
         return
     if sys.platform == "win32" or crosscompiling :
@@ -547,7 +547,7 @@ def qt4glob(env):
                 if not f.name.startswith("qrc_") and not f.name.startswith("moc_") ]
     return sources + resources
 
-def scanResourceDirectory(directory, prefix="", exclude=[]):
+def scanResourceDirectory(directory, root, prefix="", exclude=[]):
     rv = [
         '<!DOCTYPE RCC>',
         # '<?xml version="1.0" encoding="utf-8"?>',
@@ -556,14 +556,16 @@ def scanResourceDirectory(directory, prefix="", exclude=[]):
         rv.append('<qresource prefix="%s">' % os.path.join(prefix, base[len(str(directory)):]))
         for f in files:
             if not [True for pattern in exclude if fnmatch.fnmatch(f,pattern)]:
-                rv.append('<file alias="%s">%s</file>' % (f, os.path.join(base, f)))
+                rv.append('<file alias="%s">%s</file>'
+                          % (f, directory.fs.File(os.path.join(base, f)).get_path(root)))
         rv.append("'</qresource>'")
     rv.append('</RCC>\n')
     return '\n'.join(rv)
 
 def resourceDirectory(env, target, source):
     file(str(target[0]), 'w').write(scanResourceDirectory(
-            source[0], prefix=env.get('RESOURCE_PREFIX', ''), exclude=env.get('EXCLUDE', [])))
+            source[0], root=target[0].dir,
+            prefix=env.get('RESOURCE_PREFIX', ''), exclude=env.get('EXCLUDE', [])))
 
 def exists(env):
     return _detect(env)