diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-11-04 10:00:33 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 7c0ec4cc4360d086b09ea4ad2d05c3294d16cfb3 (patch) | |
tree | 239787f16b6f5d7f03f50ade108ea3d1337d9c06 | |
parent | 3eea3766761ec77281aaf113fd75d5ca8ab61341 (diff) |
Fix build for windows and mingw
-rw-r--r-- | backend/ninja/Ninja.cpp | 8 | ||||
-rw-r--r-- | src/CmakeModule.cpp | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index d5bfc67..f8c3ae9 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -1431,12 +1431,12 @@ namespace backend case Compiler::MINGW_W64: case Compiler::GCC: { - generatedFile = "lib" + config.getPackageName() + "." + CONFIG_STATIC_LIB_FILE_EXTENSION; + generatedFile = "lib" + config.getPackageName() + "." + toUtf8(CONFIG_STATIC_LIB_FILE_EXTENSION); break; } case Compiler::MSVC: { - generatedFile = config.getPackageName() + "." + CONFIG_STATIC_LIB_FILE_EXTENSION; + generatedFile = config.getPackageName() + "." + toUtf8(CONFIG_STATIC_LIB_FILE_EXTENSION); break; } } @@ -1510,7 +1510,7 @@ namespace backend case Compiler::MINGW_W64: case Compiler::GCC: { - const char *fileExtension = CONFIG_DYNAMIC_LIB_FILE_EXTENSION; + string fileExtension = toUtf8(CONFIG_DYNAMIC_LIB_FILE_EXTENSION); if(compilerType == RuntimeCompilerType::EMSCRIPTEN) fileExtension = "wasm"; else if(config.getCompiler() == Compiler::MINGW_W64) @@ -1520,7 +1520,7 @@ namespace backend } case Compiler::MSVC: { - generatedFile = config.getPackageName() + "." + CONFIG_DYNAMIC_LIB_FILE_EXTENSION; + generatedFile = config.getPackageName() + "." + toUtf8(CONFIG_DYNAMIC_LIB_FILE_EXTENSION); break; } } diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index c1f7643..394acdb 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -138,8 +138,13 @@ namespace sibs if (createBuildDirResult.isErr()) return createBuildDirResult; +#if OS_FAMILY == OS_FAMILY_POSIX setenv("CFLAGS", "-fPIC", 1); setenv("CXXFLAGS", "-fPIC", 1); +#else + _putenv("CFLAGS=-fPIC"); + _putenv("CXXFLAGS=-fPIC"); +#endif FileString cmd = cmakePath; cmd += TINYDIR_STRING(" "); if(config.getCompiler() == Compiler::GCC) @@ -220,7 +225,7 @@ namespace sibs if(config.getPackageType() != PackageType::EXECUTABLE) { - const _tinydir_char_t *dynamicLibExtension = TINYDIR_STRING(CONFIG_DYNAMIC_LIB_FILE_EXTENSION); + const _tinydir_char_t *dynamicLibExtension = CONFIG_DYNAMIC_LIB_FILE_EXTENSION; if(config.getCompiler() == Compiler::MINGW_W64) dynamicLibExtension = TINYDIR_STRING("dll"); |