[DEV] Add target searching and multi processor compilation

This commit is contained in:
Edouard DUPIN 2014-09-16 21:40:07 +02:00
parent 67297b3063
commit 33dc55d84b
19 changed files with 385 additions and 107 deletions

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
# for path inspection: # for path inspection:
import sys import sys
import os import os
@ -21,7 +29,7 @@ myLutinArg.add(lutinArg.ArgDefine("j", "jobs", haveParam=True, desc="Specifies t
myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements")) myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
myLutinArg.add_section("properties", "keep in the sequency of the cible") myLutinArg.add_section("properties", "keep in the sequency of the cible")
myLutinArg.add(lutinArg.ArgDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["IOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this")) myLutinArg.add(lutinArg.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")) myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")) 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("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
@ -126,60 +134,61 @@ import lutinTools
def Start(): def Start():
#available target : Linux / MacOs / Windows / Android ... #available target : Linux / MacOs / Windows / Android ...
targetName=lutinHost.OS targetName=lutinHost.OS
#compilation base config = {
compilator="gcc" "compilator":"gcc",
# build mode "mode":"release",
mode="release" "bus-size":"auto",
bus="auto" "arch":"auto",
arch="auto" "generate-package":True,
# package generationMode "simulation":False,
generatePackage=True "extern-build":False
}
# load the default target : # load the default target :
target = None target = None
simulationMode=False
actionDone=False actionDone=False
#build with extern tool
externBuild=False
# parse all argument # parse all argument
for argument in localArgument: for argument in localArgument:
if True==parseGenericArg(argument, False): if True==parseGenericArg(argument, False):
continue continue
elif argument.get_option_nName() == "package": elif argument.get_option_nName() == "package":
generatePackage=False config["generate-package"]=False
elif argument.get_option_nName() == "simulation": elif argument.get_option_nName() == "simulation":
simulationMode=True config["simulation"]=True
elif argument.get_option_nName() == "prj": elif argument.get_option_nName() == "prj":
externBuild=True config["extern-build"]=True
elif argument.get_option_nName() == "bus": elif argument.get_option_nName() == "bus":
debug.warning("argument bus is not implemented") debug.warning("argument bus is not implemented")
bus=argument.get_arg() config["bus-size"]=argument.get_arg()
elif argument.get_option_nName() == "arch": elif argument.get_option_nName() == "arch":
debug.warning("argument arch is not implemented") debug.warning("argument arch is not implemented")
arch=argument.get_arg() config["arch"]=argument.get_arg()
elif argument.get_option_nName() == "compilator": elif argument.get_option_nName() == "compilator":
if compilator!=argument.get_arg(): if compilator!=argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg()) debug.debug("change compilator ==> " + argument.get_arg())
compilator=argument.get_arg() config["compilator"]=argument.get_arg()
#remove previous target #remove previous target
target = None target = None
elif argument.get_option_nName() == "target": elif argument.get_option_nName() == "target":
# No check input ==> this will be verify automaticly chen the target will be loaded # No check input ==> this will be verify automaticly chen the target will be loaded
if targetName!=argument.get_arg(): if targetName!=argument.get_arg():
targetName=argument.get_arg() targetName=argument.get_arg()
debug.debug("change target ==> " + targetName + " & reset mode : gcc&release") debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
#reset properties by defauult: #reset properties by defauult:
compilator="gcc" config = {
mode="release" "compilator":"gcc",
bus="auto" "mode":"release",
arch="auto" "bus-size":"auto",
generatePackage=True "arch":"auto",
simulationMode=False "generate-package":True,
"simulation":False,
"extern-build":False
}
#remove previous target #remove previous target
target = None target = None
elif argument.get_option_nName() == "mode": elif argument.get_option_nName() == "mode":
if mode!=argument.get_arg(): if config["mode"]!=argument.get_arg():
mode = argument.get_arg() config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + mode) debug.debug("change mode ==> " + config["mode"])
#remove previous target #remove previous target
target = None target = None
else: else:
@ -189,14 +198,14 @@ def Start():
else: else:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode) target = lutinTarget.load_target(targetName, config)
target.build(argument.get_arg()) target.build(argument.get_arg())
actionDone=True actionDone=True
# if no action done : we do "all" ... # if no action done : we do "all" ...
if actionDone==False: if actionDone==False:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode) target = lutinTarget.load_target(targetName, config)
target.build("all") target.build("all")
# stop all started threads # stop all started threads
lutinMultiprocess.un_init() lutinMultiprocess.un_init()
@ -220,6 +229,7 @@ if __name__ == '__main__':
and folder.lower()!="out" : and folder.lower()!="out" :
debug.debug("Automatic load path: '" + folder + "'") debug.debug("Automatic load path: '" + folder + "'")
lutinModule.import_path(folder) lutinModule.import_path(folder)
lutinTarget.import_path(folder)
Start() Start()

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import thread import thread
import lutinMultiprocess import lutinMultiprocess

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import lutinDebug as debug import lutinDebug as debug
import lutinEnv as environement import lutinEnv as environement

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import datetime import datetime
import lutinTools import lutinTools

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import datetime import datetime
import lutinTools as tools import lutinTools as tools

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import platform import platform
import sys import sys
import lutinDebug as debug import lutinDebug as debug
@ -13,8 +21,13 @@ elif platform.system() == "Darwin":
else: else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'") debug.error("Unknow the Host OS ... '" + platform.system() + "'")
debug.debug(" host.OS = " + OS) debug.debug("host.OS = " + OS)
OS64BITS = sys.maxsize > 2**32 if sys.maxsize > 2**32:
OS32BITS = OS64BITS==False BUS_SIZE = 64
else:
BUS_SIZE = 32
debug.debug("host.BUS_SIZE = " + str(BUS_SIZE))

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTools as tools import lutinTools as tools
import platform import platform

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import os import os
import inspect import inspect
@ -360,7 +368,7 @@ class Module:
debug.print_element("Executable", self.name, "==>", file_dst) debug.print_element("Executable", self.name, "==>", file_dst)
lutinMultiprocess.run_command(cmdLine) lutinMultiprocess.run_command(cmdLine)
if "release"==target.buildMode \ if "release"==target.config["mode"] \
or lutinEnv.get_force_strip_mode()==True: or lutinEnv.get_force_strip_mode()==True:
# get the file size of the non strip file # get the file size of the non strip file
originSize = lutinTools.file_size(file_dst); originSize = lutinTools.file_size(file_dst);

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug
import threading import threading

