diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-22 17:39:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:32 +0200 |
commit | 0d0fa21e695f3082576053bf0c9b71a3bcc154a4 (patch) | |
tree | ca23f9f6f88e167ecf3be8feaa4d0fb4d5f0b51a /src | |
parent | 4614d45075684d463c8aa302c594e8496120a7ed (diff) |
Fix for windows
Diffstat (limited to 'src')
-rw-r--r-- | src/CmakeModule.cpp | 4 | ||||
-rw-r--r-- | src/Conf.cpp | 10 | ||||
-rw-r--r-- | src/FileUtil.cpp | 3 | ||||
-rw-r--r-- | src/GlobalLib.cpp | 8 | ||||
-rw-r--r-- | src/Package.cpp | 4 |
5 files changed, 19 insertions, 10 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index 7f517e3..15597cb 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -6,7 +6,7 @@ #if OS_FAMILY == OS_FAMILY_POSIX #define nprintf printf #else -#define nprintf wprintf +#define nprintf(fmt, ...) wprintf(TINYDIR_STRING(fmt), __VA_ARGS__) #endif using namespace std; @@ -104,7 +104,7 @@ namespace sibs dynamicLinkerFlagCallbackFunc(pkgConfigLinkerFlagsResult.unwrap()); } #else - for (const Dependency &dependency : dependencies) + for (PackageListDependency *dependency : config.getPackageListDependencies()) { globalLibDependencies.push_back(dependency); } diff --git a/src/Conf.cpp b/src/Conf.cpp index 941bdd7..883022b 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -1210,7 +1210,7 @@ namespace sibs failInvalidFieldUnderObject(fieldName); } - void SibsConfig::parseCmake(const StringView &fieldName, const ConfigValue &fieldValue, string &cmakeDir, string &cmakeArgs) + void SibsConfig::parseCmake(const StringView &fieldName, const ConfigValue &fieldValue, FileString &cmakeDir, FileString &cmakeArgs) { if(fieldName.equals("dir")) { @@ -1240,10 +1240,10 @@ namespace sibs bool prependSpace = !cmakeArgs.empty(); cmakeArgs.reserve(cmakeArgs.size() + 4 + (prependSpace ? 1 : 0) + arg.size); if(prependSpace) - cmakeArgs += " "; - cmakeArgs += "\"-D"; - cmakeArgs.append(arg.data, arg.size); - cmakeArgs += "\""; + cmakeArgs += TINYDIR_STRING(" "); + cmakeArgs += TINYDIR_STRING("\"-D"); + cmakeArgs += toFileString(string(arg.data, arg.size)); + cmakeArgs += TINYDIR_STRING("\""); } } else diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index 5ac2641..53c1132 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -11,6 +11,7 @@ // Copied from linux libc sys/stat.h: #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#pragma comment(lib, "Userenv.lib") #endif using namespace std; @@ -128,7 +129,7 @@ namespace sibs { struct _stat64i32 fileStat; if (_wstat(path, &fileStat) == 0) - rreturn Result<u64>::Ok(fileStat.st_mtim.tv_sec); + return Result<u64>::Ok(fileStat.st_mtime); else { string errMsg = "File not found: "; diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp index c577a4a..9921c1b 100644 --- a/src/GlobalLib.cpp +++ b/src/GlobalLib.cpp @@ -166,8 +166,8 @@ namespace sibs FileString namePlatformNative = gitDependency->name; FileString versionPlatformNative = gitDependency->revision; #else - FileString namePlatformNative = utf8To16(name); - FileString versionPlatformNative = utf8To16(version); + FileString namePlatformNative = utf8To16(gitDependency->name); + FileString versionPlatformNative = utf8To16(gitDependency->revision); #endif FileString packageDir = globalLibRootDir + TINYDIR_STRING("/"); @@ -307,7 +307,11 @@ namespace sibs Result<bool> archiveExtractResult = Archive::extract(libArchivedFilePath.c_str(), libPath.c_str()); // We have extracted the archive, we dont need to cache it. If remove fails, it doesn't really matter, user can remove it himself +#if OS_FAMILY == OS_FAMILY_POSIX remove(libArchivedFilePath.c_str()); +#else + _wremove(libArchivedFilePath.c_str()); +#endif return archiveExtractResult; } diff --git a/src/Package.cpp b/src/Package.cpp index 1fa5485..d59c6a9 100644 --- a/src/Package.cpp +++ b/src/Package.cpp @@ -2,6 +2,10 @@ #include "../include/curl.hpp" #include "../external/rapidjson/error/en.h" +#ifdef GetObject +#undef GetObject +#endif + using namespace std; using namespace rapidjson; |