WebAssembly: Add registered MinGW path to toolchain environment

The build system of Qt for WebAssembly on Windows requires MinGW in the
path. If a MinGW toolchain is registeded (e.g. via Sdk installer),
append it to the path.

Change-Id: I5c33cb5c4df636be99f815e307806efc07e18a11
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2019-10-19 15:16:44 +02:00
parent c2c8b9a5d6
commit f6d2315824

View File

@@ -91,7 +91,7 @@ static ProjectExplorer::Abi toolChainAbi()
}; };
} }
void WebAssemblyToolChain::addToEnvironment(Utils::Environment &env) const static void addEmscriptenToEnvironment(Utils::Environment &env)
{ {
const CompilerConfiguration configuration = compilerConfiguration(); const CompilerConfiguration configuration = compilerConfiguration();
@@ -113,6 +113,25 @@ void WebAssemblyToolChain::addToEnvironment(Utils::Environment &env) const
env.set("EMSCRIPTEN", configuration.emScripten.toUserOutput()); env.set("EMSCRIPTEN", configuration.emScripten.toUserOutput());
} }
static void addRegisteredMinGWToEnvironment(Utils::Environment &env)
{
using namespace ProjectExplorer;
const ToolChain *toolChain = ToolChainManager::toolChain([](const ToolChain *t){
return t->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID;
});
if (toolChain) {
const QString mingwPath = toolChain->compilerCommand().parentDir().toUserOutput();
env.appendOrSetPath(mingwPath);
}
}
void WebAssemblyToolChain::addToEnvironment(Utils::Environment &env) const
{
addEmscriptenToEnvironment(env);
if (Utils::HostOsInfo::isWindowsHost())
addRegisteredMinGWToEnvironment(env);
}
WebAssemblyToolChain::WebAssemblyToolChain() : WebAssemblyToolChain::WebAssemblyToolChain() :
ClangToolChain(Constants::WEBASSEMBLY_TOOLCHAIN_TYPEID) ClangToolChain(Constants::WEBASSEMBLY_TOOLCHAIN_TYPEID)
{ {