From d00a3a0371bcbe008525dff0456bb88b6977dd82 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 14 Oct 2018 04:58:11 +0200 Subject: Define win macro on mingw --- backend/ninja/Ninja.cpp | 30 ++++++++++++++++++++++++------ 1 file 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; } -- cgit v1.2.3