aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-31 05:24:40 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-31 05:26:07 +0100
commit017ec45e94204f977dcd7b04c8035d48f230ded3 (patch)
tree7778ecc069f05fb527329f36876ed13a17a48ab3 /src/main.cpp
parent7a5910121ab0ad2ea8a4a60e5b6599b7255e5a5e (diff)
Sibs can now build itself on windows
Fixed several bugs. The windows implementation IS QUICK AND DIRTY! It links things as static even if you wish to link as dynamic etc..... NEED TO FIX THIS !!!
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 855b1dc..1c2492c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -208,17 +208,32 @@ int buildProject(int argc, const _tinydir_char_t **argv)
exit(10);
}
+ if (!containsPlatform(sibsConfig.getPlatforms(), SYSTEM_PLATFORM))
+ {
+ string errMsg = "The project ";
+ errMsg += sibsConfig.getPackageName();
+ errMsg += " does not support your platform (";
+ errMsg += asString(SYSTEM_PLATFORM);
+ errMsg += ")";
+ cerr << errMsg << endl;
+ exit(11);
+ }
+
//string projectSrcPath = projectPath + "/src";
//validateDirectoryPath(projectSrcPath.c_str());
backend::Ninja ninja;
FileWalkCallbackFunc collectSourceFiles = [&ninja, &sibsConfig, &collectSourceFiles](tinydir_file *file)
{
+ FileString pathNative = file->path;
+#if OS_FAMILY == OS_FAMILY_WINDOWS
+ replaceChar(pathNative, L'/', L'\\');
+#endif
if(file->is_reg)
{
if (isSourceFile(file))
{
- string filePathUtf8 = toUtf8(file->path + sibsConfig.getProjectPath().size());
+ string filePathUtf8 = toUtf8(pathNative.c_str() + sibsConfig.getProjectPath().size());
ninja.addSourceFile(filePathUtf8.c_str());
}
else
@@ -229,9 +244,9 @@ int buildProject(int argc, const _tinydir_char_t **argv)
else
{
// TODO: If compiling without "test" option, do not add test source dir to ninja. Ninja logic will then not build tests
- if (!sibsConfig.getTestPath().empty() && isPathSubPathOf(file->path, sibsConfig.getTestPath()))
+ if (!sibsConfig.getTestPath().empty() && isPathSubPathOf(pathNative.c_str(), sibsConfig.getTestPath()))
{
- string filePathUtf8 = toUtf8(file->path);
+ string filePathUtf8 = toUtf8(pathNative.c_str());
ninja.addTestSourceDir(filePathUtf8.c_str());
}
else