From 7eb4120a8577ac28fc8fedfec9d1eb1976c60db6 Mon Sep 17 00:00:00 2001 From: aozima Date: Sun, 16 Jun 2013 23:05:10 +0800 Subject: [PATCH 1/2] fixed bug: scons: don't throw excptions when CPPDEFINES is not defined. --- tools/codeblocks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/codeblocks.py b/tools/codeblocks.py index f46f0f1f9..9a25114e9 100644 --- a/tools/codeblocks.py +++ b/tools/codeblocks.py @@ -75,7 +75,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) From fd289ff34f7006e8d9932e83e6eef2afdc601f5f Mon Sep 17 00:00:00 2001 From: aozima Date: Sun, 16 Jun 2013 23:18:16 +0800 Subject: [PATCH 2/2] add a default codeblocks template. --- tools/codeblocks.py | 6 +++++- tools/template.cbp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tools/template.cbp diff --git a/tools/codeblocks.py b/tools/codeblocks.py index 9a25114e9..78f9629cb 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') diff --git a/tools/template.cbp b/tools/template.cbp new file mode 100644 index 000000000..ac21c8b54 --- /dev/null +++ b/tools/template.cbp @@ -0,0 +1,41 @@ + + + + + +