aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-27 17:54:13 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit0f3b3c10d63140509ebcd466b281a78e7f745225 (patch)
tree3e01fbe0025a5a9d6900a969bb7d87516028fb4d
parent1c6ab0b07f18f2c6919ebb45c40da1e00b7ecf83 (diff)
Fix build for windows, release new windows build
-rw-r--r--backend/ninja/Ninja.cpp6
-rw-r--r--include/FileUtil.hpp2
-rw-r--r--msvc/sibs.exebin372224 -> 404480 bytes
-rw-r--r--src/FileUtil.cpp12
-rw-r--r--src/GlobalLib.cpp4
-rw-r--r--src/main.cpp8
6 files changed, 23 insertions, 9 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 2482e9d..e332bd7 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -680,7 +680,7 @@ namespace backend
if(it == filepath.rend())
return TINYDIR_STRING("");
else
- return filepath.substr(0, it.base().base() - &filepath[0]);
+ return filepath.substr(0, &*it.base() - &filepath[0]);
}
static string extractDynamicLibDirsFromLinkerFlag(const string &linkerFlag)
@@ -969,10 +969,10 @@ namespace backend
{
// TODO: Executable type does not guarantee the executable should be a console on windows. Find a way to define window type as well
case LibraryType::EXECUTABLE:
- defines.push_back(ninja::NinjaArg::createRaw(" _CONSOLE"));
+ defines.push_back(ninja::NinjaArg::createRaw(getDefineFlag(config.getCompiler(), "_CONSOLE", "")));
break;
case LibraryType::STATIC:
- defines.push_back(ninja::NinjaArg::createRaw(" _LIB"));
+ defines.push_back(ninja::NinjaArg::createRaw(getDefineFlag(config.getCompiler(), "_LIB", "")));
break;
}
}
diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp
index 0487227..d740fff 100644
--- a/include/FileUtil.hpp
+++ b/include/FileUtil.hpp
@@ -25,6 +25,7 @@ namespace sibs
std::string toUtf8(const char *input);
FileString toFileString(const std::string &utf8Str);
FileString toFileString(const StringView &utf8Str);
+ FileString toFileString(const char *str);
#else
std::string toUtf8(const sibs::FileString &input);
std::string toUtf8(const TCHAR *input);
@@ -32,6 +33,7 @@ namespace sibs
FileString utf8To16(const std::string &utf8Str);
FileString toFileString(const std::string &utf8Str);
FileString toFileString(const StringView &utf8Str);
+ FileString toFileString(const char *str);
FileString getLastErrorAsString();
void replaceChar(FileString &input, wchar_t charToReplace, wchar_t charToReplaceWith);
#endif
diff --git a/msvc/sibs.exe b/msvc/sibs.exe
index 3d2ba7d..51aad1b 100644
--- a/msvc/sibs.exe
+++ b/msvc/sibs.exe
Binary files differ
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp
index d33c94d..d07a074 100644
--- a/src/FileUtil.cpp
+++ b/src/FileUtil.cpp
@@ -54,6 +54,11 @@ namespace sibs
{
return FileString(utf8Str.data, utf8Str.data + utf8Str.size);
}
+
+ FileString toFileString(const char *str)
+ {
+ return str;
+ }
#else
std::string toUtf8(const sibs::FileString &input)
{
@@ -96,6 +101,13 @@ namespace sibs
return result;
}
+ FileString toFileString(const char *str)
+ {
+ FileString result;
+ utf8::utf8to16(str, str + strlen(str), std::back_inserter(result));
+ return result;
+ }
+
FileString getLastErrorAsString()
{
DWORD errorMessageId = GetLastError();
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 2dd829f..7f9d949 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -278,7 +278,7 @@ namespace sibs
libPath += TINYDIR_STRING("/.cache/sibs/lib/");
libPath += toFileString(dependency->name);
libPath += TINYDIR_STRING("/");
- libPath += package.version.toString();
+ libPath += toFileString(package.version.toString());
FileString libArchivedFilePath = libPathResult.unwrap();
libArchivedFilePath += TINYDIR_STRING("/.cache/sibs/archive/");
@@ -288,7 +288,7 @@ namespace sibs
return createArchiveDirResult;
libArchivedFilePath += TINYDIR_STRING("/");
- libArchivedFilePath += package.version.toString();
+ libArchivedFilePath += toFileString(package.version.toString());
Result<bool> downloadResult = curl::downloadFile(package.urls[0].c_str(), libArchivedFilePath.c_str());
if(!downloadResult)
return downloadResult;
diff --git a/src/main.cpp b/src/main.cpp
index 8e9cc00..a295eba 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -446,7 +446,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv)
OptimizationLevel optimizationLevel = OPT_LEV_NONE;
FileString projectPath;
bool sanitize = false;
- const _tinydir_char_t *platformName = nullptr;
+ FileString platformName;
for(int i = 0; i < argc; ++i)
{
@@ -484,7 +484,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv)
++i;
arg = argv[i];
- if(platformName)
+ if(!platformName.empty())
{
ferr << "Error: Platform defined twice. First as " << platformName << " then as " << arg << endl;
usageBuild();
@@ -510,8 +510,8 @@ static int buildProject(int argc, const _tinydir_char_t **argv)
if(optimizationLevel == OPT_LEV_NONE)
optimizationLevel = OPT_LEV_DEBUG;
- if(!platformName)
- platformName = asString(SYSTEM_PLATFORM);
+ if(platformName.empty())
+ platformName = toFileString(asString(SYSTEM_PLATFORM));
string platformUtf8 = toUtf8(platformName);
Platform platform = getPlatformByName(StringView(platformUtf8.data(), platformUtf8.size()));