feat(translation,ide): add native C driver, Ninja custom commands, CMake CXX_MODULES, and vbs ide integration
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
This commit is contained in:
1 parent
5e1916dc5c
commit
6c225c2dff
27 files changed
+3443
-331
No files matched your search
@@ -266,6 +266,36 @@ SourceKind parse_source_kind(std::string_view name) {
|
||||
throw std::invalid_argument{"unknown source kind '" + std::string{name} + "'"};
|
||||
}
|
||||
|
||||
std::string_view c_standard_name(CStandard standard) {
|
||||
switch (standard) {
|
||||
case CStandard::Default:
|
||||
return "default";
|
||||
case CStandard::C11:
|
||||
return "c11";
|
||||
case CStandard::C17:
|
||||
return "c17";
|
||||
case CStandard::C23:
|
||||
return "c23";
|
||||
}
|
||||
throw std::invalid_argument{"unknown C standard"};
|
||||
}
|
||||
|
||||
CStandard parse_c_standard(std::string_view name) {
|
||||
if (name.empty() || name == "default") {
|
||||
return CStandard::Default;
|
||||
}
|
||||
if (name == "c11" || name == "11") {
|
||||
return CStandard::C11;
|
||||
}
|
||||
if (name == "c17" || name == "17" || name == "c18") {
|
||||
return CStandard::C17;
|
||||
}
|
||||
if (name == "c23" || name == "23" || name == "c2x") {
|
||||
return CStandard::C23;
|
||||
}
|
||||
throw std::invalid_argument{"unknown C standard '" + std::string{name} + "'"};
|
||||
}
|
||||
|
||||
std::string_view cxx_standard_name(CxxStandard standard) {
|
||||
switch (standard) {
|
||||
case CxxStandard::Default:
|
||||
@@ -451,6 +481,9 @@ ProfileContext Profiles::resolve(std::string_view name,
|
||||
if (desc->compiler) {
|
||||
context.compiler = *desc->compiler;
|
||||
}
|
||||
if (desc->c_standard) {
|
||||
context.c_standard = *desc->c_standard;
|
||||
}
|
||||
if (desc->cxx_standard) {
|
||||
context.cxx_standard = *desc->cxx_standard;
|
||||
}
|
||||
@@ -499,6 +532,9 @@ std::string Profiles::to_json() const {
|
||||
if (p.compiler) {
|
||||
out += ",\"compiler\":" + json_quote(compiler_name(*p.compiler));
|
||||
}
|
||||
if (p.c_standard) {
|
||||
out += ",\"c_standard\":" + json_quote(c_standard_name(*p.c_standard));
|
||||
}
|
||||
if (p.cxx_standard) {
|
||||
out += ",\"cxx_standard\":" + json_quote(cxx_standard_name(*p.cxx_standard));
|
||||
}
|
||||
@@ -701,6 +737,12 @@ Target &Target::depends_on(const Target &producer) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Target &Target::c_standard(CStandard standard) {
|
||||
(void)c_standard_name(standard);
|
||||
owner(owner_)->targets.at(index_).c_standard = standard;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Target &Target::cxx_standard(CxxStandard standard) {
|
||||
(void)cxx_standard_name(standard);
|
||||
owner(owner_)->targets.at(index_).cxx_standard = standard;
|
||||
@@ -1065,6 +1107,7 @@ std::string Project::to_json() const {
|
||||
",\"compile_options\":" + json_array(profile.compile_options, json_quote) +
|
||||
",\"link_options\":" + json_array(profile.link_options, json_quote) +
|
||||
",\"defines\":" + json_array(profile.defines, json_quote) +
|
||||
",\"c_standard\":" + json_quote(c_standard_name(profile.c_standard)) +
|
||||
",\"cxx_standard\":" + json_quote(cxx_standard_name(profile.cxx_standard)) +
|
||||
",\"lto\":" + json_quote(lto_mode_name(profile.lto)) + ",\"sanitizers\":" +
|
||||
json_array(profile.sanitizers, [](Sanitizer s) { return json_quote(sanitizer_name(s)); }) +
|
||||
@@ -1104,6 +1147,7 @@ std::string Project::to_json() const {
|
||||
json_quote(visibility_name(link.visibility)) + '}';
|
||||
}) +
|
||||
",\"prerequisites\":" + json_array(target.prerequisites, json_quote) +
|
||||
",\"c_standard\":" + json_quote(c_standard_name(target.c_standard)) +
|
||||
",\"cxx_standard\":" + json_quote(cxx_standard_name(target.cxx_standard)) +
|
||||
",\"precompiled_header\":" + json_quote(target.precompiled_header) +
|
||||
",\"unity_enabled\":" + std::string{target.unity_enabled ? "true" : "false"} +
|
||||
|
||||
Reference in new issue
Block a user