Add C++20 cppdialect for C++ projects
This commit is contained in:
parent
5bb0bef41c
commit
4a627cc764
@ -464,6 +464,8 @@
|
||||
["C++14"] = "c++14",
|
||||
["C++1z"] = "c++17",
|
||||
["C++17"] = "c++17",
|
||||
["C++2a"] = "c++20",
|
||||
["C++20"] = "c++20",
|
||||
["gnu++98"] = "c++98",
|
||||
["gnu++0x"] = "c++11",
|
||||
["gnu++11"] = "c++11",
|
||||
@ -471,6 +473,7 @@
|
||||
["gnu++14"] = "c++14",
|
||||
["gnu++1z"] = "c++17",
|
||||
["gnu++17"] = "c++17",
|
||||
["gnu++2a"] = "c++20",
|
||||
}
|
||||
if cppMap[cfg.cppdialect] ~= nil then
|
||||
table.insert(opts, "-extern-std=" .. cppMap[cfg.cppdialect])
|
||||
|
@ -263,6 +263,8 @@
|
||||
["C++14"] = "-extern-std=c++14",
|
||||
["C++1z"] = "-extern-std=c++17",
|
||||
["C++17"] = "-extern-std=c++17",
|
||||
["C++2a"] = "-extern-std=c++20",
|
||||
["C++20"] = "-extern-std=c++20",
|
||||
["gnu++98"] = "-extern-std=c++98",
|
||||
["gnu++0x"] = "-extern-std=c++11",
|
||||
["gnu++11"] = "-extern-std=c++11",
|
||||
@ -270,6 +272,7 @@
|
||||
["gnu++14"] = "-extern-std=c++14",
|
||||
["gnu++1z"] = "-extern-std=c++17",
|
||||
["gnu++17"] = "-extern-std=c++17",
|
||||
["gnu++2a"] = "-extern-std=c++20",
|
||||
},
|
||||
deprecatedfeatures = {
|
||||
Allow = "-d",
|
||||
|
@ -76,6 +76,8 @@
|
||||
["C++14"] = "-extern-std=c++14",
|
||||
["C++1z"] = "-extern-std=c++17",
|
||||
["C++17"] = "-extern-std=c++17",
|
||||
["C++2a"] = "-extern-std=c++20",
|
||||
["C++20"] = "-extern-std=c++20",
|
||||
["gnu++98"] = "-extern-std=c++98",
|
||||
["gnu++0x"] = "-extern-std=c++11",
|
||||
["gnu++11"] = "-extern-std=c++11",
|
||||
@ -83,6 +85,7 @@
|
||||
["gnu++14"] = "-extern-std=c++14",
|
||||
["gnu++1z"] = "-extern-std=c++17",
|
||||
["gnu++17"] = "-extern-std=c++17",
|
||||
["gnu++2a"] = "-extern-std=c++20",
|
||||
},
|
||||
deprecatedfeatures = {
|
||||
Allow = "-d",
|
||||
|
@ -1170,7 +1170,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
@ -1205,6 +1205,21 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_Cpp20_VS2019()
|
||||
p.action.set("vs2019")
|
||||
|
||||
cppdialect 'C++20'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_CppLatest_VS2010()
|
||||
cppdialect 'C++latest'
|
||||
prepare()
|
||||
|
@ -1466,6 +1466,8 @@
|
||||
m.element("LanguageStandard", nil, 'stdcpp14')
|
||||
elseif (cfg.cppdialect == "C++17") then
|
||||
m.element("LanguageStandard", nil, 'stdcpp17')
|
||||
elseif (cfg.cppdialect == "C++20") then
|
||||
m.element("LanguageStandard", nil, 'stdcpplatest')
|
||||
elseif (cfg.cppdialect == "C++latest") then
|
||||
m.element("LanguageStandard", nil, 'stdcpplatest')
|
||||
end
|
||||
@ -1493,6 +1495,8 @@
|
||||
if (cfg.cppdialect == "C++14") then
|
||||
table.insert(opts, "/std:c++14")
|
||||
elseif (cfg.cppdialect == "C++17") then
|
||||
table.insert(opts, "/std:c++17")
|
||||
elseif (cfg.cppdialect == "C++20") then
|
||||
table.insert(opts, "/std:c++latest")
|
||||
elseif (cfg.cppdialect == "C++latest") then
|
||||
table.insert(opts, "/std:c++latest")
|
||||
|
@ -3255,6 +3255,32 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnCpp20()
|
||||
workspace("MyWorkspace")
|
||||
cppdialect("C++20")
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
A14350AC4595EE5E57CE36EC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++2a";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnCppGnu98()
|
||||
workspace("MyWorkspace")
|
||||
cppdialect("gnu++98")
|
||||
@ -3359,6 +3385,32 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnCppGnu20()
|
||||
workspace("MyWorkspace")
|
||||
cppdialect("gnu++20")
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
|
||||
test.capture [[
|
||||
A14350AC4595EE5E57CE36EC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++2a";
|
||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
OBJROOT = obj/Debug;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
SYMROOT = bin/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnUnsignedCharOn()
|
||||
workspace("MyWorkspace")
|
||||
unsignedchar "On"
|
||||
|
@ -1271,10 +1271,12 @@
|
||||
["C++11"] = "c++11",
|
||||
["C++14"] = "c++14",
|
||||
["C++17"] = "c++1z",
|
||||
["C++20"] = "c++2a",
|
||||
["gnu++98"] = "gnu++98",
|
||||
["gnu++11"] = "gnu++0x", -- Xcode project GUI uses gnu++0x, but gnu++11 also works
|
||||
["gnu++14"] = "gnu++14",
|
||||
["gnu++17"] = "gnu++1z"
|
||||
["gnu++17"] = "gnu++1z",
|
||||
["gnu++20"] = "gnu++2a",
|
||||
}
|
||||
|
||||
function xcode.XCBuildConfiguration_CppLanguageStandard(settings, cfg)
|
||||
|
@ -768,6 +768,8 @@
|
||||
"C++14",
|
||||
"C++1z",
|
||||
"C++17",
|
||||
"C++2a",
|
||||
"C++20",
|
||||
"gnu++98",
|
||||
"gnu++0x",
|
||||
"gnu++11",
|
||||
@ -775,6 +777,8 @@
|
||||
"gnu++14",
|
||||
"gnu++1z",
|
||||
"gnu++17",
|
||||
"gnu++2a",
|
||||
"gnu++20",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,8 @@
|
||||
["C++14"] = "-std=c++14",
|
||||
["C++1z"] = "-std=c++1z",
|
||||
["C++17"] = "-std=c++17",
|
||||
["C++2a"] = "-std=c++2a",
|
||||
["C++20"] = "-std=c++20",
|
||||
["gnu++98"] = "-std=gnu++98",
|
||||
["gnu++0x"] = "-std=gnu++0x",
|
||||
["gnu++11"] = "-std=gnu++11",
|
||||
@ -190,6 +192,7 @@
|
||||
["gnu++14"] = "-std=gnu++14",
|
||||
["gnu++1z"] = "-std=gnu++1z",
|
||||
["gnu++17"] = "-std=gnu++17",
|
||||
["gnu++2a"] = "-std=gnu++2a",
|
||||
},
|
||||
rtti = {
|
||||
Off = "-fno-rtti"
|
||||
|
@ -786,6 +786,20 @@
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onCpp2a()
|
||||
cppdialect "C++2a"
|
||||
prepare()
|
||||
test.contains({ "-std=c++2a" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onCpp20()
|
||||
cppdialect "C++20"
|
||||
prepare()
|
||||
test.contains({ "-std=c++20" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onCppGnu98()
|
||||
cppdialect "gnu++98"
|
||||
prepare()
|
||||
@ -814,6 +828,13 @@
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
function suite.cxxflags_onCppGnu2a()
|
||||
cppdialect "gnu++2a"
|
||||
prepare()
|
||||
test.contains({ "-std=gnu++2a" }, gcc.getcxxflags(cfg))
|
||||
test.contains({ }, gcc.getcflags(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Test unsigned-char flags.
|
||||
--
|
||||
|
Reference in New Issue
Block a user