diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-21 11:06:17 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-21 11:06:17 +0200 |
commit | 445fd7c1968112664b1fbbe6215ed76609cfb8ac (patch) | |
tree | c46fbb8eb191945dc9ff5da48d9288fe0b206436 /src | |
parent | 0941a99aa4ac45ebe4bea4705e4cd24aec156bf5 (diff) |
Add lang.cpp.enable_exceptions option to enable/disable options, add c20, add c++03, c++98 and c++20
Diffstat (limited to 'src')
-rw-r--r-- | src/Conf.cpp | 40 | ||||
-rw-r--r-- | src/main.cpp | 6 |
2 files changed, 43 insertions, 3 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp index 543c8d9..c2302e4 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -1125,9 +1125,13 @@ namespace sibs { cVersion = CVersion::C11; } + else if(cVersionStr.equals("c20")) + { + cVersion = CVersion::C20; + } else { - string errMsg = "Expected lang.c.version to be ansi, c89, c99 or c11, was "; + string errMsg = "Expected lang.c.version to be ansi, c89, c99, c11, c20, was "; errMsg += string(cVersionStr.data, cVersionStr.size); throw ParserException(errMsg); } @@ -1147,7 +1151,15 @@ namespace sibs if(fieldValue.isSingle()) { const StringView &cppVersionStr = fieldValue.asSingle(); - if(cppVersionStr.equals("c++11")) + if(cppVersionStr.equals("c++03")) + { + cppVersion = CPPVersion::CPP03; + } + else if(cppVersionStr.equals("c++98")) + { + cppVersion = CPPVersion::CPP98; + } + else if(cppVersionStr.equals("c++11")) { cppVersion = CPPVersion::CPP11; } @@ -1159,9 +1171,13 @@ namespace sibs { cppVersion = CPPVersion::CPP17; } + else if(cppVersionStr.equals("c++20")) + { + cppVersion = CPPVersion::CPP20; + } else { - string errMsg = "Expected lang.cpp.version to be c++11, c++14 or c++17, was "; + string errMsg = "Expected lang.cpp.version to be c++03, c++98, c++11, c++14, c++17 or c++20, was "; errMsg += string(cppVersionStr.data, cppVersionStr.size); throw ParserException(errMsg); } @@ -1169,6 +1185,24 @@ namespace sibs else throw ParserException("Expected lang.cpp.version to be a single value, was a list"); } + else if(fieldName.equals("enable_exceptions")) + { + if (fieldValue.isSingle()) + { + StringView value_str = fieldValue.asSingle(); + bool value_bool = false; + if(value_str.equals("true")) + value_bool = true; + else if(value_str.equals("false")) + value_bool = false; + else + throw ParserException("Expected " + string(currentObject.data, currentObject.size) + ".enable_exceptions to be either true or false"); + + enableExceptions = value_bool; + } + else + throw ParserException("Expected " + string(currentObject.data, currentObject.size) + ".enable_exceptions to be a single value, was a list"); + } else failInvalidFieldUnderObject(fieldName); } diff --git a/src/main.cpp b/src/main.cpp index 5c3ad8c..00b7e92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -368,6 +368,12 @@ static int buildProject(const FileString &projectPath, const FileString &project { FileString buildPath; readSibsConfig(projectPath, projectConfFilePath, sibsConfig, buildPath); + + if(run && sibsConfig.getPackageType() != PackageType::EXECUTABLE) { + ferr << "Error: sibs run can only be used with executable projects" << endl; + exit(7); + } + // Test project has the main project as dependency, and therefore the main project can't be built as an executable if(sibsConfig.shouldBuildTests()) { |