[buildj] add support for targets in subdirs



commit 8fcab6bd0071d3f607a1ddf4e57f96ca9e12f2e4
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Fri Mar 26 16:58:58 2010 +0100

    add support for targets in subdirs

 buildj.py                          |   10 +++++-----
 cpprogram.cpp => cpp/cpprogram.cpp |    0
 project.js                         |    5 +++--
 wscript                            |    5 ++++-
 4 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/buildj.py b/buildj.py
index e7906d1..0c19ad2 100644
--- a/buildj.py
+++ b/buildj.py
@@ -151,13 +151,13 @@ class ProjectTarget(object):
 
 		return str(self._target["tool"])
 	
-	def get_name (self):
-		return str(self._name)
-		
 	def get_type (self):
 		if "type" not in self._target:
 			return
 		return str(self._target["type"])
+
+	def get_path (self):
+		return self._target.get ("path", "")
 		
 	def get_features (self):
 		tool = self.get_tool ()
@@ -206,8 +206,8 @@ class ProjectTarget(object):
 	def get_build_arguments (self):
 		"WAF bld arguments dictionary"
 		args = {"features": self.get_features (),
-            "source":   self.get_input (),
-            "target":   self.get_name ()}
+		        "source":   self.get_input (),
+		        "target":   self.get_name ()}
 		
 		return args
 
diff --git a/cpprogram.cpp b/cpp/cpprogram.cpp
similarity index 100%
rename from cpprogram.cpp
rename to cpp/cpprogram.cpp
diff --git a/project.js b/project.js
index ebad1dc..aa53e5d 100644
--- a/project.js
+++ b/project.js
@@ -10,7 +10,7 @@
 		"foo":
 		{
 			"description": "Sets the foo option",
-			"default":     "True"	
+			"default":     "True"
 		}
 	},
 	"requires":
@@ -19,7 +19,7 @@
 			"type":      "package",
 			"mandatory": "True"
 		},
-		"gtk+-2.0": 
+		"gtk+-2.0":
 		{
 			"type":      "package",
 			"version":   "2.14",
@@ -38,6 +38,7 @@
 		{
 			"type": "program",
 			"tool": "c++",
+			"path": "cpp",
 			"input": ["cpprogram.cpp"],
 			"uses": ["my_static_lib"]
 		},
diff --git a/wscript b/wscript
index 53a6f10..1b3eaf8 100644
--- a/wscript
+++ b/wscript
@@ -1,3 +1,4 @@
+import os
 import Utils
 import Options
 from buildj import *
@@ -93,9 +94,11 @@ def configure (conf):
 				
 def build(bld):
 	project = parse_project_file ()
-	
+
 	for target in project.get_targets ():
 		args = target.get_build_arguments ()
+		args['path'] = bld.srcnode.find_dir(target.get_path().split('/'))
+
 		bld (**args)
 
 		install_files = target.get_install_files ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]