diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-14 04:58:11 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | d00a3a0371bcbe008525dff0456bb88b6977dd82 (patch) | |
tree | cf316e724f4dbeaeb7efd9e4a0728da673168312 | |
parent | 5e79e361c97e88b4a5912990eda0f1fb0d4a6dbd (diff) |
Define win macro on mingw
-rw-r--r-- | backend/ninja/Ninja.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index f236210..3e69ef1 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -127,11 +127,17 @@ namespace backend case Compiler::MINGW_W64: case Compiler::GCC: { - return "'-D" + name + "=" + value + "'"; + if(value.empty()) + return "'-D" + name + "=" + value + "'"; + else + return "'-D" + name + "'"; } case Compiler::MSVC: { - return "\"/D" + name + "=" + value + "\""; + if(value.empty()) + return "\"/D" + name + "=" + value + "\""; + else + return "\"/D" + name + "\""; } default: assert(false); @@ -919,13 +925,25 @@ namespace backend defines.push_back(ninja::NinjaArg::createRaw(getDefineFlag(config.getCompiler(), definePair.first, definePair.second))); } - switch (SYSTEM_PLATFORM) + switch (config.platform) { case PLATFORM_WIN64: - defines.insert(defines.end(), { ninja::NinjaArg("/DWIN64"), ninja::NinjaArg("/D_WIN64") }); - // fallthrough + { + for(const string &define : { "WIN64", "_WIN64", "WIN32", "_WIN32" }) + { + defines.push_back(ninja::NinjaArg::createRaw(getDefineFlag(config.getCompiler(), define, ""))); + } + break; + } case PLATFORM_WIN32: - defines.insert(defines.end(), { ninja::NinjaArg("/DWIN32"), ninja::NinjaArg("/D_WIN32") }); + { + for(const string &define : { "WIN32", "_WIN32" }) + { + defines.push_back(ninja::NinjaArg::createRaw(getDefineFlag(config.getCompiler(), define, ""))); + } + break; + } + default: break; } |