Set environment variable on Windows to be able to run autotests.

This commit is contained in:
Roman Telezhynskyi 2023-02-27 12:04:44 +02:00
parent 60d8833fb0
commit bf60cb02b1

View File

@ -33,6 +33,43 @@ Project {
if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos")) { if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos")) {
env.push("LD_LIBRARY_PATH=" + qbs.installRoot + qbs.installPrefix + "/" + buildconfig.libDirName + "/valentina"); env.push("LD_LIBRARY_PATH=" + qbs.installRoot + qbs.installPrefix + "/" + buildconfig.libDirName + "/valentina");
} }
else if (qbs.targetOS.contains("windows")) {
// PATH
var path = "";
for (var i = 0; i < env.length; ++i) {
if (env[i].startsWith("PATH=")) {
path = env[i].substring(5);
break;
}
}
var fullInstallDir = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix);
if (path.length === 0) {
path = fullInstallDir;
} else {
path = fullInstallDir + ";" + path;
}
var arrayElem = "PATH=" + path;
if (i < env.length)
env[i] = arrayElem;
else
env.push(arrayElem);
// QT_QPA_PLATFORM_PLUGIN_PATH
for (var i = 0; i < env.length; ++i) {
if (env[i].startsWith("QT_QPA_PLATFORM_PLUGIN_PATH=")) {
break;
}
}
if (i >= env.length) {
var pluginsPath = "QT_QPA_PLATFORM_PLUGIN_PATH=" + Qt.core.pluginPath
env.push(pluginsPath);
}
console.info("env_after: " + env);
}
return env; return env;
} }
} }