[DEV] add dependency of Gcc version

This commit is contained in:
Edouard DUPIN 2015-02-25 22:05:00 +01:00
parent ffeb404d52
commit 4b3072ddf2
3 changed files with 47 additions and 13 deletions

View File

@ -31,6 +31,7 @@ class HeritageList:
self.flags_xx=[] self.flags_xx=[]
self.flags_m=[] self.flags_m=[]
self.flags_mm=[] self.flags_mm=[]
self.flags_xx_version=1999
# sources list: # sources list:
self.src=[] self.src=[]
self.path=[] self.path=[]
@ -64,6 +65,7 @@ class HeritageList:
self.flags_ld=[] self.flags_ld=[]
self.flags_cc=[] self.flags_cc=[]
self.flags_xx=[] self.flags_xx=[]
self.flags_xx_version=1999
self.flags_m=[] self.flags_m=[]
self.flags_mm=[] self.flags_mm=[]
# sources list: # sources list:
@ -105,7 +107,8 @@ class HeritageList:
append_to_list(self.flags_mm, element.flags_mm) append_to_list(self.flags_mm, element.flags_mm)
append_to_list(self.path, element.path) append_to_list(self.path, element.path)
append_to_list(self.src, element.src) append_to_list(self.src, element.src)
if self.flags_xx_version < element.flags_xx_version:
self.flags_xx_version = element.flags_xx_version
class heritage: class heritage:
@ -117,6 +120,7 @@ class heritage:
self.flags_ld=[] self.flags_ld=[]
self.flags_cc=[] self.flags_cc=[]
self.flags_xx=[] self.flags_xx=[]
self.flags_xx_version=1999
self.flags_m=[] self.flags_m=[]
self.flags_mm=[] self.flags_mm=[]
# sources list: # sources list:
@ -135,6 +139,7 @@ class heritage:
self.flags_m = module.export_flags_m self.flags_m = module.export_flags_m
self.flags_mm = module.export_flags_mm self.flags_mm = module.export_flags_mm
self.path = module.export_path self.path = module.export_path
self.flags_xx_version = module.xx_version_api
def add_depends(self, depend): def add_depends(self, depend):
self.depends.append(depend) self.depends.append(depend)
@ -176,3 +181,7 @@ class heritage:
self.add_flag_MM(other.flags_mm) self.add_flag_MM(other.flags_mm)
self.add_import_path(other.path) self.add_import_path(other.path)
self.add_sources(other.src) self.add_sources(other.src)
if self.flags_xx_version < module.xx_version_api:
self.flags_xx_version = module.xx_version_api

View File

@ -70,6 +70,9 @@ class Module:
self.files = [] self.files = []
self.folders = [] self.folders = []
self.isbuild = False self.isbuild = False
# CPP version:
self.xx_version = 1999
self.xx_version_api = 1999
## end of basic INIT ... ## end of basic INIT ...
if moduleType == 'BINARY' \ if moduleType == 'BINARY' \
or moduleType == 'LIBRARY' \ or moduleType == 'LIBRARY' \
@ -137,6 +140,17 @@ class Module:
## ##
def compile_mm_to_o(self, file, binary, target, depancy): 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) 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: # create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([ cmdLine=lutinTools.list_to_str([
target.xx, target.xx,
@ -147,6 +161,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path), lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path), lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path), lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc, target.global_flags_cc,
target.global_flags_mm, target.global_flags_mm,
depancy.flags_cc, depancy.flags_cc,
@ -207,6 +222,17 @@ class Module:
## ##
def compile_xx_to_o(self, file, binary, target, depancy): 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) 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: # create the command line befor requesting start:
cmdLine=lutinTools.list_to_str([ cmdLine=lutinTools.list_to_str([
target.xx, target.xx,
@ -217,6 +243,7 @@ class Module:
lutinTools.add_prefix("-I",self.export_path), lutinTools.add_prefix("-I",self.export_path),
lutinTools.add_prefix("-I",self.local_path), lutinTools.add_prefix("-I",self.local_path),
lutinTools.add_prefix("-I",depancy.path), lutinTools.add_prefix("-I",depancy.path),
local_xx_version_flags,
target.global_flags_cc, target.global_flags_cc,
target.global_flags_xx, target.global_flags_xx,
depancy.flags_cc, depancy.flags_cc,
@ -627,6 +654,14 @@ class Module:
def compile_flags_S(self, list): def compile_flags_S(self, list):
self.append_to_internalList(self.flags_s, 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 add_src_file(self, list): def add_src_file(self, list):
self.append_to_internalList(self.src, list, True) self.append_to_internalList(self.src, list, True)

View File

@ -62,18 +62,8 @@ class Target:
self.global_flags_xx=[] self.global_flags_xx=[]
self.global_flags_mm=[] self.global_flags_mm=[]
if self.name != "Windows": if self.name == "Windows":
if self.config["compilator"] == "clang" \ self.global_flags_xx=['-static-libgcc', '-static-libstdc++']
or self.xx_version > 4007000:
#self.global_flags_xx=['-std=c++11']
#self.global_flags_mm=['-std=c++11']
pass
else:
#self.global_flags_xx=['-std=c++0x']
#self.global_flags_mm=['-std=c++0x']
pass
else:
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-std=c++11']
self.global_flags_mm=[] self.global_flags_mm=[]
self.global_flags_m=[] self.global_flags_m=[]
self.global_flags_ar=['rcs'] self.global_flags_ar=['rcs']