diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-09-26 01:52:50 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 527179c68597b907dbd6bdc6489181306e9e19ec (patch) | |
tree | 7b90b284b1927edc22b080da7ffe7e5b3620b466 | |
parent | 2bbcfbf4014d332121c65d7480a42556f02d00bc (diff) |
Fix build for linux
-rw-r--r-- | backend/ninja/Ninja.cpp | 9 | ||||
-rw-r--r-- | include/Conf.hpp | 8 | ||||
-rw-r--r-- | include/FileUtil.hpp | 3 | ||||
-rw-r--r-- | project.conf | 2 | ||||
-rw-r--r-- | src/Exec.cpp | 4 | ||||
-rw-r--r-- | src/FileUtil.cpp | 11 |
6 files changed, 25 insertions, 12 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 05bb16d..ac683a0 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -885,7 +885,7 @@ namespace backend compileCCommand.push_back(ninja::NinjaArg("/w")); // TODO: Remove this once locate_windows_sdk has been updated to locate multiple arch windows sdk -#if SYSTEM_PLATFORM == PLATFORM_WIN32 +#ifdef _WIN32 #error "sibs is currently not supported on windows 32-bit because locate_windows_sdk can only locate x64 windows sdk" #endif @@ -1088,6 +1088,9 @@ namespace backend case LibraryType::EXECUTABLE: { vector<ninja::NinjaArg> buildExeArgs; + string executableName = config.getPackageName(); + if(OS_FAMILY == OS_FAMILY_WINDOWS) + executableName += ".exe"; if(onlyZigFiles) { buildExeArgs.insert(buildExeArgs.end(), { @@ -1102,7 +1105,7 @@ namespace backend buildExeArgs.insert(buildExeArgs.end(), zigLibraryFlags.begin(), zigLibraryFlags.end()); ninja::NinjaRule *buildExeRule = ninjaBuildFile.createRule("build_exec", buildExeArgs); - buildExeRule->build(objectNames, OS_FAMILY == OS_FAMILY_POSIX ? config.getPackageName() : config.getPackageName() + ".exe", { zigObjectArgsValue }); + buildExeRule->build(objectNames, executableName, { zigObjectArgsValue }); } else { @@ -1170,7 +1173,7 @@ namespace backend buildExeArgs.push_back(ninja::NinjaArg::createRaw(allLinkerFlags)); ninja::NinjaRule *buildExeRule = ninjaBuildFile.createRule("build_exec", buildExeArgs); - buildExeRule->build(objectNames, config.getPackageName() + ".exe", {}); + buildExeRule->build(objectNames, executableName, {}); } projectGeneratedBinary += config.getPackageName(); diff --git a/include/Conf.hpp b/include/Conf.hpp index f1dded6..dd8b003 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -175,13 +175,13 @@ namespace sibs #if OS_TYPE == OS_TYPE_WINDOWS #ifdef SIBS_ENV_32BIT - #define SYSTEM_PLATFORM Platform::PLATFORM_WIN32 + const Platform SYSTEM_PLATFORM = PLATFORM_WIN32; #define SYSTEM_PLATFORM_NAME "win32" #define CONFIG_SYSTEM_PLATFORM 0 #define CONFIG_STATIC_DEBUG_PLATFORM 1 #define CONFIG_STATIC_RELEASE_PLATFORM 2 #else - #define SYSTEM_PLATFORM Platform::PLATFORM_WIN64 + const Platform SYSTEM_PLATFORM = PLATFORM_WIN64; #define SYSTEM_PLATFORM_NAME "win64" #define CONFIG_SYSTEM_PLATFORM 3 #define CONFIG_STATIC_DEBUG_PLATFORM 4 @@ -191,13 +191,13 @@ namespace sibs #define CONFIG_DYNAMIC_LIB_FILE_EXTENSION L"dll" #elif OS_TYPE == OS_TYPE_LINUX #ifdef SIBS_ENV_32BIT - #define SYSTEM_PLATFORM Platform::PLATFORM_LINUX32 + const Platform SYSTEM_PLATFORM = PLATFORM_LINUX32; #define SYSTEM_PLATFORM_NAME "linux32" #define CONFIG_SYSTEM_PLATFORM 6 #define CONFIG_STATIC_DEBUG_PLATFORM 7 #define CONFIG_STATIC_RELEASE_PLATFORM 8 #else - #define SYSTEM_PLATFORM Platform::PLATFORM_LINUX64 + const Platform SYSTEM_PLATFORM = PLATFORM_LINUX64; #define SYSTEM_PLATFORM_NAME "linux64" #define CONFIG_SYSTEM_PLATFORM 9 #define CONFIG_STATIC_DEBUG_PLATFORM 10 diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp index aa2b82f..3e2e302 100644 --- a/include/FileUtil.hpp +++ b/include/FileUtil.hpp @@ -21,7 +21,8 @@ namespace sibs using FileString = std::basic_string<_tinydir_char_t, std::char_traits<_tinydir_char_t>, std::allocator<_tinydir_char_t>>; #if OS_FAMILY == OS_FAMILY_POSIX - #define toUtf8(input) input + std::string toUtf8(const std::string &input); + std::string toUtf8(const char *input); FileString toFileString(const std::string &utf8Str); FileString toFileString(const StringView &utf8Str); #else diff --git a/project.conf b/project.conf index a5a79b1..c02ba9b 100644 --- a/project.conf +++ b/project.conf @@ -5,7 +5,7 @@ version = "0.1.5" authors = ["DEC05EBA <0xdec05eba@gmail.com>"] tests = "tests" platforms = ["linux32", "linux64", "win64"] -ignore_dirs = ["cmake", "cmake-build-debug", "build", "distribute", "examples"] +ignore_dirs = ["cmake", "cmake-build-debug", "build", "distribute", "examples", "msvc", "cmake_msvc"] [dependencies] libcurl = "7.57.0" diff --git a/src/Exec.cpp b/src/Exec.cpp index 659d812..a183ed2 100644 --- a/src/Exec.cpp +++ b/src/Exec.cpp @@ -19,9 +19,9 @@ namespace sibs while(!feof(pipe)) { - int bytesRead = fgets(buffer, BUFSIZE, pipe); - if(bytesRead > 0) + if(fgets(buffer, BUFSIZE, pipe)) { + int bytesRead = strlen(buffer); execStdout.append(buffer, bytesRead); if(print) printf("%.*s", bytesRead, buffer); diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index e29ed36..222edbb 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -32,7 +32,16 @@ static int makedir(const _tinydir_char_t *dir) namespace sibs { #if OS_FAMILY == OS_FAMILY_POSIX -#define toUtf8(input) input + std::string toUtf8(const std::string &input) + { + return input; + } + + std::string toUtf8(const char *input) + { + return input; + } + FileString toFileString(const std::string &utf8Str) { return utf8Str; |