Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
6cb2ef2bd2 | |||
aa120cde57 | |||
2604cd93be |
18
bin/lutin
18
bin/lutin
@@ -31,6 +31,7 @@ myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of
|
||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||
myArgs.add(arguments.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'"))
|
||||
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||
myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="with travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
|
||||
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
||||
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
||||
@@ -47,18 +48,19 @@ localArgument = myArgs.parse()
|
||||
display the help of this makefile
|
||||
"""
|
||||
def usage():
|
||||
color = debug.get_color_set()
|
||||
# generic argument displayed :
|
||||
myArgs.display()
|
||||
print(" All target can finish with '?clean' '?dump' ... ?action")
|
||||
print(" all")
|
||||
print(" " + color['green'] + "all" + color['default'])
|
||||
print(" build all (only for the current selected board) (bynary and packages)")
|
||||
print(" clean")
|
||||
print(" " + color['green'] + "clean" + color['default'])
|
||||
print(" clean all (same as previous)")
|
||||
print(" dump")
|
||||
print(" " + color['green'] + "dump" + color['default'])
|
||||
print(" Dump all the module dependency and properties")
|
||||
listOfAllModule = module.list_all_module_with_desc()
|
||||
for mod in listOfAllModule:
|
||||
print(" " + mod[0])
|
||||
print(" " + color['green'] + mod[0] + color['default'])
|
||||
if mod[1] != "":
|
||||
print(" " + mod[1])
|
||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||
@@ -139,7 +141,8 @@ config = {
|
||||
"arch":"auto",
|
||||
"generate-package":True,
|
||||
"simulation":False,
|
||||
"gcov":False
|
||||
"gcov":False,
|
||||
"compilator-version":""
|
||||
}
|
||||
# load the default target :
|
||||
my_target = None
|
||||
@@ -148,6 +151,8 @@ actionDone=False
|
||||
for argument in localArgument:
|
||||
if parseGenericArg(argument, False) == True:
|
||||
continue
|
||||
elif argument.get_option_nName() == "compilator-version":
|
||||
config["compilator-version"] = argument.get_arg()
|
||||
elif argument.get_option_nName() == "package":
|
||||
config["generate-package"]=False
|
||||
elif argument.get_option_nName() == "simulation":
|
||||
@@ -177,7 +182,8 @@ for argument in localArgument:
|
||||
"arch":"auto",
|
||||
"generate-package":True,
|
||||
"simulation":False,
|
||||
"gcov":False
|
||||
"gcov":False,
|
||||
"compilator-version":""
|
||||
}
|
||||
#remove previous target
|
||||
my_target = None
|
||||
|
13
lutin/arg.py
13
lutin/arg.py
@@ -70,12 +70,13 @@ class ArgDefine:
|
||||
return False
|
||||
|
||||
def display(self):
|
||||
color = debug.get_color_set()
|
||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
||||
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
|
||||
print(" " + color['red'] + "-" + self.m_optionSmall + "" + color['default'] + " / " + color['red'] + "--" + self.m_optionBig + color['default'])
|
||||
elif self.m_optionSmall != "":
|
||||
print(" -" + self.m_optionSmall)
|
||||
print(" " + color['red'] + "-" + self.m_optionSmall + color['default'])
|
||||
elif self.m_optionBig != "":
|
||||
print(" --" + self.m_optionBig)
|
||||
print(" " + color['red'] + "--" + self.m_optionBig + color['default'])
|
||||
else:
|
||||
print(" ???? ==> internal error ...")
|
||||
if self.m_description != "":
|
||||
@@ -115,10 +116,12 @@ class ArgSection:
|
||||
return ""
|
||||
|
||||
def get_porperties(self):
|
||||
return " [" + self.m_section + "]"
|
||||
color = debug.get_color_set()
|
||||
return " [" + color['blue'] + self.m_section + color['default'] + "]"
|
||||
|
||||
def display(self):
|
||||
print(" [" + self.m_section + "] : " + self.m_description)
|
||||
color = debug.get_color_set()
|
||||
print(" [" + color['blue'] + self.m_section + color['default'] + "] : " + self.m_description)
|
||||
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
|
@@ -138,4 +138,22 @@ def print_compilator(myString):
|
||||
|
||||
debugLock.acquire()
|
||||
print(myString)
|
||||
debugLock.release()
|
||||
debugLock.release()
|
||||
|
||||
def get_color_set() :
|
||||
global color_default
|
||||
global color_red
|
||||
global color_green
|
||||
global color_yellow
|
||||
global color_blue
|
||||
global color_purple
|
||||
global color_cyan
|
||||
return {
|
||||
"default": color_default,
|
||||
"red": color_red,
|
||||
"green": color_green,
|
||||
"yellow": color_yellow,
|
||||
"blue": color_blue,
|
||||
"purple": color_purple,
|
||||
"cyan": color_cyan,
|
||||
}
|
||||
|
@@ -92,7 +92,9 @@ def print_pretty(myString, force=False):
|
||||
"-arch",
|
||||
"-keystore",
|
||||
"-sigalg",
|
||||
"-digestalg"]
|
||||
"-digestalg",
|
||||
"-target",
|
||||
"-gcc-toolchain"]
|
||||
for element in baseElementList:
|
||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||
for element in ["<", "<<", ">", ">>"]:
|
||||
|
@@ -66,6 +66,8 @@ def run_command_direct(cmdLine):
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
except subprocess.CalledProcessError as e:
|
||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||
except:
|
||||
debug.error("Exception on : " + str(args))
|
||||
# launch the subprocess:
|
||||
output, err = p.communicate()
|
||||
if sys.version_info >= (3, 0):
|
||||
@@ -92,6 +94,8 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
except subprocess.CalledProcessError as e:
|
||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||
except:
|
||||
debug.error("Exception on : " + str(args))
|
||||
# launch the subprocess:
|
||||
output, err = p.communicate()
|
||||
if sys.version_info >= (3, 0):
|
||||
|
@@ -148,13 +148,16 @@ class Target:
|
||||
if self.config["compilator"] == "clang":
|
||||
self.cc = self.cross + "clang"
|
||||
self.xx = self.cross + "clang++"
|
||||
#self.ar=self.cross + "llvm-ar"
|
||||
#self.ranlib="ls"
|
||||
self.ar=self.cross + "llvm-ar"
|
||||
self.ranlib=""
|
||||
else:
|
||||
self.cc = self.cross + "gcc"
|
||||
self.xx = self.cross + "g++"
|
||||
#self.ar=self.cross + "ar"
|
||||
#self.ranlib=self.cross + "ranlib"
|
||||
if self.config["compilator-version"] != "":
|
||||
self.cc = self.cc + "-" + self.config["compilator-version"]
|
||||
self.xx = self.xx + "-" + self.config["compilator-version"]
|
||||
|
||||
#get g++ compilation version :
|
||||
ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
|
||||
|
@@ -25,10 +25,14 @@ class Target(target.Target):
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = "32"
|
||||
|
||||
arch = ""#"ARMv7"
|
||||
arch = ""
|
||||
target.Target.__init__(self, "Android", config, arch)
|
||||
|
||||
if config["bus-size"] == "32":
|
||||
arch="armv7"
|
||||
else:
|
||||
arch="arm64"
|
||||
|
||||
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
# auto search NDK
|
||||
@@ -59,7 +63,7 @@ class Target(target.Target):
|
||||
if host.BUS_SIZE==64:
|
||||
tmpOsVal = "_64"
|
||||
if self.config["compilator"] == "clang":
|
||||
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
|
||||
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
|
||||
else:
|
||||
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/"
|
||||
@@ -72,12 +76,6 @@ class Target(target.Target):
|
||||
if not os.path.isdir(baseFolderX86):
|
||||
debug.info("Gcc x86 path does not exist !!!")
|
||||
|
||||
arch = "ARMv7"
|
||||
# for gcc :
|
||||
|
||||
# for clang :
|
||||
|
||||
|
||||
self.folder_bin="/mustNotCreateBinary"
|
||||
self.folder_lib="/data/lib/armeabi"
|
||||
self.folder_data="/data/assets"
|
||||
@@ -86,7 +84,8 @@ class Target(target.Target):
|
||||
|
||||
# board id at 14 is for android 4.0 and more ...
|
||||
self.boardId = 14
|
||||
if arch == "ARMv5" or arch == "ARMv7":
|
||||
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
||||
if arch == "armv5" or arch == "armv7":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||
elif arch == "mips":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
||||
@@ -95,15 +94,29 @@ class Target(target.Target):
|
||||
|
||||
if True:
|
||||
if self.config["compilator"] == "clang":
|
||||
if self.boardId < 21:
|
||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
# llvm-libc++ : BSD | MIT
|
||||
self.global_include_cc.append("-gcc-toolchain " + self.folder_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
if arch == "ARMv5":
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "ARMv7":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "armv7":
|
||||
# The only one tested ... ==> but we have link error ...
|
||||
self.global_flags_cc.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_cc.append("-march=armv7-a")
|
||||
self.global_flags_cc.append("-mfpu=vfpv3-d16")
|
||||
self.global_flags_cc.append("-mhard-float")
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a")
|
||||
self.global_flags_ld.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_ld.append("-Wl,--fix-cortex-a8")
|
||||
self.global_flags_ld.append("-Wl,--no-warn-mismatch")
|
||||
self.global_flags_ld.append("-lm_hard")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
@@ -113,13 +126,16 @@ class Target(target.Target):
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
else:
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
# GPL v3 (+ exception link for gcc compilator)
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||
if arch == "ARMv5":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include/")
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "ARMv7":
|
||||
elif arch == "armv7":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
@@ -145,22 +161,23 @@ class Target(target.Target):
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||
if self.arch == "ARM":
|
||||
# -----------------------
|
||||
# -- arm V5 :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-march=armv5te")
|
||||
self.global_flags_cc.append("-msoft-float")
|
||||
else:
|
||||
# -----------------------
|
||||
# -- arm V7 (Neon) :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-mfpu=neon")
|
||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||
self.global_flags_ld.append("-mfpu=neon")
|
||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
||||
if self.config["compilator"] != "clang":
|
||||
if self.arch == "armv5":
|
||||
# -----------------------
|
||||
# -- arm V5 :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-march=armv5te")
|
||||
self.global_flags_cc.append("-msoft-float")
|
||||
else:
|
||||
# -----------------------
|
||||
# -- arm V7 (Neon) :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-mfpu=neon")
|
||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||
self.global_flags_ld.append("-mfpu=neon")
|
||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
||||
|
||||
# the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags)
|
||||
self.global_flags_cc.append("-mthumb")
|
||||
@@ -168,20 +185,17 @@ class Target(target.Target):
|
||||
# -- Common flags :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.global_flags_cc.append("-ffunction-sections")
|
||||
self.global_flags_cc.append("-funwind-tables")
|
||||
self.global_flags_cc.append("-fstack-protector")
|
||||
self.global_flags_cc.append("-Wno-psabi")
|
||||
self.global_flags_cc.append("-mtune=xscale")
|
||||
self.global_flags_cc.append("-fexceptions")
|
||||
##self.global_flags_cc.append("-fno-exceptions")
|
||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||
|
||||
if self.config["compilator"] != "clang":
|
||||
self.global_flags_cc.append("-ffunction-sections")
|
||||
self.global_flags_cc.append("-funwind-tables")
|
||||
self.global_flags_cc.append("-fstack-protector")
|
||||
self.global_flags_cc.append("-Wno-psabi")
|
||||
self.global_flags_cc.append("-mtune=xscale")
|
||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||
self.global_flags_xx.append("-frtti")
|
||||
self.global_flags_cc.append("-fexceptions")
|
||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||
|
||||
|
||||
|
||||
def check_right_package(self, pkgProperties, value):
|
||||
for val in pkgProperties["RIGHT"]:
|
||||
|
@@ -61,7 +61,8 @@ class Target(target.Target):
|
||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
|
||||
self.global_flags_ld.append("-miphoneos-version-min=8.0")
|
||||
self.global_flags_cc.append("-miphoneos-version-min=8.0")
|
||||
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
self.global_flags_ld.append([
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
@@ -71,10 +72,10 @@ class Target(target.Target):
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"])
|
||||
|
||||
|
||||
self.global_flags_m.append("-fobjc-arc")
|
||||
#self.global_flags_m.append("-fmodules")
|
||||
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
||||
|
||||
|
@@ -32,6 +32,8 @@ class Target(target.Target):
|
||||
# 32 bits
|
||||
if host.BUS_SIZE != 32:
|
||||
self.global_flags_cc.append("-m32")
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
|
||||
def generate_list_separate_coma(self, list):
|
||||
result = ""
|
||||
|
@@ -38,6 +38,8 @@ class Target(target.Target):
|
||||
self.suffix_binary=''
|
||||
self.suffix_package=''
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||
|
@@ -59,6 +59,7 @@ class Target(target.Target):
|
||||
self.suffix_lib_dynamic='.dll'
|
||||
self.suffix_binary='.exe'
|
||||
self.suffix_package=''
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
|
Reference in New Issue
Block a user