[DEV] add C++20

This commit is contained in:
Edouard DUPIN 2018-08-16 23:10:54 +02:00
parent 66e98727b9
commit a7732fba54
3 changed files with 23 additions and 9 deletions

View File

@ -1094,7 +1094,7 @@ class Module:
def compile_version(self, compilator_type, version, same_as_api=True, gnu=False):
if compilator_type == "c++" \
or compilator_type == "C++":
cpp_version_list = [1999, 2003, 2011, 2014, 2017]
cpp_version_list = [1999, 2003, 2011, 2014, 2017, 2020]
if version not in cpp_version_list:
debug.error("[" + self._name + "] Can not select CPP version : " + str(version) + " not in " + str(cpp_version_list))
# select API version:
@ -1109,7 +1109,7 @@ class Module:
debug.debug("[" + self._name + "] Can not propagate the gnu extention of the CPP vesion for API");
elif compilator_type == "c" \
or compilator_type == "C":
c_version_list = [1989, 1990, 1999, 2011]
c_version_list = [1989, 1990, 1999, 2011, 2017, 1018]
if version not in c_version_list:
debug.error("[" + self._name + "] Can not select C version : " + str(version) + " not in " + str(c_version_list))
# select API version:

View File

@ -146,21 +146,31 @@ def get_version_compilation_flags(flags, dependency_flags):
is_gnu = default_version_gnu
version = max(version_local, dependency_version)
if version == 2011:
if version == 2018:
if is_gnu ==True:
out = ["-std=gnu18", "-D__C_VERSION__=2018"]
else:
out = ["-std=c18", "-D__C_VERSION__=2018"]
elif version == 2017:
if is_gnu ==True:
out = ["-std=gnu17", "-D__C_VERSION__=2017"]
else:
out = ["-std=c17", "-D__C_VERSION__=2017"]
elif version == 2011:
if is_gnu ==True:
out = ["-std=gnu11", "-D__C_VERSION__=2011"]
else:
out = ["-std=c11", "-D__C_VERSION__=1989"]
out = ["-std=c11", "-D__C_VERSION__=2011"]
elif version == 1999:
if is_gnu ==True:
out = ["-std=gnu99", "-D__C_VERSION__=1999"]
else:
out = ["-std=c99", "-D__C_VERSION__=1989"]
out = ["-std=c99", "-D__C_VERSION__=1999"]
elif version == 1990:
if is_gnu ==True:
out = ["-std=gnu90", "-D__C_VERSION__=1990"]
else:
out = ["-std=c90", "-D__C_VERSION__=1989"]
out = ["-std=c90", "-D__C_VERSION__=1990"]
else:
if is_gnu ==True:
out = ["-std=gnu89", "-D__C_VERSION__=1989"]

View File

@ -152,13 +152,17 @@ def get_version_compilation_flags(flags, dependency_flags):
is_gnu = default_version_gnu
version = max(version_local, dependency_version)
if version == 2017:
debug.error("not supported flags for X17 ...");
if version == 2020:
if is_gnu == True:
out = ["-std=gnu++2a", "-D__CPP_VERSION__=2020"]
else:
out = ["-std=c++2a", "-D__CPP_VERSION__=2020"]
elif version == 2017:
if is_gnu == True:
out = ["-std=gnu++17", "-D__CPP_VERSION__=2017"]
else:
out = ["-std=c++17", "-D__CPP_VERSION__=2017"]
if version == 2014:
elif version == 2014:
if is_gnu == True:
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
else: