forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
@@ -113,6 +113,25 @@ void WebAssemblyToolChain::addToEnvironment(Utils::Environment &env) const
|
||||
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() :
|
||||
ClangToolChain(Constants::WEBASSEMBLY_TOOLCHAIN_TYPEID)
|
||||
{
|
||||
|
Reference in New Issue
Block a user