[DEV] try integrate clang on android
This commit is contained in:
parent
10055dd3c6
commit
2604cd93be
@ -92,7 +92,9 @@ def print_pretty(myString, force=False):
|
|||||||
"-arch",
|
"-arch",
|
||||||
"-keystore",
|
"-keystore",
|
||||||
"-sigalg",
|
"-sigalg",
|
||||||
"-digestalg"]
|
"-digestalg",
|
||||||
|
"-target",
|
||||||
|
"-gcc-toolchain"]
|
||||||
for element in baseElementList:
|
for element in baseElementList:
|
||||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||||
for element in ["<", "<<", ">", ">>"]:
|
for element in ["<", "<<", ">", ">>"]:
|
||||||
|
@ -66,6 +66,8 @@ def run_command_direct(cmdLine):
|
|||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
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)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
|
@ -148,8 +148,8 @@ class Target:
|
|||||||
if self.config["compilator"] == "clang":
|
if self.config["compilator"] == "clang":
|
||||||
self.cc = self.cross + "clang"
|
self.cc = self.cross + "clang"
|
||||||
self.xx = self.cross + "clang++"
|
self.xx = self.cross + "clang++"
|
||||||
#self.ar=self.cross + "llvm-ar"
|
self.ar=self.cross + "llvm-ar"
|
||||||
#self.ranlib="ls"
|
self.ranlib=""
|
||||||
else:
|
else:
|
||||||
self.cc = self.cross + "gcc"
|
self.cc = self.cross + "gcc"
|
||||||
self.xx = self.cross + "g++"
|
self.xx = self.cross + "g++"
|
||||||
|
@ -25,10 +25,14 @@ class Target(target.Target):
|
|||||||
#bus size selection (auto/32/64)
|
#bus size selection (auto/32/64)
|
||||||
if config["bus-size"] == "auto":
|
if config["bus-size"] == "auto":
|
||||||
config["bus-size"] = "32"
|
config["bus-size"] = "32"
|
||||||
|
arch = ""
|
||||||
arch = ""#"ARMv7"
|
|
||||||
target.Target.__init__(self, "Android", config, 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_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||||
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||||
# auto search NDK
|
# auto search NDK
|
||||||
@ -59,7 +63,7 @@ class Target(target.Target):
|
|||||||
if host.BUS_SIZE==64:
|
if host.BUS_SIZE==64:
|
||||||
tmpOsVal = "_64"
|
tmpOsVal = "_64"
|
||||||
if self.config["compilator"] == "clang":
|
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:
|
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/"
|
||||||
@ -72,12 +76,6 @@ class Target(target.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 !!!")
|
||||||
|
|
||||||
arch = "ARMv7"
|
|
||||||
# for gcc :
|
|
||||||
|
|
||||||
# for clang :
|
|
||||||
|
|
||||||
|
|
||||||
self.folder_bin="/mustNotCreateBinary"
|
self.folder_bin="/mustNotCreateBinary"
|
||||||
self.folder_lib="/data/lib/armeabi"
|
self.folder_lib="/data/lib/armeabi"
|
||||||
self.folder_data="/data/assets"
|
self.folder_data="/data/assets"
|
||||||
@ -86,7 +84,8 @@ class Target(target.Target):
|
|||||||
|
|
||||||
# board id at 14 is for android 4.0 and more ...
|
# board id at 14 is for android 4.0 and more ...
|
||||||
self.boardId = 14
|
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/")
|
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||||
elif arch == "mips":
|
elif arch == "mips":
|
||||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
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 True:
|
||||||
if self.config["compilator"] == "clang":
|
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/")
|
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/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||||
elif arch == "ARMv7":
|
elif arch == "armv7":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi-v7a/"
|
# The only one tested ... ==> but we have link error ...
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_flags_cc.append("-target armv7-none-linux-androideabi")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
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":
|
elif arch == "mips":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
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_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||||
else:
|
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/")
|
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/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
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/libgnustl_static.a")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.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/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
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/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_5T__")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||||
if self.arch == "ARM":
|
if self.config["compilator"] != "clang":
|
||||||
# -----------------------
|
if self.arch == "armv5":
|
||||||
# -- arm V5 :
|
# -----------------------
|
||||||
# -----------------------
|
# -- arm V5 :
|
||||||
self.global_flags_cc.append("-march=armv5te")
|
# -----------------------
|
||||||
self.global_flags_cc.append("-msoft-float")
|
self.global_flags_cc.append("-march=armv5te")
|
||||||
else:
|
self.global_flags_cc.append("-msoft-float")
|
||||||
# -----------------------
|
else:
|
||||||
# -- arm V7 (Neon) :
|
# -----------------------
|
||||||
# -----------------------
|
# -- arm V7 (Neon) :
|
||||||
self.global_flags_cc.append("-mfpu=neon")
|
# -----------------------
|
||||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
self.global_flags_cc.append("-mfpu=neon")
|
||||||
self.global_flags_ld.append("-mfpu=neon")
|
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
self.global_flags_ld.append("-mfpu=neon")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
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)
|
# 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")
|
self.global_flags_cc.append("-mthumb")
|
||||||
@ -168,20 +185,17 @@ class Target(target.Target):
|
|||||||
# -- Common flags :
|
# -- Common flags :
|
||||||
# -----------------------
|
# -----------------------
|
||||||
self.global_flags_cc.append("-fpic")
|
self.global_flags_cc.append("-fpic")
|
||||||
self.global_flags_cc.append("-ffunction-sections")
|
if self.config["compilator"] != "clang":
|
||||||
self.global_flags_cc.append("-funwind-tables")
|
self.global_flags_cc.append("-ffunction-sections")
|
||||||
self.global_flags_cc.append("-fstack-protector")
|
self.global_flags_cc.append("-funwind-tables")
|
||||||
self.global_flags_cc.append("-Wno-psabi")
|
self.global_flags_cc.append("-fstack-protector")
|
||||||
self.global_flags_cc.append("-mtune=xscale")
|
self.global_flags_cc.append("-Wno-psabi")
|
||||||
self.global_flags_cc.append("-fexceptions")
|
self.global_flags_cc.append("-mtune=xscale")
|
||||||
##self.global_flags_cc.append("-fno-exceptions")
|
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
|
||||||
|
|
||||||
self.global_flags_xx.append("-frtti")
|
self.global_flags_xx.append("-frtti")
|
||||||
|
self.global_flags_cc.append("-fexceptions")
|
||||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_right_package(self, pkgProperties, value):
|
def check_right_package(self, pkgProperties, value):
|
||||||
for val in pkgProperties["RIGHT"]:
|
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.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_ld.append("-miphoneos-version-min=8.0")
|
||||||
self.global_flags_cc.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([
|
self.global_flags_ld.append([
|
||||||
"-Xlinker",
|
"-Xlinker",
|
||||||
"-objc_abi_version",
|
"-objc_abi_version",
|
||||||
@ -71,10 +72,10 @@ class Target(target.Target):
|
|||||||
"-stdlib=libc++",
|
"-stdlib=libc++",
|
||||||
"-fobjc-arc",
|
"-fobjc-arc",
|
||||||
"-fobjc-link-runtime"])
|
"-fobjc-link-runtime"])
|
||||||
|
|
||||||
self.global_flags_m.append("-fobjc-arc")
|
self.global_flags_m.append("-fobjc-arc")
|
||||||
#self.global_flags_m.append("-fmodules")
|
#self.global_flags_m.append("-fmodules")
|
||||||
|
|
||||||
def get_staging_folder(self, binaryName):
|
def get_staging_folder(self, binaryName):
|
||||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ class Target(target.Target):
|
|||||||
# 32 bits
|
# 32 bits
|
||||||
if host.BUS_SIZE != 32:
|
if host.BUS_SIZE != 32:
|
||||||
self.global_flags_cc.append("-m32")
|
self.global_flags_cc.append("-m32")
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||||
|
|
||||||
def generate_list_separate_coma(self, list):
|
def generate_list_separate_coma(self, list):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -38,6 +38,8 @@ class Target(target.Target):
|
|||||||
self.suffix_binary=''
|
self.suffix_binary=''
|
||||||
self.suffix_package=''
|
self.suffix_package=''
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||||
|
|
||||||
|
|
||||||
def get_staging_folder(self, binaryName):
|
def get_staging_folder(self, binaryName):
|
||||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
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_lib_dynamic='.dll'
|
||||||
self.suffix_binary='.exe'
|
self.suffix_binary='.exe'
|
||||||
self.suffix_package=''
|
self.suffix_package=''
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||||
|
|
||||||
|
|
||||||
def get_staging_folder_data(self, binaryName):
|
def get_staging_folder_data(self, binaryName):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user