From 518407c80204dcaae91bb4afebea2355a589e595 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 28 Oct 2018 02:07:43 +0200 Subject: Fix system libraries wrong order mingw --- backend/ninja/Ninja.cpp | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 0ba08ab..4162c58 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -1302,7 +1302,7 @@ namespace backend { if(config.getCompiler() == Compiler::MINGW_W64) { - packagingFlags = "-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic"; + packagingFlags = "-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"; } } @@ -1401,22 +1401,6 @@ namespace backend }); } #endif - if(config.getCompiler() == Compiler::MINGW_W64) - { - buildExeArgs.insert(buildExeArgs.end(), { - ninja::NinjaArg::createRaw("-lws2_32"), - ninja::NinjaArg::createRaw("-lwldap32"), - ninja::NinjaArg::createRaw("-lcrypt32"), - ninja::NinjaArg::createRaw("-ladvapi32"), - ninja::NinjaArg::createRaw("-lgdi32"), - ninja::NinjaArg::createRaw("-luser32"), - ninja::NinjaArg::createRaw("-luserenv"), - ninja::NinjaArg::createRaw("-lopengl32"), - ninja::NinjaArg::createRaw("-lglu32"), - ninja::NinjaArg::createRaw("-lwinpthread"), - ninja::NinjaArg::createRaw("-lshell32") - }); - } break; } case Compiler::MSVC: @@ -1455,6 +1439,22 @@ namespace backend buildExeArgs.push_back(ninja::NinjaArg::createRaw(allLinkerFlags)); buildExeArgs.push_back(ninja::NinjaArg::createRaw(packagingFlags)); + if(config.getCompiler() == Compiler::MINGW_W64) + { + buildExeArgs.insert(buildExeArgs.end(), { + ninja::NinjaArg::createRaw("-lws2_32"), + ninja::NinjaArg::createRaw("-lwldap32"), + ninja::NinjaArg::createRaw("-lcrypt32"), + ninja::NinjaArg::createRaw("-ladvapi32"), + ninja::NinjaArg::createRaw("-lgdi32"), + ninja::NinjaArg::createRaw("-luser32"), + ninja::NinjaArg::createRaw("-luserenv"), + ninja::NinjaArg::createRaw("-lopengl32"), + ninja::NinjaArg::createRaw("-lglu32"), + ninja::NinjaArg::createRaw("-Wl,-Bstatic -lwinpthread"), + ninja::NinjaArg::createRaw("-lshell32") + }); + } ninja::NinjaRule *buildExeRule = ninjaBuildFile.createRule("build_exec", buildExeArgs); buildExeRule->build(objectNames, executableName, {}); } @@ -1616,22 +1616,6 @@ namespace backend }); } #endif - if(config.getCompiler() == Compiler::MINGW_W64) - { - buildDynamicArgs.insert(buildDynamicArgs.end(), { - ninja::NinjaArg::createRaw("-lws2_32"), - ninja::NinjaArg::createRaw("-lwldap32"), - ninja::NinjaArg::createRaw("-lcrypt32"), - ninja::NinjaArg::createRaw("-ladvapi32"), - ninja::NinjaArg::createRaw("-lgdi32"), - ninja::NinjaArg::createRaw("-luser32"), - ninja::NinjaArg::createRaw("-luserenv"), - ninja::NinjaArg::createRaw("-lopengl32"), - ninja::NinjaArg::createRaw("-lglu32"), - ninja::NinjaArg::createRaw("-lwinpthread"), - ninja::NinjaArg::createRaw("-lshell32") - }); - } break; } case Compiler::MSVC: @@ -1669,6 +1653,22 @@ namespace backend buildDynamicArgs.push_back(ninja::NinjaArg::createRaw(allLinkerFlags)); buildDynamicArgs.push_back(ninja::NinjaArg::createRaw(packagingFlags)); + if(config.getCompiler() == Compiler::MINGW_W64) + { + buildDynamicArgs.insert(buildDynamicArgs.end(), { + ninja::NinjaArg::createRaw("-lws2_32"), + ninja::NinjaArg::createRaw("-lwldap32"), + ninja::NinjaArg::createRaw("-lcrypt32"), + ninja::NinjaArg::createRaw("-ladvapi32"), + ninja::NinjaArg::createRaw("-lgdi32"), + ninja::NinjaArg::createRaw("-luser32"), + ninja::NinjaArg::createRaw("-luserenv"), + ninja::NinjaArg::createRaw("-lopengl32"), + ninja::NinjaArg::createRaw("-lglu32"), + ninja::NinjaArg::createRaw("-Wl,-Bstatic -lwinpthread"), + ninja::NinjaArg::createRaw("-lshell32") + }); + } ninja::NinjaRule *buildDynamicRule = ninjaBuildFile.createRule("build_dynamic", buildDynamicArgs); buildDynamicRule->build(objectNames, generatedFile, {}); } -- cgit v1.2.3