diff --git a/lutinHeritage.py b/lutinHeritage.py index fc4a746..47b89f5 100644 --- a/lutinHeritage.py +++ b/lutinHeritage.py @@ -31,6 +31,7 @@ class HeritageList: self.flags_xx=[] self.flags_m=[] self.flags_mm=[] + self.flags_xx_version=1999 # sources list: self.src=[] self.path=[] @@ -64,6 +65,7 @@ class HeritageList: self.flags_ld=[] self.flags_cc=[] self.flags_xx=[] + self.flags_xx_version=1999 self.flags_m=[] self.flags_mm=[] # sources list: @@ -105,7 +107,8 @@ class HeritageList: append_to_list(self.flags_mm, element.flags_mm) append_to_list(self.path, element.path) 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: @@ -117,6 +120,7 @@ class heritage: self.flags_ld=[] self.flags_cc=[] self.flags_xx=[] + self.flags_xx_version=1999 self.flags_m=[] self.flags_mm=[] # sources list: @@ -135,6 +139,7 @@ class heritage: self.flags_m = module.export_flags_m self.flags_mm = module.export_flags_mm self.path = module.export_path + self.flags_xx_version = module.xx_version_api def add_depends(self, depend): self.depends.append(depend) @@ -176,3 +181,7 @@ class heritage: self.add_flag_MM(other.flags_mm) self.add_import_path(other.path) self.add_sources(other.src) + if self.flags_xx_version < module.xx_version_api: + self.flags_xx_version = module.xx_version_api + + diff --git a/lutinModule.py b/lutinModule.py index 8e08bbd..35bb596 100644 --- a/lutinModule.py +++ b/lutinModule.py @@ -70,6 +70,9 @@ class Module: self.files = [] self.folders = [] self.isbuild = False + # CPP version: + self.xx_version = 1999 + self.xx_version_api = 1999 ## end of basic INIT ... if moduleType == 'BINARY' \ or moduleType == 'LIBRARY' \ @@ -137,6 +140,17 @@ class Module: ## 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) + 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: cmdLine=lutinTools.list_to_str([ target.xx, @@ -147,6 +161,7 @@ class Module: lutinTools.add_prefix("-I",self.export_path), lutinTools.add_prefix("-I",self.local_path), lutinTools.add_prefix("-I",depancy.path), + local_xx_version_flags, target.global_flags_cc, target.global_flags_mm, depancy.flags_cc, @@ -207,6 +222,17 @@ class Module: ## 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) + 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: cmdLine=lutinTools.list_to_str([ target.xx, @@ -217,6 +243,7 @@ class Module: lutinTools.add_prefix("-I",self.export_path), lutinTools.add_prefix("-I",self.local_path), lutinTools.add_prefix("-I",depancy.path), + local_xx_version_flags, target.global_flags_cc, target.global_flags_xx, depancy.flags_cc, @@ -627,6 +654,14 @@ class Module: def compile_flags_S(self, 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): self.append_to_internalList(self.src, list, True) diff --git a/lutinTarget.py b/lutinTarget.py index 60d8922..304bba8 100644 --- a/lutinTarget.py +++ b/lutinTarget.py @@ -62,18 +62,8 @@ class Target: self.global_flags_xx=[] self.global_flags_mm=[] - if self.name != "Windows": - if self.config["compilator"] == "clang" \ - 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'] + if self.name == "Windows": + self.global_flags_xx=['-static-libgcc', '-static-libstdc++'] self.global_flags_mm=[] self.global_flags_m=[] self.global_flags_ar=['rcs']