From 017ec45e94204f977dcd7b04c8035d48f230ded3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 31 Dec 2017 05:24:40 +0100 Subject: 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 !!! --- src/main.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') 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 -- cgit v1.2.3