Compare commits

...

15 Commits
0.3.0 ... 0.5.0

27 changed files with 814 additions and 2301 deletions

View File

@@ -21,7 +21,7 @@ import lutinArg
myLutinArg = lutinArg.LutinArg()
myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help"))
myLutinArg.add_section("option", "Can be set one time in all case")
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="display makefile debug level (verbose) default =2"))
myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
myLutinArg.add(lutinArg.ArgDefine("C", "color", desc="display makefile output in color"))
myLutinArg.add(lutinArg.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency"))
myLutinArg.add(lutinArg.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
@@ -34,8 +34,8 @@ myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc","
myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
myLutinArg.add(lutinArg.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
myLutinArg.add(lutinArg.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
myLutinArg.add(lutinArg.ArgDefine("r", "prj", desc="Use external project management (not build with lutin..."))
myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
myLutinArg.add(lutinArg.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
myLutinArg.add(lutinArg.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)"))
myLutinArg.add(lutinArg.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion"))
myLutinArg.add(lutinArg.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion"))
@@ -49,6 +49,7 @@ localArgument = myLutinArg.parse()
def usage():
# generic argument displayed :
myLutinArg.display()
print " All target can finish with '-clean' '-dump' ..."
print " all"
print " build all (only for the current selected board) (bynary and packages)"
print " clean"
@@ -57,7 +58,7 @@ def usage():
print " Dump all the module dependency and properties"
listOfAllModule = lutinModule.list_all_module_with_desc()
for mod in listOfAllModule:
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump"
print " " + mod[0]
if mod[1] != "":
print " " + mod[1]
print " ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all"
@@ -125,6 +126,7 @@ if __name__ == "__main__":
# now import other standard module (must be done here and not before ...
import lutinTarget
import lutinSystem
import lutinHost
import lutinTools
@@ -141,7 +143,7 @@ def Start():
"arch":"auto",
"generate-package":True,
"simulation":False,
"extern-build":False
"gcov":False
}
# load the default target :
target = None
@@ -154,8 +156,8 @@ def Start():
config["generate-package"]=False
elif argument.get_option_nName() == "simulation":
config["simulation"]=True
elif argument.get_option_nName() == "prj":
config["extern-build"]=True
elif argument.get_option_nName() == "gcov":
config["gcov"]=True
elif argument.get_option_nName() == "bus":
config["bus-size"]=argument.get_arg()
elif argument.get_option_nName() == "arch":
@@ -179,7 +181,7 @@ def Start():
"arch":"auto",
"generate-package":True,
"simulation":False,
"extern-build":False
"gcov":False
}
#remove previous target
target = None
@@ -227,7 +229,9 @@ if __name__ == '__main__':
and folder.lower()!="out" :
debug.debug("Automatic load path: '" + folder + "'")
lutinModule.import_path(folder)
lutinSystem.import_path(folder)
lutinTarget.import_path(folder)
#lutinSystem.display()
Start()

View File

@@ -32,6 +32,10 @@ def set_level(id):
debugLevel = id
#print "SetDebug level at " + str(debugLevel)
def get_level():
global debugLevel
return debugLevel
def enable_color():
global debugColor
debugColor = True
@@ -50,6 +54,15 @@ def enable_color():
global color_cyan
color_cyan = "\033[36m"
def extreme_verbose(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 6 \
or force == True:
debugLock.acquire()
print(color_blue + input + color_default)
debugLock.release()
def verbose(input, force=False):
global debugLock
global debugLevel

View File

@@ -13,21 +13,21 @@ import lutinEnv as environement
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
debug.verbose("Resuest check of dependency of :")
debug.verbose(" dst='" + str(dst) + "'")
debug.verbose(" str='" + str(src) + "'")
debug.verbose(" dept='" + str(dependFile) + "'")
debug.verbose(" cmd='" + str(file_cmd) + "'")
debug.extreme_verbose("Resuest check of dependency of :")
debug.extreme_verbose(" dst='" + str(dst) + "'")
debug.extreme_verbose(" str='" + str(src) + "'")
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
# if force mode selected ==> just force rebuild ...
if environement.get_force_mode():
debug.verbose(" ==> must rebuild (force mode)")
debug.extreme_verbose(" ==> must rebuild (force mode)")
return True
# check if the destination existed:
if dst != "" \
and dst != None \
and os.path.exists(dst) == False:
debug.verbose(" ==> must rebuild (dst does not exist)")
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
return True
if dst != "" \
and dst != None \
@@ -38,27 +38,27 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
if dst != "" \
and dst != None \
and os.path.getmtime(src) > os.path.getmtime(dst):
debug.verbose(" ==> must rebuild (source time greater)")
debug.extreme_verbose(" ==> must rebuild (source time greater)")
return True
if dependFile != "" \
and dependFile != None \
and os.path.exists(dependFile) == False:
debug.verbose(" ==> must rebuild (no depending file)")
debug.extreme_verbose(" ==> must rebuild (no depending file)")
return True
if file_cmd != "" \
and file_cmd != None:
if os.path.exists(file_cmd) == False:
debug.verbose(" ==> must rebuild (no commandLine file)")
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
firstAndUniqueLine = file2.read()
if firstAndUniqueLine != cmdLine:
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
debug.extreme_verbose(" ==> '" + cmdLine + "'")
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
return True
# the cmdfile is correct ...
@@ -66,7 +66,7 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
if dependFile != "" \
and dependFile != None:
debug.verbose(" start parsing dependency file : '" + dependFile + "'")
debug.extreme_verbose(" start parsing dependency file : '" + dependFile + "'")
file = open(dependFile, "r")
for curLine in file.readlines():
# normal file : end with : ": \\n"
@@ -81,36 +81,36 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
testFile=""
if curLine[len(curLine)-1:] == ':':
debug.verbose(" Line (no check (already done) : '" + curLine + "'");
debug.extreme_verbose(" Line (no check (already done) : '" + curLine + "'");
elif len(curLine) == 0 \
or curLine == '\\':
debug.verbose(" Line (Not parsed) : '" + curLine + "'");
debug.extreme_verbose(" Line (Not parsed) : '" + curLine + "'");
else:
testFile = curLine
debug.verbose(" Line (might check) : '" + testFile + "'");
debug.extreme_verbose(" Line (might check) : '" + testFile + "'");
# really check files:
if testFile!="":
debug.verbose(" ==> test");
debug.extreme_verbose(" ==> test");
if False==os.path.exists(testFile):
debug.verbose(" ==> must rebuild (a dependency file does not exist)")
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
file.close()
return True
if os.path.getmtime(testFile) > os.path.getmtime(dst):
debug.verbose(" ==> must rebuild (a dependency file time is newer)")
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
file.close()
return True
# close the current file :
file.close()
debug.verbose(" ==> Not rebuild (all dependency is OK)")
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
return False
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
debug.verbose("Resuest check of dependency of :")
debug.verbose(" dst='" + dst + "'")
debug.verbose(" src()=")
debug.extreme_verbose("Resuest check of dependency of :")
debug.extreme_verbose(" dst='" + dst + "'")
debug.extreme_verbose(" src()=")
for src in srcList:
debug.verbose(" '" + src + "'")
@@ -119,39 +119,39 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
# if force mode selected ==> just force rebuild ...
if environement.get_force_mode():
debug.verbose(" ==> must re-package (force mode)")
debug.extreme_verbose(" ==> must re-package (force mode)")
return True
# check if the destination existed:
if False==os.path.exists(dst):
debug.verbose(" ==> must re-package (dst does not exist)")
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
return True
# chek the basic date if the 2 files
if len(srcList)==0:
debug.verbose(" ==> must re-package (no source ???)")
debug.extreme_verbose(" ==> must re-package (no source ???)")
return True
for src in srcList:
if os.path.getmtime(src) > os.path.getmtime(dst):
debug.verbose(" ==> must re-package (source time greater) : '" + src + "'")
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
return True
if ""!=file_cmd:
if False==os.path.exists(file_cmd):
debug.verbose(" ==> must rebuild (no commandLine file)")
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
firstAndUniqueLine = file2.read()
if firstAndUniqueLine != cmdLine:
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
debug.extreme_verbose(" ==> '" + cmdLine + "'")
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
return True
# the cmdfile is correct ...
file2.close()
debug.verbose(" ==> Not re-package (all dependency is OK)")
debug.extreme_verbose(" ==> Not re-package (all dependency is OK)")
return False

View File

@@ -50,7 +50,27 @@ def print_pretty(myString, force=False):
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
baseElementList = ["-o", "-D", "-I", "-L", "g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib", "-framework", "-isysroot", "-arch"]
baseElementList = ["-o",
"-D",
"-I",
"-L",
"g++",
"gcc",
"clang",
"clang++",
"ar",
"ld",
"ranlib",
"-framework",
"-isysroot",
"-arch",
"-keystore",
"-sigalg",
"-digestalg",
"<",
"<<",
">",
">>"]
for element in baseElementList:
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]

View File

@@ -1,22 +0,0 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import datetime
import lutinTools
import lutinModule
class ExtProjectGenerator:
def __init__(self, extType):
self.extType = extType
self.name = "emptyName"
#This is a distionnaty of all groups :
self.groups = {}

View File

@@ -1,701 +0,0 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import datetime
import lutinTools as tools
import os
import fnmatch
import lutinExtProjectGenerator
from collections import defaultdict
# id example : FFBA2F79187F44AE0034CC66
genericID = 100000
def convert_name_in_base_id(name,fill=True):
out = "FF"
for element in name.lower():
if element == "a": out += "01"
elif element == "b": out += "02"
elif element == "c": out += "03"
elif element == "d": out += "04"
elif element == "e": out += "05"
elif element == "f": out += "06"
elif element == "g": out += "07"
elif element == "h": out += "08"
elif element == "i": out += "09"
elif element == "j": out += "10"
elif element == "k": out += "11"
elif element == "l": out += "12"
elif element == "m": out += "13"
elif element == "n": out += "14"
elif element == "o": out += "15"
elif element == "p": out += "16"
elif element == "q": out += "17"
elif element == "r": out += "18"
elif element == "s": out += "19"
elif element == "t": out += "20"
elif element == "u": out += "21"
elif element == "v": out += "22"
elif element == "w": out += "23"
elif element == "x": out += "24"
elif element == "y": out += "25"
elif element == "z": out += "27"
else: out += "FF"
if len(out) >= 18:
return out
if fill == True:
for iii in range(0,256):
out += "A"
if len(out) >= 18:
return out
return out
dictId = {}
def convert_folder_in_base_id(name, package):
global dictId
debug.verbose(" generate Id for : " + package + ":" + name);
if package not in dictId.keys():
dictId[package] = {"lastID": 100000, "sub":{}}
if name not in dictId[package]["sub"].keys():
generatedID = convert_name_in_base_id(package) + str(dictId[package]["lastID"])
dictId[package]["lastID"] = dictId[package]["lastID"] + 1
dictId[package]["sub"][name] = {"id":generatedID}
return dictId[package]["sub"][name]["id"]
FILE_MARKER = '<files>'
##
## @brief generate a tree from the specific file
##
def attach(branch, trunk):
parts = branch.split('/', 1)
if len(parts) == 1: # branch is a file
trunk[FILE_MARKER].append(parts[0])
else:
node, others = parts
if node not in trunk:
trunk[node] = defaultdict(dict, ((FILE_MARKER, []),))
attach(others, trunk[node])
##
## @brief display a specific path tree field
##
def prettify(d, indent=0):
for key, value in d.iteritems():
if key == FILE_MARKER:
if value:
debug.debug(' ' * indent + str(value))
else:
debug.debug(' ' * indent + str(key))
if isinstance(value, dict):
prettify(value, indent+1)
else:
debug.debug(' ' * (indent+1) + str(value))
def generate_tree(treedata, package, tree = []):
data = ""
tmpPath = "?tree?"
if len(tree) != 0:
tmpPath = ""
for elem in tree:
if tmpPath != "":
tmpPath += '/'
tmpPath += elem
if len(tree) == 0:
data +=' ' + convert_folder_in_base_id(tmpPath, package) + ' /* ' + package + ' */ = {\n'
else:
data +=' ' + convert_folder_in_base_id(tmpPath, package) + ' /* ' + tree[-1] + ' */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
"""
data +=' FFBA2F8B187F44AE0034CC66 /* AppDelegate.h */,\n'
data +=' FFBA2F8C187F44AE0034CC66 /* AppDelegate.m */,\n'
data +=' FFBA2F8E187F44AE0034CC66 /* Main_iPhone.storyboard */,\n'
data +=' FFBA2F91187F44AE0034CC66 /* Main_iPad.storyboard */,\n'
data +=' FFBA2F94187F44AE0034CC66 /* Shader.fsh */,\n'
data +=' FFBA2F96187F44AE0034CC66 /* Shader.vsh */,\n'
data +=' FFBA2F98187F44AE0034CC66 /* ViewController.h */,\n'
data +=' FFBA2F99187F44AE0034CC66 /* ViewController.m */,\n'
data +=' FFBA2F9B187F44AE0034CC66 /* Images.xcassets */,\n'
data +=' FFBA2F83187F44AE0034CC66 /* Supporting Files */,\n'
"""
for key, value in treedata.iteritems():
if key == FILE_MARKER:
for file in value:
data +=' ' + convert_folder_in_base_id(tmpPath + '/' + file, package) + ' /* ' + file + ' */,\n'
else:
# TODO : Check if folder is empty ...
data +=' ' + convert_folder_in_base_id(tmpPath + '/' + key, package) + ' /* ' + key + ' */,\n'
"""
debug.debug(' ' * indent + str(key))
if isinstance(value, dict):
prettify(value, indent+1)
else:
debug.debug(' ' * (indent+1) + str(value))
"""
data +=' );\n'
if len(tree) == 0:
data +=' path = ' + package + ';\n'
else:
data +=' path = ' + tree[-1] + ';\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
# generate all subFolder :
for key, value in treedata.iteritems():
if key == FILE_MARKER:
continue
tree.append(key)
data += generate_tree(value, package, tree)
tree.pop()
return data
XCodeTypeElements = {
'a': ('archive.ar', 'PBXFrameworksBuildPhase', ''),
'xcodeproj': ('wrapper.pb-project', None, '""'),
'app': ('wrapper.application', None, ''),
'framework': ('wrapper.framework', 'PBXFrameworksBuildPhase', 'SDKROOT'),
'dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase', '"<group>"'),
'h': ('sourcecode.c.h', None, '"<group>"'),
'H': ('sourcecode.c.h', None, '"<group>"'),
'hpp': ('sourcecode.c.h', None, '"<group>"'),
'hxx': ('sourcecode.c.h', None, '"<group>"'),
'S': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
's': ('sourcecode.asm', 'PBXSourcesBuildPhase', '"<group>"'),
'c': ('sourcecode.c.c', 'PBXSourcesBuildPhase', '"<group>"'),
'cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'cxx': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase', '"<group>"'),
'm': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase', '"<group>"'),
'mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase', '"<group>"'),
'icns': ('image.icns', 'PBXResourcesBuildPhase', '"<group>"'),
'nib': ('wrapper.nib', 'PBXResourcesBuildPhase', '"<group>"'),
'plist': ('text.plist.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'json': ('text.json', 'PBXResourcesBuildPhase', '"<group>"'),
'rtf': ('text.rtf', 'PBXResourcesBuildPhase', '"<group>"'),
'png': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'tiff': ('image.tiff', 'PBXResourcesBuildPhase', '"<group>"'),
'txt': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'fsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'frag': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vsh': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'vert': ('sourcecode.glsl', 'PBXResourcesBuildPhase', '"<group>"'),
'svg': ('image.png', 'PBXResourcesBuildPhase', '"<group>"'),
'xml': ('sourcecode.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'prog': ('text.xml', 'PBXResourcesBuildPhase', '"<group>"'),
'ttf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'conf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'emf': ('text', 'PBXResourcesBuildPhase', '"<group>"'),
'xib': ('file.xib', 'PBXResourcesBuildPhase', '"<group>"'),
'strings': ('text.plist.strings', 'PBXResourcesBuildPhase', '"<group>"'),
'bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase', '"<group>"'),
'storyboard':('file.storyboard', 'PBXResourcesBuildPhase', '"<group>"')
}
class ExtProjectGeneratorXCode(lutinExtProjectGenerator.ExtProjectGenerator):
def __init__(self):
lutinExtProjectGenerator.ExtProjectGenerator.__init__(self, "XCode")
self.baseId = "FFFFFFFFFFFFFFFFFF"
# set default framwork:
self.add_files("Frameworks",
"System/Library/Frameworks",
[ "Foundation.framework",
"CoreGraphics.framework",
"UIKit.framework",
"GLKit.framework",
"OpenGLES.framework",
"XCTest.framework" ]);
def set_project_name(self, name):
self.name = name
self.baseId = convert_name_in_base_id(name)
def add_files(self, group, basePath, srcList):
if group not in self.groups.keys() :
self.groups[group] = {
"list-files" : [],
"extra-flags" : []
}
for element in srcList:
debug.info("plop : " + str(element))
debug.info("plop : " + str(basePath))
path = basePath + "/" + element
pos = path.rfind('/')
simpleName = path
if pos >= 0:
simpleName = path[pos+1:]
pos = simpleName.rfind('.')
extention = "";
if pos >= 0:
extention = simpleName[pos+1:]
self.groups[group]["list-files"].append({
"path" : path,
"name" : simpleName,
"extention":extention,
"declare-name":element})
def add_data_file(self, basePath, srcList):
realBasePath = os.path.realpath(basePath)
if realBasePath[-1] == "/":
realBasePath = realBasePath[:-1]
debug.debug("add data file : " + str(srcList))
for realName,destName in srcList:
tools.copy_file(realBasePath+'/'+realName, 'out/iOs/' + self.name + '/data/' + destName, force=True)
self.add_files("data", 'out/iOs/' + self.name + 'xcodeprj/data', [destName])
def add_data_folder(self, basePath, srcList):
realBasePath = basePath
if realBasePath[-1] == "/":
realBasePath = realBasePath[:-1]
debug.debug("add data folder : " + str(srcList))
for inputPath,outputPath in srcList:
tmpPath = os.path.dirname(os.path.realpath(realBasePath + '/' + inputPath))
tmpRule = os.path.basename(inputPath)
debug.warning(" add folder : '" + tmpPath + "' rule : '" + tmpRule + "'")
for root, dirnames, filenames in os.walk(tmpPath):
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
self.add_data_file(tmpPath, [[cycleFile, outputPath+cycleFile]])
def generate_project_file(self):
#debug.error(" list : " + str(self.groups))
data ='// !$*UTF8*$!\n'
data +='{\n'
data +=' archiveVersion = 1;\n'
data +=' classes = {\n'
data +=' };\n'
data +=' objectVersion = 46;\n'
data +=' objects = {\n'
data +='\n'
data +='/* Begin PBXBuildFile section */\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
debug.debug(" PBXBuildFile ?? " + str(files))
if files["extention"] in XCodeTypeElements.keys():
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase" \
or XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase"\
or XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase"\
or XCodeTypeElements[files["extention"]][1] == "PBXVariantGroup":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + ' */ = {'
data +=' isa = PBXBuildFile;'
data +=' fileRef = ' + convert_folder_in_base_id(files["declare-name"], group) + ';'
data +=' };\n'
data +='/* End PBXBuildFile section */\n'
data +='\n'
data +='/* Begin PBXContainerItemProxy section */\n'
# I did not understand this section ...
data +=' ' + convert_folder_in_base_id("?PBXContainerItemProxy?", self.name) + ' /* PBXContainerItemProxy */ = {\n'
data +=' isa = PBXContainerItemProxy;\n'
data +=' containerPortal = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Project object */;\n'
data +=' proxyType = 1;\n'
data +=' remoteGlobalIDString = ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ';\n'
data +=' remoteInfo = ' + self.name + ';\n'
data +=' };\n'
data +='/* End PBXContainerItemProxy section */\n'
data +='\n'
data +='/* Begin PBXFileReference section */\n'
data +=' ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */ = {\n'
data +=' isa = PBXFileReference;\n'
data +=' explicitFileType = wrapper.application;\n'
data +=' includeInIndex = 0;\n'
data +=' path = ' + self.name + '.app;\n'
data +=' sourceTree = BUILT_PRODUCTS_DIR;\n'
data +=' };\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
debug.debug(" PBXBuildFile ?? " + str(files))
data +=' /* ' + files["name"] + ' */\n'
if files["extention"] in XCodeTypeElements.keys():
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;'
data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';'
data +=' sourceTree = ' + XCodeTypeElements[files["extention"]][2] + '; };\n'
else:
data +=' ' + convert_folder_in_base_id(files["declare-name"], group) + ' = {'
data +=' isa = PBXBuildFile;'
#data +=' lastKnownFileType = ' + XCodeTypeElements[files["extention"]][0] + ';'
data +=' path = ' + files["path"] + ';'
data +=' name = ' + files["name"] + ';'
data +=' sourceTree = "<group>"; };\n'
data +='/* End PBXFileReference section */\n'
data +='\n'
data +='/* Begin PBXFrameworksBuildPhase section */\n'
data +=' ' + convert_folder_in_base_id("?Frameworks?", self.name) + ' /* Frameworks */ = {\n'
data +=' isa = PBXFrameworksBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXFrameworksBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + files["name"] + ' in ' + group + '*/,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXFrameworksBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXGroup section */\n'
data +=' ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ' = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
for group in self.groups:
data +=' ' + convert_folder_in_base_id("?tree?", group) + ' /* ' + group + ' */,\n'
data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */,\n'
data +=' );\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */ = {\n'
data +=' isa = PBXGroup;\n'
data +=' children = (\n'
data +=' ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */,\n'
data +=' );\n'
data +=' name = Products;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
# treeview :
for group in self.groups:
element = self.groups[group]
main_dict = defaultdict(dict, ((FILE_MARKER, []),))
for line in element["list-files"]:
attach(line["declare-name"], main_dict)
#prettify(main_dict);
data += generate_tree(main_dict, group)
data +='/* End PBXGroup section */\n'
data +='\n'
data +='/* Begin PBXNativeTarget section */\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ' /* edn */ = {\n'
data +=' isa = PBXNativeTarget;\n'
data +=' buildConfigurationList = ' + convert_folder_in_base_id("?PBXNativeTarget?", self.name) + ' /* Build configuration list for PBXNativeTarget "edn" */;\n'
data +=' buildPhases = (\n'
data +=' FFBA2F71187F44AE0034CC66 /* Sources */,\n'
data +=' ' + convert_folder_in_base_id("?Frameworks?", self.name) + ' /* Frameworks */,\n'
data +=' ' + convert_folder_in_base_id("?Resources?", self.name) + ' /* Resources */,\n'
data +=' );\n'
data +=' buildRules = (\n'
data +=' );\n'
data +=' dependencies = (\n'
data +=' );\n'
data +=' name = edn;\n'
data +=' productName = edn;\n'
data +=' productReference = ' + convert_folder_in_base_id("?app?", self.name) + ' /* ' + self.name + '.app */;\n'
data +=' productType = "com.apple.product-type.application";\n'
data +=' };\n'
data +='/* End PBXNativeTarget section */\n'
data +='\n'
data +='/* Begin PBXProject section */\n'
data +=' ' + convert_folder_in_base_id("?Project-object?", self.name) + ' /* Project object */ = {\n'
data +=' isa = PBXProject;\n'
data +=' attributes = {\n'
data +=' LastUpgradeCheck = 0500;\n'
data +=' ORGANIZATIONNAME = "Edouard DUPIN";\n'
data +=' TargetAttributes = {\n'
data +=' ' + convert_folder_in_base_id("?Project-object?targetAttribute", self.name) + ' = {\n'
data +=' TestTargetID = ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ';\n'
data +=' };\n'
data +=' };\n'
data +=' };\n'
data +=' buildConfigurationList = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Build configuration list for PBXProject "edn" */;\n'
data +=' compatibilityVersion = "Xcode 3.2";\n'
data +=' developmentRegion = English;\n'
data +=' hasScannedForEncodings = 0;\n'
data +=' knownRegions = (\n'
data +=' en,\n'
data +=' Base,\n'
data +=' );\n'
data +=' mainGroup = ' + convert_folder_in_base_id("?mainTreeGroup?", self.name) + ';\n'
data +=' productRefGroup = ' + convert_folder_in_base_id("?tree?", "Products") + ' /* Products */;\n'
data +=' projectDirPath = "";\n'
data +=' projectRoot = "";\n'
data +=' targets = (\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?sectio", self.name) + ' /* edn */,\n'
data +=' );\n'
data +=' };\n'
data +='/* End PBXProject section */\n'
data +='\n'
data +='/* Begin PBXResourcesBuildPhase section */\n'
data +=' ' + convert_folder_in_base_id("?Resources?", self.name) + ' /* Resources */ = {\n'
data +=' isa = PBXResourcesBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
# list of all resources to copy
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] in XCodeTypeElements.keys():
if XCodeTypeElements[files["extention"]][1] == "PBXResourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group) + ' = {'
data +=' /* ' + files["name"] + ' in ' + group + ' */'
data +=' ,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXResourcesBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXSourcesBuildPhase section */\n'
data +=' FFBA2F71187F44AE0034CC66 /* Sources */ = {\n'
data +=' isa = PBXSourcesBuildPhase;\n'
data +=' buildActionMask = 2147483647;\n'
data +=' files = (\n'
# list of all file to compile ...
# TODO : review this ==> generate to many files ...
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
data +=' /* ' + group + " : " + files["name"] + ' */,\n'
data +=' );\n'
data +=' runOnlyForDeploymentPostprocessing = 0;\n'
data +=' };\n'
data +='/* End PBXSourcesBuildPhase section */\n'
data +='\n'
data +='/* Begin PBXTargetDependency section */\n'
# nothing ...
data +='/* End PBXTargetDependency section */\n'
data +='\n'
data +='/* Begin PBXVariantGroup section */\n'
# not really needed, because it is for internal system data position ==> maybe change it if necessary ...
"""
for group in self.groups:
element = self.groups[group]
for files in element["list-files"]:
if files["extention"] not in XCodeTypeElements.keys():
continue
if XCodeTypeElements[files["extention"]][1] == "PBXSourcesBuildPhase":
data +=' ' + convert_folder_in_base_id(files["declare-name"] + '_PBXBuildFile', group)
"""
"""
data +=' FFBA2F85187F44AE0034CC66 /* InfoPlist.strings */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F86187F44AE0034CC66 /* en */,\n'
data +=' );\n'
data +=' name = InfoPlist.strings;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2F8E187F44AE0034CC66 /* Main_iPhone.storyboard */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F8F187F44AE0034CC66 /* Base */,\n'
data +=' );\n'
data +=' name = Main_iPhone.storyboard;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2F91187F44AE0034CC66 /* Main_iPad.storyboard */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2F92187F44AE0034CC66 /* Base */,\n'
data +=' );\n'
data +=' name = Main_iPad.storyboard;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
data +=' FFBA2FAB187F44AF0034CC66 /* InfoPlist.strings */ = {\n'
data +=' isa = PBXVariantGroup;\n'
data +=' children = (\n'
data +=' FFBA2FAC187F44AF0034CC66 /* en */,\n'
data +=' );\n'
data +=' name = InfoPlist.strings;\n'
data +=' sourceTree = "<group>";\n'
data +=' };\n'
"""
data +='/* End PBXVariantGroup section */\n'
data +='\n'
data +='/* Begin XCBuildConfiguration section */\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Debug", self.name) + ' /* Debug */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ALWAYS_SEARCH_USER_PATHS = NO;\n'
data +=' ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";\n'
data +=' CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";\n'
data +=' CLANG_CXX_LIBRARY = "libc++";\n'
data +=' CLANG_ENABLE_MODULES = YES;\n'
data +=' CLANG_ENABLE_OBJC_ARC = YES;\n'
data +=' CLANG_WARN_BOOL_CONVERSION = YES;\n'
data +=' CLANG_WARN_CONSTANT_CONVERSION = YES;\n'
data +=' CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n'
data +=' CLANG_WARN_EMPTY_BODY = YES;\n'
data +=' CLANG_WARN_ENUM_CONVERSION = YES;\n'
data +=' CLANG_WARN_INT_CONVERSION = YES;\n'
data +=' CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n'
data +=' CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n'
data +=' "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";\n'
data +=' COPY_PHASE_STRIP = NO;\n'
data +=' GCC_C_LANGUAGE_STANDARD = gnu99;\n'
data +=' GCC_DYNAMIC_NO_PIC = NO;\n'
data +=' GCC_OPTIMIZATION_LEVEL = 0;\n'
data +=' GCC_PREPROCESSOR_DEFINITIONS = (\n'
data +=' "DEBUG=1",\n'
data +=' "$(inherited)",\n'
data +=' );\n'
data +=' GCC_SYMBOLS_PRIVATE_EXTERN = NO;\n'
data +=' GCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n'
data +=' GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n'
data +=' GCC_WARN_UNDECLARED_SELECTOR = YES;\n'
data +=' GCC_WARN_UNINITIALIZED_AUTOS = YES;\n'
data +=' GCC_WARN_UNUSED_FUNCTION = YES;\n'
data +=' GCC_WARN_UNUSED_VARIABLE = YES;\n'
data +=' IPHONEOS_DEPLOYMENT_TARGET = 7.0;\n'
data +=' ONLY_ACTIVE_ARCH = YES;\n'
data +=' SDKROOT = iphoneos;\n'
data +=' TARGETED_DEVICE_FAMILY = "1,2";\n'
data +=' };\n'
data +=' name = Debug;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Release", self.name) + ' /* Release */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ALWAYS_SEARCH_USER_PATHS = NO;\n'
data +=' ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";\n'
data +=' CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";\n'
data +=' CLANG_CXX_LIBRARY = "libc++";\n'
data +=' CLANG_ENABLE_MODULES = YES;\n'
data +=' CLANG_ENABLE_OBJC_ARC = YES;\n'
data +=' CLANG_WARN_BOOL_CONVERSION = YES;\n'
data +=' CLANG_WARN_CONSTANT_CONVERSION = YES;\n'
data +=' CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n'
data +=' CLANG_WARN_EMPTY_BODY = YES;\n'
data +=' CLANG_WARN_ENUM_CONVERSION = YES;\n'
data +=' CLANG_WARN_INT_CONVERSION = YES;\n'
data +=' CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n'
data +=' CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n'
data +=' "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";\n'
data +=' COPY_PHASE_STRIP = YES;\n'
data +=' ENABLE_NS_ASSERTIONS = NO;\n'
data +=' GCC_C_LANGUAGE_STANDARD = gnu99;\n'
data +=' GCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n'
data +=' GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n'
data +=' GCC_WARN_UNDECLARED_SELECTOR = YES;\n'
data +=' GCC_WARN_UNINITIALIZED_AUTOS = YES;\n'
data +=' GCC_WARN_UNUSED_FUNCTION = YES;\n'
data +=' GCC_WARN_UNUSED_VARIABLE = YES;\n'
data +=' IPHONEOS_DEPLOYMENT_TARGET = 7.0;\n'
data +=' SDKROOT = iphoneos;\n'
data +=' TARGETED_DEVICE_FAMILY = "1,2";\n'
data +=' VALIDATE_PRODUCT = YES;\n'
data +=' };\n'
data +=' name = Release;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Debug", self.name) + ' /* Debug */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n'
data +=' ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n'
data +=' GCC_PRECOMPILE_PREFIX_HEADER = YES;\n'
data +=' GCC_PREFIX_HEADER = "edn/edn-Prefix.pch";\n'
data +=' INFOPLIST_FILE = "edn/edn-Info.plist";\n'
data +=' PRODUCT_NAME = "$(TARGET_NAME)";\n'
data +=' WRAPPER_EXTENSION = app;\n'
data +=' };\n'
data +=' name = Debug;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Release", self.name) + ' /* Release */ = {\n'
data +=' isa = XCBuildConfiguration;\n'
data +=' buildSettings = {\n'
data +=' ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n'
data +=' ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n'
data +=' GCC_PRECOMPILE_PREFIX_HEADER = YES;\n'
data +=' GCC_PREFIX_HEADER = "edn/edn-Prefix.pch";\n'
data +=' INFOPLIST_FILE = "edn/edn-Info.plist";\n'
data +=' PRODUCT_NAME = "$(TARGET_NAME)";\n'
data +=' WRAPPER_EXTENSION = app;\n'
data +=' };\n'
data +=' name = Release;\n'
data +=' };\n'
data += '/* End XCBuildConfiguration section */\n'
data += '\n'
data += '/* Begin XCConfigurationList section */\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Build configuration list for PBXProject "' + self.name + '" */ = {\n'
data +=' isa = XCConfigurationList;\n'
data +=' buildConfigurations = (\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Debug", self.name) + ' /* Debug */,\n'
data +=' ' + convert_folder_in_base_id("?PBXProject?Release", self.name) + ' /* Release */,\n'
data +=' );\n'
data +=' defaultConfigurationIsVisible = 0;\n'
data +=' defaultConfigurationName = Release;\n'
data +=' };\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?", self.name) + ' /* Build configuration list for PBXNativeTarget "PBXNativeTarget" */ = {\n'
data +=' isa = XCConfigurationList;\n'
data +=' buildConfigurations = (\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Debug", self.name) + ' /* Debug */,\n'
data +=' ' + convert_folder_in_base_id("?PBXNativeTarget?Release", self.name) + ' /* Release */,\n'
data +=' );\n'
data +=' defaultConfigurationIsVisible = 0;\n'
data +=' };\n'
data +='/* End XCConfigurationList section */\n'
data +=' };\n'
data +=' rootObject = ' + convert_folder_in_base_id("?PBXProject?", self.name) + ' /* Project object */;\n'
data +='}\n'
#debug.info(data)
outName = 'out/iOs/' + self.name + '.xcodeproj/project.pbxproj'
tools.create_directory_of_file(outName)
tools.file_write_data(outName, data)
# TODO : Generate all dependency files ...
"""
# this is a file generated by xcode for his internal properties ...
# create workspace file:
data = '<?xml version="1.0" encoding="UTF-8"?>\n'
data += '<Workspace\n'
data += ' version = "1.0">\n'
data += ' <FileRef\n'
data += ' location = "self:' + self.name + '.xcodeproj">\n'
data += ' </FileRef>\n'
data += '</Workspace>\n'
outName = 'out/iOs/' + self.name + '.xcodeproj/project.xcworkspace/contents.xcworkspacedata'
tools.create_directory_of_file(outName)
tools.file_write_data(outName, data)
"""

View File

@@ -8,6 +8,7 @@
##
import sys
import copy
import lutinDebug as debug
@@ -30,6 +31,8 @@ class HeritageList:
self.flags_xx=[]
self.flags_m=[]
self.flags_mm=[]
self.flags_xx_version=1999
self.flags_cc_version=1989
# sources list:
self.src=[]
self.path=[]
@@ -63,6 +66,8 @@ class HeritageList:
self.flags_ld=[]
self.flags_cc=[]
self.flags_xx=[]
self.flags_xx_version=1999
self.flags_xx_version=1989
self.flags_m=[]
self.flags_mm=[]
# sources list:
@@ -104,7 +109,10 @@ class HeritageList:
append_to_list(self.flags_mm, element.flags_mm)
append_to_list(self.path, element.path)
append_to_list(self.src, element.src)
if self.flags_xx_version < element.flags_xx_version:
self.flags_xx_version = element.flags_xx_version
if self.flags_cc_version < element.flags_cc_version:
self.flags_cc_version = element.flags_cc_version
class heritage:
@@ -116,6 +124,8 @@ class heritage:
self.flags_ld=[]
self.flags_cc=[]
self.flags_xx=[]
self.flags_xx_version=1999
self.flags_cc_version=1989
self.flags_m=[]
self.flags_mm=[]
# sources list:
@@ -127,13 +137,18 @@ class heritage:
if type(module) != type(None):
# all the parameter that the upper classe need when build
self.name = module.name
self.depends = module.depends
self.depends = copy.deepcopy(module.depends)
self.flags_ld = module.export_flags_ld
self.flags_cc = module.export_flags_cc
self.flags_xx = module.export_flags_xx
self.flags_m = module.export_flags_m
self.flags_mm = module.export_flags_mm
self.path = module.export_path
self.flags_xx_version = module.xx_version_api
self.flags_cc_version = module.cc_version_api
def add_depends(self, depend):
self.depends.append(depend)
def add_flag_LD(self, list):
append_to_list(self.flags_ld, list)
@@ -172,3 +187,9 @@ class heritage:
self.add_flag_MM(other.flags_mm)
self.add_import_path(other.path)
self.add_sources(other.src)
if self.flags_xx_version < module.xx_version_api:
self.flags_xx_version = module.xx_version_api
if self.flags_cc_version < module.cc_version_api:
self.flags_cc_version = module.cc_version_api

View File

@@ -33,6 +33,7 @@ class Module:
##
def __init__(self, file, moduleName, moduleType):
## Remove all variable to prevent error of multiple deffinition of the module ...
debug.verbose("Create a new module : '" + moduleName + "' TYPE=" + moduleType)
self.originFile=''
self.originFolder=''
# type of the module:
@@ -41,6 +42,9 @@ class Module:
self.name=moduleName
# Dependency list:
self.depends = []
# Dependency list (optionnal module):
self.depends_optionnal = []
self.depends_find = []
# Documentation list:
self.documentation = None
# export PATH
@@ -66,6 +70,11 @@ class Module:
self.files = []
self.folders = []
self.isbuild = False
# CPP version:
self.xx_version = 1999
self.xx_version_api = 1999
self.cc_version = 1989
self.cc_version_api = 1989
## end of basic INIT ...
if moduleType == 'BINARY' \
or moduleType == 'LIBRARY' \
@@ -109,7 +118,7 @@ class Module:
"-Wall",
"-Wsign-compare",
"-Wreturn-type",
"-Wint-to-pointer-cast",
#"-Wint-to-pointer-cast",
"-Wno-write-strings",
"-Woverloaded-virtual",
"-Wnon-virtual-dtor",
@@ -133,6 +142,17 @@ class Module:
##
def compile_mm_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
xx_version = max(self.xx_version, depancy.flags_xx_version)
if xx_version == 2014:
debug.error("not supported flags for X14 ...");
local_xx_version_flags=["-std=c++14", "-D__CPP_VERSION__=2014"]
elif xx_version == 2011:
local_xx_version_flags=["-std=c++11", "-D__CPP_VERSION__=2011"]
elif xx_version == 2003:
local_xx_version_flags=["-std=c++03", "-D__CPP_VERSION__=2003"]
else:
local_xx_version_flags=["-D__CPP_VERSION__=1999"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.xx,
@@ -143,6 +163,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc,
target.global_flags_mm,
depancy.flags_cc,
@@ -168,6 +189,16 @@ class Module:
##
def compile_m_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
cc_version = max(self.cc_version, depancy.flags_cc_version)
if cc_version == 2011:
local_cc_version_flags=["-std=c11", "-D__C_VERSION__=2011"]
elif cc_version == 1999:
local_cc_version_flags=["-std=c99", "-D__C_VERSION__=1999"]
elif cc_version == 1990:
local_cc_version_flags=["-std=c90", "-D__C_VERSION__=1990"]
else:
local_cc_version_flags=["-std=c89", "-D__C_VERSION__=1989"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.cc,
@@ -178,6 +209,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_cc_version_flags,
target.global_flags_cc,
target.global_flags_m,
depancy.flags_cc,
@@ -203,6 +235,17 @@ class Module:
##
def compile_xx_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
xx_version = max(self.xx_version, depancy.flags_xx_version)
if xx_version == 2014:
debug.error("not supported flags for X14 ...");
local_xx_version_flags=["-std=c++14", "-D__CPP_VERSION__=2014"]
elif xx_version == 2011:
local_xx_version_flags=["-std=c++11", "-D__CPP_VERSION__=2011"]
elif xx_version == 2003:
local_xx_version_flags=["-std=c++03", "-D__CPP_VERSION__=2003"]
else:
local_xx_version_flags=["-D__CPP_VERSION__=1999"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.xx,
@@ -213,6 +256,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc,
target.global_flags_xx,
depancy.flags_cc,
@@ -237,6 +281,16 @@ class Module:
##
def compile_cc_to_o(self, file, binary, target, depancy):
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
cc_version = max(self.cc_version, depancy.flags_cc_version)
if cc_version == 2011:
local_cc_version_flags=["-std=c11", "-D__C_VERSION__=2011"]
elif cc_version == 1999:
local_cc_version_flags=["-std=c99", "-D__C_VERSION__=1999"]
elif cc_version == 1990:
local_cc_version_flags=["-std=c90", "-D__C_VERSION__=1990"]
else:
local_cc_version_flags=["-std=c89", "-D__C_VERSION__=1989"]
# create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([
target.cc,
@@ -247,6 +301,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path),
local_cc_version_flags,
target.global_flags_cc,
depancy.flags_cc,
self.flags_cc,
@@ -428,7 +483,7 @@ class Module:
##
def folders_to_staging(self, binaryName, target):
for source, destination in self.folders:
debug.verbose("Might copy folder : " + source + "==>" + destination)
debug.debug("Might copy folder : " + source + "==>" + destination)
lutinTools.copy_anything_target(target, self.originFolder + "/" + source, destination)
# call here to build the module
@@ -450,9 +505,22 @@ class Module:
# TODO : Set it better ...
None
# build dependency befor
# build dependency before
listSubFileNeededTobuild = []
self.subHeritageList = heritage.HeritageList()
# optionnal dependency :
for dep, option, export in self.depends_optionnal:
inheritList, isBuilt = target.build_optionnal(dep, packageName)
if isBuilt == True:
self.localHeritage.add_depends(dep);
# TODO : Add optionnal Flags ...
# ==> do it really better ...
if export == False:
self.compile_flags_CC("-D"+option);
else:
self.add_export_flag_CC("-D"+option);
# add at the heritage list :
self.subHeritageList.add_heritage_list(inheritList)
for dep in self.depends:
inheritList = target.build(dep, packageName)
# add at the heritage list :
@@ -462,24 +530,16 @@ class Module:
for file in self.src:
#debug.info(" " + self.name + " <== " + file);
fileExt = file.split(".")[-1]
if fileExt == "c" \
or fileExt == "C":
if fileExt in ["c", "C"]:
resFile = self.compile_cc_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "cpp" \
or fileExt == "CPP" \
or fileExt == "cxx" \
or fileExt == "CXX" \
or fileExt == "xx" \
or fileExt == "XX":
elif fileExt in ["cpp", "CPP", "cxx", "CXX", "xx", "XX", "CC", "cc"]:
resFile = self.compile_xx_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "mm" \
or fileExt == "MM":
elif fileExt in ["mm", "MM"]:
resFile = self.compile_mm_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
elif fileExt == "m" \
or fileExt == "M":
elif fileExt in ["m", "M"]:
resFile = self.compile_m_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile)
else:
@@ -489,8 +549,7 @@ class Module:
# generate end point:
if self.type=='PREBUILD':
# nothing to add ==> just dependence
None
debug.print_element("Prebuild", self.name, "==>", "find")
elif self.type=='LIBRARY':
resFile = self.link_to_a(listSubFileNeededTobuild, packageName, target, self.subHeritageList)
self.localHeritage.add_sources(resFile)
@@ -576,6 +635,9 @@ class Module:
def add_module_depend(self, list):
self.append_to_internalList(self.depends, list, True)
def add_optionnal_module_depend(self, module_name, compilation_flags="", export=False):
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
def add_export_path(self, list):
self.append_to_internalList(self.export_path, list)
@@ -616,6 +678,22 @@ class Module:
def compile_flags_S(self, list):
self.append_to_internalList(self.flags_s, list)
def compile_version_XX(self, version, same_as_api=True):
cpp_version_list = [1999, 2003, 2011, 2014]
if version not in cpp_version_list:
debug.error("can not select CPP version : " + str(version) + " not in " + str(cpp_version_list))
self.xx_version = version
if same_as_api == True:
self.xx_version_api = self.xx_version
def compile_version_CC(self, version, same_as_api=True):
c_version_list = [1989, 1990, 1999, 2011]
if version not in c_version_list:
debug.error("can not select C version : " + str(version) + " not in " + str(c_version_list))
self.cc_version = version
if same_as_api == True:
self.cc_version_api = self.cc_version
def add_src_file(self, list):
self.append_to_internalList(self.src, list, True)
@@ -642,6 +720,7 @@ class Module:
print ' file:"%s"' %self.originFile
print ' folder:"%s"' %self.originFolder
self.print_list('depends',self.depends)
self.print_list('depends_optionnal', self.depends_optionnal)
self.print_list('flags_ld',self.flags_ld)
self.print_list('flags_cc',self.flags_cc)
self.print_list('flags_xx',self.flags_xx)
@@ -777,6 +856,13 @@ def import_path(path):
debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
moduleList.append([moduleName,os.path.join(root, filename)])
def exist(target, name):
global moduleList
for mod in moduleList:
if mod[0] == name:
return True
return False
def load_module(target, name):
global moduleList
for mod in moduleList:

View File

@@ -49,6 +49,28 @@ def store_command(cmdLine, file):
file2.flush()
file2.close()
##
## @brief Execute the command and ruturn generate data
##
def run_command_direct(cmdLine):
# prepare command line:
args = shlex.split(cmdLine)
debug.verbose("cmd = " + str(args))
try:
# create the subprocess
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : " + str(args))
# launch the subprocess:
output, err = p.communicate()
# Check error :
if p.returncode == 0:
if output == None:
return err[:-1];
return output[:-1];
else:
return False
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
global errorOccured
@@ -56,7 +78,7 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
global currentIdExecution
# prepare command line:
args = shlex.split(cmdLine)
#debug.verbose("cmd = " + str(args))
debug.verbose("cmd = " + str(args))
try:
# create the subprocess
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -104,6 +126,7 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
queueLock.release()
# not write the command file...
return
debug.verbose("done 3")
# write cmd line only after to prevent errors ...
store_command(cmdLine, storeCmdLine)

163
lutinSystem.py Normal file
View File

@@ -0,0 +1,163 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import inspect
import fnmatch
import lutinDebug as debug
import datetime
import lutinTools
import lutinModule as module
import lutinImage
import lutinHost
class System:
def __init__(self):
self.valid=False;
self.help="";
self.include_cc=[]
self.export_flags_cc=[]
self.export_flags_xx=[]
self.export_flags_mm=[]
self.export_flags_m=[]
self.export_flags_ar=[]
self.export_flags_ld=[]
self.export_flags_ld_shared=[]
self.export_libs_ld=[]
self.export_libs_ld_shared=[]
def append_and_check(self, listout, newElement, order):
for element in listout:
if element==newElement:
return
listout.append(newElement)
if True==order:
listout.sort()
def append_to_internalList(self, listout, list, order=False):
if type(list) == type(str()):
self.append_and_check(listout, list, order)
else:
# mulyiple imput in the list ...
for elem in list:
self.append_and_check(listout, elem, order)
def add_export_flag_LD(self, list):
self.append_to_internalList(self.export_flags_ld, list)
def add_export_flag_CC(self, list):
self.append_to_internalList(self.export_flags_cc, list)
def add_export_flag_XX(self, list):
self.append_to_internalList(self.export_flags_xx, list)
def add_export_flag_M(self, list):
self.append_to_internalList(self.export_flags_m, list)
def add_export_flag_MM(self, list):
self.append_to_internalList(self.export_flags_mm, list)
def createModuleFromSystem(target, dict):
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
myModule.add_export_flag_CC(dict["system"].export_flags_cc)
myModule.add_export_flag_LD(dict["system"].export_flags_ld)
myModule.add_export_flag_XX(dict["system"].export_flags_xx)
myModule.add_export_flag_M(dict["system"].export_flags_m)
myModule.add_export_flag_MM(dict["system"].export_flags_mm)
# add the currrent module at the
return myModule
# Dictionnaire of Target name
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
systemList={}
__startSystemName="lutinSystem_"
def import_path(path):
global targetList
matches = []
debug.debug('Start find sub File : "%s"' %path)
for root, dirnames, filenames in os.walk(path):
tmpList = fnmatch.filter(filenames, __startSystemName + "*.py")
# Import the module :
for filename in tmpList:
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
systemName = filename.replace('.py', '')
systemName = systemName.replace(__startSystemName, '')
targetType, systemName = systemName.split('_')
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
if targetType in systemList:
systemList[targetType].append({"name":systemName,
"path":os.path.join(root, filename),
"system":None,
"loaded":False,
"exist":False,
"module":None})
else:
systemList[targetType] = [{"name":systemName,
"path":os.path.join(root, filename),
"system":None,
"loaded":False,
"exist":False,
"module":None}]
def display():
global systemList
for elementName in systemList:
debug.info("integrate system: '" + elementName +"'")
for data in systemList[elementName]:
debug.info(" '" + data["name"] +"' in " + data["path"])
def exist(lib_name, target_name) :
global systemList
if target_name not in systemList:
return False
for data in systemList[target_name]:
if data["name"] == lib_name:
# we find it in the List ==> need to check if it is present in the system :
if data["loaded"] == False:
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
sys.path.append(os.path.dirname(data["path"]))
debug.verbose("import system : '" + data["name"] + "'")
theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
#create the system module
try:
data["system"] = theSystem.System()
data["exist"] = data["system"].valid
except:
debug.debug("Not find: '" + data["name"] + "'")
return data["exist"]
return False
def load(target, lib_name, target_name):
global systemList
if target_name not in systemList:
debug.error("you must call this function after checking of the system exist() !1!")
for data in systemList[target_name]:
if data["name"] == lib_name:
if data["exist"] == False:
debug.error("you must call this function after checking of the system exist() !2!")
if data["module"] == None:
# create a module from the system interface...
data["module"] = createModuleFromSystem(target, data)
data["loaded"] = True
target.add_module(data["module"])
return

View File

@@ -12,11 +12,14 @@ import os
import inspect
import fnmatch
import lutinDebug as debug
import lutinHeritage as heritage
import datetime
import lutinTools
import lutinModule
import lutinSystem
import lutinImage
import lutinHost
import lutinMultiprocess as multiprocess
class Target:
def __init__(self, name, config, arch):
@@ -57,11 +60,10 @@ class Target:
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
'-D_REENTRANT']
if self.name != "Windows":
self.global_flags_xx=['-std=c++11']
self.global_flags_mm=['-std=c++11']
else:
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-std=c++11']
self.global_flags_xx=[]
self.global_flags_mm=[]
if self.name == "Windows":
self.global_flags_xx=['-static-libgcc', '-static-libstdc++']
self.global_flags_mm=[]
self.global_flags_m=[]
self.global_flags_ar=['rcs']
@@ -89,6 +91,14 @@ class Target:
else:
self.global_flags_cc.append("-DNDEBUG")
self.global_flags_cc.append("-O3")
## To add code coverate on build result system
if self.config["gcov"] == True:
self.global_flags_cc.append("-fprofile-arcs")
self.global_flags_cc.append("-ftest-coverage")
self.global_flags_ld.append("-fprofile-arcs")
self.global_flags_ld.append("-ftest-coverage")
self.update_folder_tree()
self.folder_bin="/usr/bin"
self.folder_lib="/usr/lib"
@@ -101,8 +111,6 @@ class Target:
self.listFinalFile=[]
self.sysroot=""
self.externProjectManager = None
def update_folder_tree(self):
self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
@@ -110,6 +118,16 @@ class Target:
self.folder_staging="/staging/" + self.config["compilator"]
self.folder_build="/build/" + self.config["compilator"]
def create_number_from_version_string(self, data):
list = data.split(".")
out = 0;
offset = 1000**(len(list)-1)
for elem in list:
out += offset*int(elem)
debug.verbose("get : " + str(int(elem)) + " tmp" + str(out))
offset /= 1000
return out
def set_cross_base(self, cross=""):
self.cross = cross
debug.debug("== Target='" + self.cross + "'");
@@ -125,20 +143,20 @@ class Target:
self.xx = self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
#get g++ compilation version :
ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
if ret == False:
debug.error("Can not get the g++/clang++ version ...")
self.xx_version = self.create_number_from_version_string(ret)
debug.debug(self.config["compilator"] + "++ version=" + str(ret) + " number=" + str(self.xx_version))
self.ld = self.cross + "ld"
self.nm = self.cross + "nm"
self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool"
self.update_folder_tree()
def set_use_of_extern_build_tool(self, mode):
if mode == True:
if self.externProjectManager == None:
debug.error("This target does not support extern tool")
else:
# remove extern tool generator...
self.externProjectManager = None
def get_build_mode(self):
return self.config["mode"]
@@ -248,7 +266,7 @@ class Target:
return False
def add_module(self, newModule):
debug.debug("Import nodule for Taget : " + newModule.name)
debug.debug("Add nodule for Taget : " + newModule.name)
self.moduleList.append(newModule)
@@ -275,11 +293,27 @@ class Target:
return
debug.error("request to clean an un-existant module name : '" + name + "'")
def load_if_needed(self, name):
def load_if_needed(self, name, optionnal=False):
for elem in self.moduleList:
if elem.name == name:
return
lutinModule.load_module(self, name)
return True
if optionnal == False:
lutinModule.load_module(self, name)
return True
else:
# TODO : Check internal module and system module ...
# need to import the module (or the system module ...)
exist = lutinSystem.exist(name, self.name)
if exist == True:
lutinSystem.load(self, name, self.name)
return True;
# try to find in the local Modules:
exist = lutinModule.exist(self, name)
if exist == True:
lutinModule.load_module(self, name)
return True;
else:
return False;
def load_all(self):
listOfAllTheModule = lutinModule.list_all_module()
@@ -292,73 +326,73 @@ class Target:
module.ext_project_add_module(self, projectMng, addedModule)
return
def build_optionnal(self, moduleName, packagesName=None):
present = self.load_if_needed(moduleName, optionnal=True)
if present == False:
return [heritage.HeritageList(), False]
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
debug.debug("build module '" + moduleName + "'")
return [mod.build(self, None), True]
debug.warning("not know module name : '" + moduleName + "' to '" + "build" + "' it")
return [heritage.HeritageList(), False]
def build(self, name, packagesName=None):
if name == "dump":
debug.info("dump all")
self.load_all()
for mod in self.moduleList:
mod.display(self)
elif self.externProjectManager != None:
# TODO : Do it only if needed:
debug.debug("generate project")
# TODO : Set an option to force Regeneration of the project or the oposite....
return
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.moduleList:
if mod.name != "edn":
continue
if mod.type == "PACKAGE":
mod.create_project(self, self.externProjectManager)
# TODO : Run project or do something else ...
debug.error("stop here ...")
else:
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.moduleList:
if self.name=="Android":
if mod.type == "PACKAGE":
mod.build(self, None)
else:
if mod.type == "BINARY" \
or mod.type == "PACKAGE":
mod.build(self, None)
elif name == "clean":
debug.info("clean all")
self.load_all()
for mod in self.moduleList:
mod.clean(self)
else:
# get the action an the module ....
gettedElement = name.split("-")
moduleName = gettedElement[0]
if len(gettedElement)>=2:
actionName = gettedElement[1]
else :
actionName = "build"
debug.verbose("requested : " + moduleName + "-" + actionName)
if actionName == "install":
self.build(moduleName + "-build")
self.install_package(moduleName)
elif actionName == "uninstall":
self.un_install_package(moduleName)
elif actionName == "log":
self.Log(moduleName)
if self.name=="Android":
if mod.type == "PACKAGE":
mod.build(self, None)
else:
self.load_if_needed(moduleName)
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
if actionName == "dump":
debug.info("dump module '" + moduleName + "'")
return mod.display(self)
elif actionName == "clean":
debug.info("clean module '" + moduleName + "'")
return mod.clean(self)
elif actionName == "build":
debug.debug("build module '" + moduleName + "'")
return mod.build(self, None)
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
if mod.type == "BINARY" \
or mod.type == "PACKAGE":
mod.build(self, None)
elif name == "clean":
debug.info("clean all")
self.load_all()
for mod in self.moduleList:
mod.clean(self)
else:
# get the action an the module ....
gettedElement = name.split("-")
moduleName = gettedElement[0]
if len(gettedElement)>=2:
actionName = gettedElement[1]
else :
actionName = "build"
debug.verbose("requested : " + moduleName + "-" + actionName)
if actionName == "install":
self.build(moduleName + "-build")
self.install_package(moduleName)
elif actionName == "uninstall":
self.un_install_package(moduleName)
elif actionName == "log":
self.Log(moduleName)
else:
self.load_if_needed(moduleName)
# clean requested
for mod in self.moduleList:
if mod.name == moduleName:
if actionName == "dump":
debug.info("dump module '" + moduleName + "'")
return mod.display(self)
elif actionName == "clean":
debug.info("clean module '" + moduleName + "'")
return mod.clean(self)
elif actionName == "build":
debug.debug("build module '" + moduleName + "'")
return mod.build(self, None)
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
targetList=[]
__startTargetName="lutinTarget_"
@@ -395,7 +429,6 @@ def load_target(name, config):
theTarget = __import__(__startTargetName + name)
#create the target
tmpTarget = theTarget.Target(config)
#tmpTarget.set_use_of_extern_build_tool(externBuild)
return tmpTarget
def list_all_target():

View File

@@ -35,6 +35,11 @@ def create_directory_of_file(file):
except:
os.makedirs(folder)
def get_list_sub_folder(path):
# TODO : os.listdir(path)
for dirname, dirnames, filenames in os.walk(path):
return dirnames
return []
def remove_folder_and_sub_folder(path):
if os.path.isdir(path):
@@ -105,25 +110,34 @@ def copy_anything(src, dst):
tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
copy_file(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
debug.verbose("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
copy_file(tmpPath+"/"+cycleFile, dst+"/"+cycleFile)
def copy_anything_target(target, src, dst):
tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames
if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
target.add_file_staging(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
newDst = dst
if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
if root[len(src)-1:] != "":
newDst += root[len(src)-1:]
if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)

View File

@@ -0,0 +1,25 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-framework CoreAudio")
self.add_export_flag_LD("-framework AudioToolbox")

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/alsa/asoundlib.h") \
and not os.path.isfile("/usr/include/dssi/alsa/asoundlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-lasound")

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/boost/chrono.hpp"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD([
"-lboost_system",
"-lboost_thread",
"-lboost_chrono"
])

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)"
# check if the library exist:
if not os.path.isfile("/usr/include/jack/jack.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-ljack")

View File

@@ -0,0 +1,30 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="OSS : Linux Open Sound System\n Can be install with the package:\n - ... TODO ..."
# check if the library exist:
"""
if not os.path.isfile("/usr/include/jack/jack.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_CC("-ljack")
"""

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n - libpulse-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/pulse/pulseaudio.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-lpulse-simple", "-lpulse"])

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/zlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-lz"])

View File

@@ -0,0 +1,24 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD("-framework CoreAudio")
self.add_export_flag_LD("-framework CoreFoundation")

View File

View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug
import lutinSystem
import lutinTools as tools
import os
class System(lutinSystem.System):
def __init__(self):
lutinSystem.System.__init__(self)
# create some HELP:
self.help="DirectSound : Direct sound API for windows audio interface"
# check if the library exist:
if not os.path.isfile("/usr/i686-w64-mingw32/include/dsound.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag_LD(["-ldsound",
"-lwinmm",
"-lole32"
])

View File

@@ -10,7 +10,7 @@
import lutinDebug as debug
import lutinTarget
import lutinTools
import lutinTools as tools
import lutinHost
import lutinImage
import lutinMultiprocess
@@ -39,7 +39,7 @@ class Target(lutinTarget.Target):
if folder=="android":
self.folder_ndk = folder + "/ndk"
if self.folder_ndk == "AUTO":
self.folder_ndk = lutinTools.get_run_folder() + "/../android/ndk"
self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
# auto search SDK
if self.folder_sdk == "AUTO":
for folder in os.listdir("."):
@@ -47,7 +47,7 @@ class Target(lutinTarget.Target):
if folder=="android":
self.folder_sdk = folder + "/sdk"
if self.folder_sdk == "AUTO":
self.folder_sdk = lutinTools.get_run_folder() + "/../android/sdk"
self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
if not os.path.isdir(self.folder_ndk):
debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
@@ -219,7 +219,7 @@ class Target(lutinTarget.Target):
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
# Create folder :
lutinTools.create_directory_of_file(self.file_finalAbstraction)
tools.create_directory_of_file(self.file_finalAbstraction)
# Create file :
tmpFile = open(self.file_finalAbstraction, 'w')
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
@@ -331,7 +331,7 @@ class Target(lutinTarget.Target):
tmpFile.flush()
tmpFile.close()
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "":
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
@@ -344,7 +344,7 @@ class Target(lutinTarget.Target):
if pkgProperties["ANDROID_MANIFEST"]!="":
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
lutinTools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
else:
if "VERSION_CODE" not in pkgProperties:
pkgProperties["VERSION_CODE"] = "1"
@@ -470,7 +470,7 @@ class Target(lutinTarget.Target):
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
#create the Wallpaper sub files : (main element for the application
debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
@@ -483,7 +483,7 @@ class Target(lutinTarget.Target):
tmpFile.close()
# create wallpaper setting if needed (class and config file)
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
lutinTools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
tools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
tmpFile.write( "package " + compleatePackageName + ";\n")
@@ -515,7 +515,7 @@ class Target(lutinTarget.Target):
tmpFile.close()
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
@@ -546,7 +546,7 @@ class Target(lutinTarget.Target):
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
if WALL_type == "list":
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
@@ -572,14 +572,20 @@ class Target(lutinTarget.Target):
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
if res_source == "":
continue
lutinTools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
tools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
# Doc :
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
debug.print_element("pkg", "R.java", "<==", "Resources files")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/20.0.0/"
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/"
# find android tool version
dirnames = tools.get_list_sub_folder(androidToolPath)
if len(dirnames) != 1:
debug.error("an error occured when getting the tools for android")
androidToolPath += dirnames[0] + "/"
adModResouceFolder = ""
if "ADMOD_ID" in pkgProperties:
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
@@ -594,7 +600,7 @@ class Target(lutinTarget.Target):
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
debug.print_element("pkg", "*.class", "<==", "*.java")
# more information with : -Xlint
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
@@ -676,7 +682,7 @@ class Target(lutinTarget.Target):
debugOption = ""
cmdLine = "jarsigner " \
+ debugOption \
+ "-keystore " + lutinTools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
+ "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ " alias__AndroidDebugKey < tmpPass.boo"
@@ -701,7 +707,7 @@ class Target(lutinTarget.Target):
lutinMultiprocess.run_command(cmdLine)
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
# verbose mode : -v
cmdLine = androidToolPath + "zipalign 4 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
@@ -709,9 +715,9 @@ class Target(lutinTarget.Target):
lutinMultiprocess.run_command(cmdLine)
# copy file in the final stage :
lutinTools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
force=True)
tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
force=True)
def install_package(self, pkgName):
debug.debug("------------------------------------------------------------------------")

View File

@@ -13,7 +13,6 @@ import lutinTools
import lutinImage
import os
import stat
import lutinExtProjectGeneratorXCode
import lutinMultiprocess
import lutinHost
import random
@@ -33,7 +32,7 @@ class Target(lutinTarget.Target):
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
if sumulator == True:
if config["simulation"] == True:
arch = "i386"
else:
arch="arm64" # for ipad air
@@ -55,13 +54,13 @@ class Target(lutinTarget.Target):
self.suffix_binary=''
self.suffix_package=''
if self.sumulator == True:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=7.0")
self.global_flags_cc.append("-mios-simulator-version-min=7.0")
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=8.0")
self.global_flags_cc.append("-mios-simulator-version-min=8.0")
else:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk"
self.global_flags_ld.append("-miphoneos-version-min=7.0")
self.global_flags_cc.append("-miphoneos-version-min=7.0")
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk"
self.global_flags_ld.append("-miphoneos-version-min=8.0")
self.global_flags_cc.append("-miphoneos-version-min=8.0")
self.global_flags_ld.append([
"-Xlinker",
@@ -75,9 +74,6 @@ class Target(lutinTarget.Target):
self.global_flags_m.append("-fobjc-arc")
#self.global_flags_m.append("-fmodules")
#add a project generator:
self.externProjectManager = lutinExtProjectGeneratorXCode.ExtProjectGeneratorXCode()
def get_staging_folder(self, binaryName):
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"

View File

@@ -50,7 +50,7 @@ class Target(lutinTarget.Target):
if "ICON" in pkgProperties.keys() \
and pkgProperties["ICON"] != "":
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", True)
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", force=True)
# http://www.sandroid.org/imcross/#Deployment
infoFile=self.get_staging_folder(pkgName) + "/Info.plist"
@@ -66,7 +66,7 @@ class Target(lutinTarget.Target):
tmpFile.write(" <string>"+pkgName+"</string>\n")
tmpFile.write(" <key>CFBundleIdentifier</key>\n")
tmpFile.write(" <string>" + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
tmpFile.write(" <key>CFBundleSignature</key>\n")
tmpFile.write(" <key>CFBundleSignature</key>\n")
tmpFile.write(" <string>????</string>\n")
tmpFile.write(" <key>CFBundleIconFile</key>\n")
tmpFile.write(" <string>icon.icns</string>\n")

View File

@@ -44,6 +44,10 @@ class Target(lutinTarget.Target):
else:
# 32 bits
self.set_cross_base("i686-w64-mingw32-")
# force static link to prenvent many errors ...
self.global_flags_ld.append(["-static-libgcc",
"-static-libstdc++",
"-static"])
self.folder_bin=""
self.folder_lib="/lib"

File diff suppressed because it is too large Load Diff