View File

@ -1,49 +1,62 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import datetime import datetime
import lutinTools import lutinTools
import lutinModule import lutinModule
import lutinImage import lutinImage
import lutinHost
class Target: class Target:
def __init__(self, name, typeCompilator, debugMode, generatePackage, arch, cross, sumulator=False): def __init__(self, name, config, arch):
self.config = config
#processor type selection (auto/arm/ppc/x86)
self.selectArch = config["arch"]; # TODO : Remove THIS ...
#bus size selection (auto/32/64)
self.selectBus = config["bus-size"]; # TODO : Remove THIS ...
if config["bus-size"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
if config["arch"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
debug.info("config=" + str(config))
if arch != "": if arch != "":
self.arch = "-arch " + arch self.arch = "-arch " + arch
else: else:
self.arch = "" self.arch = ""
#processor type selection (auto/arm/ppc/x86)
self.selectArch = "auto" # todo : remove this :
#bus size selection (auto/32/64) self.sumulator = config["simulation"]
self.selectBus = "auto"
self.sumulator = sumulator
self.cross = cross
self.name=name self.name=name
self.endGeneratePackage = generatePackage self.endGeneratePackage = config["generate-package"]
debug.info("================================="); debug.info("=================================");
debug.info("== Target='" + self.name + "'"); debug.info("== Target='" + self.name + "'");
debug.info("================================="); debug.info("=================================");
self.ar=self.cross + "ar"
self.ranlib=self.cross + "ranlib" self.set_cross_base()
if typeCompilator == "clang":
self.cc=self.cross + "clang"
self.xx=self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
self.cc=self.cross + "gcc"
self.xx=self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
self.ld=self.cross + "ld"
self.nm=self.cross + "nm"
self.strip=self.cross + "strip"
self.dlltool=self.cross + "dlltool"
############################################################################### ###############################################################################
# Target global variables. # Target global variables.
############################################################################### ###############################################################################
self.global_include_cc=[] self.global_include_cc=[]
self.global_flags_cc=['-D__TARGET_OS__'+self.name, self.global_flags_cc=['-D__TARGET_OS__'+self.name,
'-D__TARGET_ARCH__'+self.selectArch,
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
'-D_REENTRANT'] '-D_REENTRANT']
if self.name != "Windows": if self.name != "Windows":
self.global_flags_xx=['-std=c++11'] self.global_flags_xx=['-std=c++11']
self.global_flags_mm=['-std=c++11'] self.global_flags_mm=['-std=c++11']
@ -69,19 +82,14 @@ class Target:
self.folder_arch="/" + self.name self.folder_arch="/" + self.name
if "debug" == debugMode: if "debug" == self.config["mode"]:
self.buildMode = "debug"
self.global_flags_cc.append("-g") self.global_flags_cc.append("-g")
self.global_flags_cc.append("-DDEBUG") self.global_flags_cc.append("-DDEBUG")
self.global_flags_cc.append("-O0") self.global_flags_cc.append("-O0")
else: else:
self.buildMode = "release"
self.global_flags_cc.append("-DNDEBUG") self.global_flags_cc.append("-DNDEBUG")
self.global_flags_cc.append("-O3") self.global_flags_cc.append("-O3")
self.folder_out="/out" + self.folder_arch + "/" + self.buildMode self.update_folder_tree()
self.folder_final="/final/" + typeCompilator
self.folder_staging="/staging/" + typeCompilator
self.folder_build="/build/" + typeCompilator
self.folder_bin="/usr/bin" self.folder_bin="/usr/bin"
self.folder_lib="/usr/lib" self.folder_lib="/usr/lib"
self.folder_data="/usr/share" self.folder_data="/usr/share"
@ -96,6 +104,33 @@ class Target:
self.externProjectManager = None self.externProjectManager = None
def update_folder_tree(self):
self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
self.folder_final="/final/" + self.config["compilator"]
self.folder_staging="/staging/" + self.config["compilator"]
self.folder_build="/build/" + self.config["compilator"]
def set_cross_base(self, cross=""):
self.cross = cross
debug.debug("== Target='" + self.cross + "'");
self.ar = self.cross + "ar"
self.ranlib = self.cross + "ranlib"
if self.config["compilator"] == "clang":
self.cc = self.cross + "clang"
self.xx = self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
self.cc = self.cross + "gcc"
self.xx = self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
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): def set_use_of_extern_build_tool(self, mode):
if mode == True: if mode == True:
if self.externProjectManager == None: if self.externProjectManager == None:
@ -105,7 +140,7 @@ class Target:
self.externProjectManager = None self.externProjectManager = None
def get_build_mode(self): def get_build_mode(self):
return self.buildMode return self.config["mode"]
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None): def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
for source, dst, x, y, cmdFile2 in self.listFinalFile: for source, dst, x, y, cmdFile2 in self.listFinalFile:
@ -325,17 +360,61 @@ class Target:
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it") debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
__startTargetName="lutinTarget" targetList=[]
__startTargetName="lutinTarget_"
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, __startTargetName + "*.py")
# Import the module :
for filename in tmpList:
debug.debug(' Find a file : "%s"' %os.path.join(root, filename))
#matches.append(os.path.join(root, filename))
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
targetName = filename.replace('.py', '')
targetName = targetName.replace(__startTargetName, '')
debug.debug("integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
targetList.append([targetName,os.path.join(root, filename)])
def load_target(name, config):
global targetList
debug.debug("load target: " + name)
if len(targetList) == 0:
debug.error("No target to compile !!!")
debug.debug("list target: " + str(targetList))
for mod in targetList:
if mod[0] == name:
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
sys.path.append(os.path.dirname(mod[1]))
debug.verbose("import target : '" + __startTargetName + name + "'")
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(): def list_all_target():
tmpListName = ["Android", "Linux", "MacOs", "IOs", "Windows" ] global targetList
tmpListName = []
for mod in targetList:
tmpListName.append(mod[0])
return tmpListName return tmpListName
def target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode): def list_all_target_with_desc():
theTarget = __import__(__startTargetName + targetName) global targetList
#try: tmpList = []
tmpTarget = theTarget.Target(compilator, mode, generatePackage, simulationMode) for mod in targetList:
tmpTarget.set_use_of_extern_build_tool(externBuild) sys.path.append(os.path.dirname(mod[1]))
return tmpTarget theTarget = __import__(__startTargetName + mod[0])
#except: try:
# debug.error("Can not create the Target : '" + targetName + "'") tmpdesc = theTarget.get_desc()
tmpList.append([mod[0], tmpdesc])
except:
debug.warning("has no name : " + mod[0])
tmpList.append([mod[0], ""])
return tmpList

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import shutil import shutil
import errno import errno

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTarget import lutinTarget
@ -6,11 +14,21 @@ import lutinTools
import lutinHost import lutinHost
import lutinImage import lutinImage
import lutinMultiprocess import lutinMultiprocess
import lutinHost
import os import os
import sys import sys
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "arm"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = "32"
arch = ""#"ARMv7"
lutinTarget.Target.__init__(self, "Android", config, arch)
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO") self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO") self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
@ -36,18 +54,18 @@ class Target(lutinTarget.Target):
if not os.path.isdir(self.folder_sdk): if not os.path.isdir(self.folder_sdk):
debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path") debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
arch = ""#"ARMv7"
tmpOsVal = "64" tmpOsVal = "64"
gccVersion = "4.8" gccVersion = "4.8"
if lutinHost.OS64BITS==True: if lutinHost.BUS_SIZE==64:
tmpOsVal = "_64" tmpOsVal = "_64"
if typeCompilator == "clang": if self.config["compilator"] == "clang":
cross = self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/" self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
else: else:
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
cross = baseFolderArm + "arm-linux-androideabi-" self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
if not os.path.isdir(baseFolderArm): if not os.path.isdir(baseFolderArm):
debug.error("Gcc Arm path does not exist !!!") debug.error("Gcc Arm path does not exist !!!")
if not os.path.isdir(baseFolderMips): if not os.path.isdir(baseFolderMips):
@ -55,8 +73,14 @@ class Target(lutinTarget.Target):
if not os.path.isdir(baseFolderX86): if not os.path.isdir(baseFolderX86):
debug.info("Gcc x86 path does not exist !!!") debug.info("Gcc x86 path does not exist !!!")
lutinTarget.Target.__init__(self, "Android", typeCompilator, debugMode, generatePackage, arch, cross, sumulator)
arch = "ARMv7" arch = "ARMv7"
if self.selectBus = "auto":
if self.selectArch = "auto":
lutinHost.BUS_SIZE
# for gcc : # for gcc :
# for clang : # for clang :

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
@ -7,24 +15,34 @@ import os
import stat import stat
import lutinExtProjectGeneratorXCode import lutinExtProjectGeneratorXCode
import lutinMultiprocess import lutinMultiprocess
import lutinHost
import random import random
import re import re
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
if typeCompilator == "gcc": if config["compilator"] == "gcc":
debug.info("compile only with clang for IOs"); debug.info("compile only with clang for IOs");
typeCompilator = "clang" config["compilator"] = "clang"
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "arm"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = "64"
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
if sumulator == True: if sumulator == True:
arch = "i386" arch = "i386"
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
else: else:
arch="arm64" # for ipad air arch="arm64" # for ipad air
#arch="armv7" # for Iphone 4 #arch="armv7" # for Iphone 4
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/" lutinTarget.Target.__init__(self, "IOs", config, arch)
lutinTarget.Target.__init__(self, "IOs", typeCompilator, debugMode, generatePackage, arch, cross, sumulator) if self.config["simulation"] == True:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
else:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
# remove unneeded ranlib ... # remove unneeded ranlib ...
self.ranlib="" self.ranlib=""

