aboutsummaryrefslogtreecommitdiff
path: root/src/Conf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Conf.cpp')
-rw-r--r--src/Conf.cpp122
1 files changed, 60 insertions, 62 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp
index 40ff018..8dc4e7c 100644
--- a/src/Conf.cpp
+++ b/src/Conf.cpp
@@ -766,6 +766,7 @@ namespace sibs
{
includeDirs.emplace_back(string(includeDir.data, includeDir.size));
}
+ fprintf(stderr, "Warning: package.include_dirs is deprecated, please move include_dirs under config\n");
}
else
throw ParserException("Expected package.include_dirs to be a list, was a single value");
@@ -828,6 +829,7 @@ namespace sibs
ignoreDirFull += string(ignoreDir.data, ignoreDir.size);
ignoreDirs.emplace_back(ignoreDirFull);
}
+ fprintf(stderr, "Warning: package.ignore_dirs is deprecated, please move ignore_dirs under config\n");
}
else
throw ParserException("Expected package.ignore_dirs to be a list, was a single value");
@@ -837,9 +839,10 @@ namespace sibs
}
else if(currentObject.size >= 6 && strncmp(currentObject.data, "config", 6) == 0)
{
- if(currentObject.size == 6) // [config]
+ bool platformConfig = currentObject.equals(CONFIGS[CONFIG_SYSTEM_PLATFORM]);
+ if(currentObject.size == 6 || platformConfig) // [config]
{
- if (name.equals("expose_include_dirs"))
+ if(name.equals("expose_include_dirs"))
{
if (value.isList())
{
@@ -856,13 +859,39 @@ namespace sibs
throw ParserException(errMsg);
}
}
+ else if(name.equals("include_dirs"))
+ {
+ if(value.isList())
+ {
+ for(const StringView &includeDir : value.asList())
+ {
+ includeDirs.emplace_back(string(includeDir.data, includeDir.size));
+ }
+ }
+ else
+ throw ParserException("Expected " + string(currentObject.data, currentObject.size) + ".include_dirs to be a list, was a single value");
+ }
+ else if(name.equals("ignore_dirs"))
+ {
+ if (value.isList())
+ {
+ string projectPathUtf8 = toUtf8(projectPath);
+ for (const StringView &ignoreDir : value.asList())
+ {
+ string ignoreDirFull = projectPathUtf8;
+ ignoreDirFull += "/";
+ ignoreDirFull += string(ignoreDir.data, ignoreDir.size);
+ ignoreDirs.emplace_back(move(ignoreDirFull));
+ }
+ }
+ else
+ throw ParserException("Expected " + string(currentObject.data, currentObject.size) + ".ignore_dirs to be a list, was a single value");
+ }
else
failInvalidFieldUnderObject(name);
}
- else // [config.*]
- {
- parsePlatformConfigs(name, value);
- }
+ else
+ parsePlatformBuildTypeConfigs(name, value);
}
else if(currentObject.equals("dependencies"))
{
@@ -1119,66 +1148,48 @@ namespace sibs
failInvalidFieldUnderObject(fieldName);
}
- void SibsConfig::parsePlatformConfigs(const StringView &fieldName, const ConfigValue &fieldValue)
+ void SibsConfig::parsePlatformBuildTypeConfigs(const StringView &fieldName, const ConfigValue &fieldValue)
{
+ bool validConfig = false;
for(int i = 0; i < NUM_CONFIGS; ++i)
{
const StringView &config = CONFIGS[i];
if(currentObject.equals(config))
{
+ validConfig = true;
switch(i)
{
- case CONFIG_SYSTEM_PLATFORM:
- return parsePlatformConfig(fieldName, fieldValue);
case CONFIG_STATIC_DEBUG_PLATFORM:
- return parsePlatformConfigStaticDebug(fieldName, fieldValue);
+ parsePlatformConfigStaticDebug(fieldName, fieldValue);
+ break;
case CONFIG_STATIC_RELEASE_PLATFORM:
- return parsePlatformConfigStaticRelease(fieldName, fieldValue);
+ parsePlatformConfigStaticRelease(fieldName, fieldValue);
+ break;
default:
- return;
+ break;
}
}
}
- string errMsg = "Invalid config object \"";
- errMsg += string(currentObject.data, currentObject.size);
- errMsg += "\"";
- throw ParserException(errMsg);
- }
-
- void SibsConfig::parsePlatformConfig(const StringView &fieldName, const ConfigValue &fieldValue)
- {
- if (fieldName.equals("expose_include_dirs"))
+ if(!validConfig)
{
- if (fieldValue.isList())
- {
- for (const StringView &includeDir : fieldValue.asList())
- {
- exposeIncludeDirs.emplace_back(string(includeDir.data, includeDir.size));
- }
- }
- else
- {
- string errMsg = "Expected ";
- errMsg += string(currentObject.data, currentObject.size);
- errMsg += " to be a list, was a single value";
- throw ParserException(errMsg);
- }
+ string errMsg = "Invalid config object \"";
+ errMsg += string(currentObject.data, currentObject.size);
+ errMsg += "\"";
+ throw ParserException(errMsg);
}
- else
- failInvalidFieldUnderObject(fieldName);
}
-
- void SibsConfig::parsePlatformConfigStaticDebug(const StringView &fieldName, const ConfigValue &fieldValue)
+
+ string SibsConfig::parsePlatformConfigStatic(const StringView &fieldName, const ConfigValue &fieldValue)
{
if (fieldName.equals("lib"))
{
if (fieldValue.isSingle())
{
- string debugStaticLibPath = toUtf8(projectPath);
- debugStaticLibPath += "/";
- debugStaticLibPath += string(fieldValue.asSingle().data, fieldValue.asSingle().size);
- getLibFiles(debugStaticLibPath, debugStaticLibs);
+ string staticLibPath = toUtf8(projectPath);
+ staticLibPath += "/";
+ staticLibPath += string(fieldValue.asSingle().data, fieldValue.asSingle().size);
+ return staticLibPath;
}
else
{
@@ -1192,27 +1203,14 @@ namespace sibs
failInvalidFieldUnderObject(fieldName);
}
+ void SibsConfig::parsePlatformConfigStaticDebug(const StringView &fieldName, const ConfigValue &fieldValue)
+ {
+ getLibFiles(parsePlatformConfigStatic(fieldName, fieldValue), debugStaticLibs);
+ }
+
void SibsConfig::parsePlatformConfigStaticRelease(const StringView &fieldName, const ConfigValue &fieldValue)
{
- if (fieldName.equals("lib"))
- {
- if (fieldValue.isSingle())
- {
- string releaseStaticLibPath = toUtf8(projectPath);
- releaseStaticLibPath += "/";
- releaseStaticLibPath += string(fieldValue.asSingle().data, fieldValue.asSingle().size);
- getLibFiles(releaseStaticLibPath, releaseStaticLibs);
- }
- else
- {
- string errMsg = "Expected ";
- errMsg += string(currentObject.data, currentObject.size);
- errMsg += " to be a single value, was a list";
- throw ParserException(errMsg);
- }
- }
- else
- failInvalidFieldUnderObject(fieldName);
+ getLibFiles(parsePlatformConfigStatic(fieldName, fieldValue), releaseStaticLibs);
}
void SibsConfig::parseCmake(const StringView &fieldName, const ConfigValue &fieldValue, FileString &cmakeDir, FileString &cmakeArgs)