summaryrefslogtreecommitdiff
path: root/tools/codeblocks.py
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2013-06-23 07:40:32 +0800
committerBernard Xiong <[email protected]>2013-06-23 07:40:32 +0800
commitc5927f51b3dcba72aea4aca26fdb3bffb1d6f763 (patch)
tree6a8ac1e323e765e8f9d77c52f450a2fd61960ad4 /tools/codeblocks.py
parentf837ea41b1a263e2a3dfc2d4d4d9f0dfe31cb670 (diff)
parent0633e9853c6ce4713a28812a1200a2f77a366a40 (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'tools/codeblocks.py')
-rw-r--r--tools/codeblocks.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/codeblocks.py b/tools/codeblocks.py
index f46f0f1f93..78f9629cbb 100644
--- a/tools/codeblocks.py
+++ b/tools/codeblocks.py
@@ -38,8 +38,12 @@ def CB_AddCFiles(ProjectFiles, parent, gname, files, project_path):
def CBProject(target, script, program):
project_path = os.path.dirname(os.path.abspath(target))
+
+ if os.path.isfile('template.cbp'):
+ tree = etree.parse('template.cbp')
+ else:
+ tree = etree.parse(os.path.join(os.path.dirname(__file__), 'template.cbp'))
- tree = etree.parse('template.cbp')
root = tree.getroot()
out = file(target, 'wb')
@@ -75,7 +79,7 @@ def CBProject(target, script, program):
Add = SubElement(elem, 'Add')
Add.set('directory', path)
- for macro in building.Env['CPPDEFINES']:
+ for macro in building.Env.get('CPPDEFINES', []):
Add = SubElement(elem, 'Add')
Add.set('option', "-D"+macro)