[cig-commits] commit: When using frameworks we need to prefix any headers

Mercurial hg at geodynamics.org
Mon Nov 24 11:22:43 PST 2008


changeset:   23:6c02183c0d3b
user:        LukeHodkinson
date:        Mon Feb 11 03:13:04 2008 +0000
files:       SConsUtils
description:
When using frameworks we need to prefix any headers
with the framework name before including.

Not bothering to check for packages in non-existant
directories.


diff -r 382f9bbb0274 -r 6c02183c0d3b SConsUtils
--- a/SConsUtils	Mon Feb 11 00:44:34 2008 +0000
+++ b/SConsUtils	Mon Feb 11 03:13:04 2008 +0000
@@ -206,6 +206,7 @@ return 0;
 
         # Add any frameworks that may exist representing this package here.
         self.frameworks = []
+	self.framework_hdr_prefix = ''
 
         # Set this flag if RPATH's are needed for this package.
         self.use_rpath = False
@@ -429,6 +430,10 @@ return 0;
                     lib_dir = [h for h in lib_dir \
                                    if h not in self.def_lib_dirs]
 
+		# If we have nothing, skip.
+		if not (base and hdr_dir and lib_dir):
+		    continue
+
                 # Permute with libraries.
                 for l in libs:
                     if isinstance(l, tuple):
@@ -442,6 +447,19 @@ return 0;
                     if self.check_state:
                         if not self.check_state(state):
                             continue
+
+		    # If any of the directories don't exist, skip.
+		    okay = True
+		    for h in hdr_dir:
+		    	if not os.path.exists(h):
+			    okay = False
+			    break
+		    for l in lib_dir:
+		    	if not os.path.exists(l):
+			    okay = False
+			    break
+		    if not okay:
+		    	continue
 
                     # Store in state array.
                     self.states += [state]
@@ -464,7 +482,7 @@ return 0;
             s.teardown(ctx.env)
 
     def check(self, ctx, state):
-        hdr_src = self.string_hdrs()
+        hdr_src = self.string_hdrs(state)
         ver_src = self.string_ver()
         src = self.check_src % (hdr_src, ver_src, self.func_src)
 
@@ -472,10 +490,12 @@ return 0;
         res = ctx.TryRun(src, '.c')
         return res
 
-    def string_hdrs(self):
+    def string_hdrs(self, state):
         txt = ''
         if self.hdrs:
             for h in self.hdrs:
+		if state.frameworks and self.framework_hdr_prefix:
+		    h = os.path.join(self.framework_hdr_prefix, h)
                 txt += '#include<%s>\n' % h
         return txt
 



More information about the CIG-COMMITS mailing list