[gnoduino] allow custom names in library paths
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino] allow custom names in library paths
- Date: Mon, 9 Apr 2012 18:01:13 +0000 (UTC)
commit 64e61d2cd794ab5e1239d36dd65a247f589b4a59
Author: Lucian Langa <lucilanga gnome org>
Date: Mon Apr 9 18:53:10 2012 +0200
allow custom names in library paths
src/compiler.py | 17 +++++++++++++++--
src/preproc.py | 4 ++++
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/compiler.py b/src/compiler.py
index b58cc31..3cace72 100644
--- a/src/compiler.py
+++ b/src/compiler.py
@@ -140,6 +140,8 @@ def compile(tw, id, output, notify):
tmpdir = id
tempobj = tempfile.mktemp("", "Tempobj", id)
global p
+ global queue
+ queue = []
p = prefs.preferences()
b = board.Board()
#compile inter c objects
@@ -197,6 +199,8 @@ def compile(tw, id, output, notify):
compline=[j for j in defcpp]
compline.append("-mmcu="+b.getBoardMCU(b.getBoard()))
compline.append("-DF_CPU="+b.getBoardFCPU(b.getBoard()))
+ if misc.getArduinoVersion() >= 100:
+ compline.append("-DARDUINO=100")
compline.extend(misc.getArduinoIncludes())
flags = []
flags = preproc.generateCFlags(id, cont)
@@ -227,7 +231,10 @@ def compile(tw, id, output, notify):
for i in preproc.generateLibs(id, buf):
tmplibs.extend(validateLib(os.path.basename(i), tempobj, flags, output, notify))
compline.extend(list(set(tmplibs)))
+ compline.extend(["-I" + i for i in preproc.generateLibs(id, buf)])
compline.extend(["-I" + os.path.join(i, "utility") for i in preproc.generateLibs(id, buf)])
+ if misc.getArduinoVersion() >= 100:
+ compline.append("-DARDUINO=100")
compline.extend(misc.getArduinoIncludes())
compline.append(id+"/core.a")
compline.append("-L"+id)
@@ -319,17 +326,19 @@ def getLibraries():
def validateLib(library, tempobj, flags, output, notify):
"""compile library also try to compile every cpp under libdir"""
"""also try to compile utility dir if present"""
- paths = ["", misc.getArduinoPath(), misc.getArduinoLibsPath()]
+ paths = ["", misc.getArduinoLibsPath()]
if config.user_library != None and config.user_library != -1:
paths.extend(i.strip() for i in config.user_library.split(';'))
dirs = ["", "utility"]
b = board.Board()
res = []
fl = []
- queue = []
for d in dirs:
for q in paths:
fl = os.path.join(q, library, d)
+ """test the path directly, in case include was specified to the library directory"""
+ if fl not in set(queue) and not os.path.exists(fl):
+ fl = os.path.join(q, d)
if fl not in set(queue) and os.path.exists(fl):
queue.append(fl)
try:
@@ -338,6 +347,8 @@ def validateLib(library, tempobj, flags, output, notify):
compline = [j for j in defc]
compline.append("-mmcu="+b.getBoardMCU(b.getBoard()))
compline.append("-DF_CPU="+b.getBoardFCPU(b.getBoard()))
+ if misc.getArduinoVersion() >= 100:
+ compline.append("-DARDUINO=100")
compline.extend(misc.getArduinoIncludes())
compline.append("-I" + os.path.join(misc.getArduinoLibsPath(), library, "utility"))
compline.extend(preproc.generateCFlags(id, open(i).read()))
@@ -361,6 +372,8 @@ def validateLib(library, tempobj, flags, output, notify):
compline = [j for j in defcpp]
compline.append("-mmcu="+b.getBoardMCU(b.getBoard()))
compline.append("-DF_CPU="+b.getBoardFCPU(b.getBoard()))
+ if misc.getArduinoVersion() >= 100:
+ compline.append("-DARDUINO=100")
compline.extend(misc.getArduinoIncludes())
compline.extend(preproc.generateCFlags(id, open(i).read()))
compline.extend(flags)
diff --git a/src/preproc.py b/src/preproc.py
index b7dd0fd..72b6905 100644
--- a/src/preproc.py
+++ b/src/preproc.py
@@ -56,6 +56,10 @@ def findIncludes(instr, local=False):
my.append(os.path.join(misc.getArduinoLibsPath(), z.strip(".h")))
if config.user_library:
for q in config.user_library.split(';'):
+ fl = os.path.join(q.strip(), z)
+ if os.path.exists(fl) or os.path.exists(fl.lower()) or \
+ os.path.exists(fl.upper()):
+ my.append(q.strip())
fl = os.path.join(q.strip(), z.strip(".h"))
if os.path.exists(fl) or os.path.exists(fl.lower()) or \
os.path.exists(fl.upper()):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]