[DEV] add getter version of gcc
This commit is contained in:
parent
95b2206da6
commit
91b0cecc28
@ -112,7 +112,7 @@ class Module:
|
|||||||
"-Wall",
|
"-Wall",
|
||||||
"-Wsign-compare",
|
"-Wsign-compare",
|
||||||
"-Wreturn-type",
|
"-Wreturn-type",
|
||||||
"-Wint-to-pointer-cast",
|
#"-Wint-to-pointer-cast",
|
||||||
"-Wno-write-strings",
|
"-Wno-write-strings",
|
||||||
"-Woverloaded-virtual",
|
"-Woverloaded-virtual",
|
||||||
"-Wnon-virtual-dtor",
|
"-Wnon-virtual-dtor",
|
||||||
|
@ -49,6 +49,28 @@ def store_command(cmdLine, file):
|
|||||||
file2.flush()
|
file2.flush()
|
||||||
file2.close()
|
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=""):
|
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||||
global errorOccured
|
global errorOccured
|
||||||
@ -62,10 +84,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 ...")
|
||||||
debug.verbose("done 1")
|
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
debug.verbose("done 2")
|
|
||||||
# Check error :
|
# Check error :
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
debug.debug(lutinEnv.print_pretty(cmdLine))
|
debug.debug(lutinEnv.print_pretty(cmdLine))
|
||||||
|
@ -19,6 +19,7 @@ import lutinModule
|
|||||||
import lutinSystem
|
import lutinSystem
|
||||||
import lutinImage
|
import lutinImage
|
||||||
import lutinHost
|
import lutinHost
|
||||||
|
import lutinMultiprocess as multiprocess
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
def __init__(self, name, config, arch):
|
def __init__(self, name, config, arch):
|
||||||
@ -60,8 +61,13 @@ class Target:
|
|||||||
'-D_REENTRANT']
|
'-D_REENTRANT']
|
||||||
|
|
||||||
if self.name != "Windows":
|
if self.name != "Windows":
|
||||||
self.global_flags_xx=['-std=c++11']
|
if self.config["compilator"] == "clang" \
|
||||||
self.global_flags_mm=['-std=c++11']
|
or self.xx_version > 4007000:
|
||||||
|
self.global_flags_xx=['-std=c++11']
|
||||||
|
self.global_flags_mm=['-std=c++11']
|
||||||
|
else:
|
||||||
|
self.global_flags_xx=['-std=c++0x']
|
||||||
|
self.global_flags_mm=['-std=c++0x']
|
||||||
else:
|
else:
|
||||||
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-std=c++11']
|
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-std=c++11']
|
||||||
self.global_flags_mm=[]
|
self.global_flags_mm=[]
|
||||||
@ -118,6 +124,16 @@ class Target:
|
|||||||
self.folder_staging="/staging/" + self.config["compilator"]
|
self.folder_staging="/staging/" + self.config["compilator"]
|
||||||
self.folder_build="/build/" + 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=""):
|
def set_cross_base(self, cross=""):
|
||||||
self.cross = cross
|
self.cross = cross
|
||||||
debug.debug("== Target='" + self.cross + "'");
|
debug.debug("== Target='" + self.cross + "'");
|
||||||
@ -133,6 +149,14 @@ class Target:
|
|||||||
self.xx = self.cross + "g++"
|
self.xx = self.cross + "g++"
|
||||||
#self.ar=self.cross + "ar"
|
#self.ar=self.cross + "ar"
|
||||||
#self.ranlib=self.cross + "ranlib"
|
#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.ld = self.cross + "ld"
|
||||||
self.nm = self.cross + "nm"
|
self.nm = self.cross + "nm"
|
||||||
self.strip = self.cross + "strip"
|
self.strip = self.cross + "strip"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user