View File

@ -1,4 +1,12 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools as tools import lutinTools as tools
@ -6,10 +14,17 @@ import os
import stat import stat
import re import re
import lutinMultiprocess import lutinMultiprocess
import lutinHost
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, generatePackage, "", "") #processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Linux", config, "")
def generate_list_separate_coma(self, list): def generate_list_separate_coma(self, list):
result = "" result = ""

View File

@ -1,17 +1,30 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
import lutinHost
import os import os
import stat import stat
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
cross = "" #processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, generatePackage, "", cross) lutinTarget.Target.__init__(self, "MacOs", config, "")
self.folder_bin="/MacOS" self.folder_bin="/MacOS"
self.folder_lib="/lib" self.folder_lib="/lib"

View File

@ -1,31 +1,49 @@
#!/usr/bin/python #!/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 lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
import lutinHost
import os import os
import stat import stat
import lutinHost
import sys import sys
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
if config["compilator"] != "gcc":
debug.error("Windows does not support '" + config["compilator"] + "' compilator ... availlable : [gcc]")
config["compilator"] = "gcc"
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Windows", config, "")
# on windows board the basic path is not correct # on windows board the basic path is not correct
# TODO : get external PATH for the minGW path # TODO : get external PATH for the minGW path
# TODO : Set the cyngwin path ... # TODO : Set the cyngwin path ...
if lutinHost.OS == "Windows": if lutinHost.OS == "Windows":
cross = "c:\\MinGW\\bin\\" self.set_cross_base("c:\\MinGW\\bin\\")
sys.path.append("c:\\MinGW\\bin" ) sys.path.append("c:\\MinGW\\bin" )
os.environ['PATH'] += ";c:\\MinGW\\bin\\" os.environ['PATH'] += ";c:\\MinGW\\bin\\"
else: else:
#target 64 bits: if self.config["bus-size"] == "64":
cross = "x86_64-w64-mingw32-" # 64 bits
# target 32 bits: self.set_cross_base("x86_64-w64-mingw32-")
cross = "i686-w64-mingw32-" else:
# 32 bits
if typeCompilator!="gcc": self.set_cross_base("i686-w64-mingw32-")
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, generatePackage, "", cross)
self.folder_bin="" self.folder_bin=""
self.folder_lib="/lib" self.folder_lib="/lib"