fix filename handling in replaceExtraCompilerVariables()
fixing and escaping is now a tri-state option: - none (this removes the need to unescape the result right afterwards in some cases) - local shell (for system()) - target shell (for Makefile) Change-Id: I5b78d9b70630fe4484dc964eff5f62793da35764 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
6ccf0a326e
commit
c0d67bb5c9
@ -773,7 +773,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
mkt << "\\\n\t";
|
||||
++added;
|
||||
const QString file_name = fileFixify(fn, Option::output_dir, Option::output_dir);
|
||||
mkt << " " << replaceExtraCompilerVariables(Option::fixPathToTargetOS(tmp_out.first().toQString(), false), file_name, QString());
|
||||
mkt << " " << replaceExtraCompilerVariables(
|
||||
Option::fixPathToTargetOS(tmp_out.first().toQString(), false), file_name, QString(), NoShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QMakeInternal;
|
||||
|
||||
bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
|
||||
{
|
||||
int argv0 = -1;
|
||||
@ -210,7 +212,7 @@ MakefileGenerator::initOutPaths()
|
||||
for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
|
||||
QString finp = fileFixify((*input).toQString(), Option::output_dir, Option::output_dir);
|
||||
*input = ProString(finp);
|
||||
QString path = unescapeFilePath(replaceExtraCompilerVariables(tmp_out, finp, QString()));
|
||||
QString path = replaceExtraCompilerVariables(tmp_out, finp, QString(), NoShell);
|
||||
path = Option::fixPathToTargetOS(path);
|
||||
int slash = path.lastIndexOf(Option::dir_sep);
|
||||
if(slash != -1) {
|
||||
@ -728,7 +730,7 @@ MakefileGenerator::init()
|
||||
QString in = Option::fixPathToTargetOS(inpf, false);
|
||||
if (!verifyExtraCompiler((*it).toQString(), in)) //verify
|
||||
continue;
|
||||
QString out = replaceExtraCompilerVariables(tmp_out.toQString(), inpf, QString());
|
||||
QString out = replaceExtraCompilerVariables(tmp_out.toQString(), inpf, QString(), NoShell);
|
||||
out = fileFixify(out, Option::output_dir, Option::output_dir);
|
||||
bool pre_dep = (config.indexOf("target_predeps") != -1);
|
||||
if (v.contains(vokey)) {
|
||||
@ -1513,7 +1515,8 @@ MakefileGenerator::createObjectList(const ProStringList &sources)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ReplaceExtraCompilerCacheKey::ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o)
|
||||
ReplaceExtraCompilerCacheKey::ReplaceExtraCompilerCacheKey(
|
||||
const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s)
|
||||
{
|
||||
static QString doubleColon = QLatin1String("::");
|
||||
|
||||
@ -1530,11 +1533,13 @@ ReplaceExtraCompilerCacheKey::ReplaceExtraCompilerCacheKey(const QString &v, con
|
||||
ol.sort();
|
||||
out = ol.join(doubleColon);
|
||||
}
|
||||
forShell = s;
|
||||
}
|
||||
|
||||
bool ReplaceExtraCompilerCacheKey::operator==(const ReplaceExtraCompilerCacheKey &f) const
|
||||
{
|
||||
return (hashCode() == f.hashCode() &&
|
||||
f.forShell == forShell &&
|
||||
f.in == in &&
|
||||
f.out == out &&
|
||||
f.var == var &&
|
||||
@ -1543,10 +1548,11 @@ bool ReplaceExtraCompilerCacheKey::operator==(const ReplaceExtraCompilerCacheKey
|
||||
|
||||
|
||||
QString
|
||||
MakefileGenerator::replaceExtraCompilerVariables(const QString &orig_var, const QStringList &in, const QStringList &out)
|
||||
MakefileGenerator::replaceExtraCompilerVariables(
|
||||
const QString &orig_var, const QStringList &in, const QStringList &out, ReplaceFor forShell)
|
||||
{
|
||||
//lazy cache
|
||||
ReplaceExtraCompilerCacheKey cacheKey(orig_var, in, out);
|
||||
ReplaceExtraCompilerCacheKey cacheKey(orig_var, in, out, forShell);
|
||||
QString cacheVal = extraCompilerVariablesCache.value(cacheKey);
|
||||
if(!cacheVal.isNull())
|
||||
return cacheVal;
|
||||
@ -1633,12 +1639,14 @@ MakefileGenerator::replaceExtraCompilerVariables(const QString &orig_var, const
|
||||
|
||||
if(!val.isEmpty()) {
|
||||
QString fullVal;
|
||||
if(filePath) {
|
||||
if (filePath && forShell != NoShell) {
|
||||
for(int i = 0; i < val.size(); ++i) {
|
||||
const QString file = Option::fixPathToTargetOS(unescapeFilePath(val.at(i)), false);
|
||||
if(!fullVal.isEmpty())
|
||||
fullVal += " ";
|
||||
fullVal += escapeFilePath(file);
|
||||
if (forShell == LocalShell)
|
||||
fullVal += IoUtils::shellQuote(Option::fixPathToLocalOS(unescapeFilePath(val.at(i)), false));
|
||||
else
|
||||
fullVal += escapeFilePath(Option::fixPathToTargetOS(unescapeFilePath(val.at(i)), false));
|
||||
}
|
||||
} else {
|
||||
fullVal = val.join(' ');
|
||||
@ -1705,7 +1713,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil
|
||||
QString in = fileFixify(Option::fixPathToTargetOS(inpf, false));
|
||||
if(in == file) {
|
||||
bool pass = project->test(verify.toKey(),
|
||||
QList<ProStringList>() << ProStringList(replaceExtraCompilerVariables(tmp_out.toQString(), inpf, QString())) <<
|
||||
QList<ProStringList>() << ProStringList(replaceExtraCompilerVariables(tmp_out.toQString(), inpf, QString(), NoShell)) <<
|
||||
ProStringList(file));
|
||||
if(invert)
|
||||
pass = !pass;
|
||||
@ -1723,7 +1731,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil
|
||||
return false;
|
||||
const QString tmp_cmd = project->values(ProKey(comp + ".commands")).join(' ');
|
||||
if (config.indexOf("combine") != -1) {
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out);
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out, LocalShell);
|
||||
if(system(cmd.toLatin1().constData()))
|
||||
return false;
|
||||
} else {
|
||||
@ -1736,8 +1744,8 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil
|
||||
QString inpf = (*input).toQString();
|
||||
QString in = fileFixify(Option::fixPathToTargetOS(inpf, false));
|
||||
if(in == file) {
|
||||
QString out = replaceExtraCompilerVariables(tmp_out, inpf, QString());
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, in, out);
|
||||
QString out = replaceExtraCompilerVariables(tmp_out, inpf, QString(), NoShell);
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, in, out, LocalShell);
|
||||
if(system(cmd.toLatin1().constData()))
|
||||
return false;
|
||||
break;
|
||||
@ -1814,10 +1822,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
if (config.indexOf("combine") != -1) {
|
||||
// compilers with a combined input only have one output
|
||||
QString input = project->first(ProKey(*it + ".output")).toQString();
|
||||
t << " " << escapeDependencyPath(Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, input, QString())));
|
||||
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(tmp_out, input, QString(), NoShell)));
|
||||
} else {
|
||||
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
|
||||
t << " " << escapeDependencyPath(Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString())));
|
||||
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString(), NoShell)));
|
||||
}
|
||||
}
|
||||
t << endl;
|
||||
@ -1849,7 +1859,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
|
||||
QString tinp = (*input).toQString();
|
||||
cleans.append(" " + Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_clean, tinp,
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString()))));
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell)));
|
||||
}
|
||||
} else {
|
||||
QString files, file;
|
||||
@ -1857,7 +1867,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
for(int input = 0; input < tmp_inputs.size(); ++input) {
|
||||
QString tinp = tmp_inputs.at(input).toQString();
|
||||
file = " " + replaceExtraCompilerVariables(tmp_clean, tinp,
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString()));
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell);
|
||||
if(del_statement.length() + files.length() +
|
||||
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
|
||||
cleans.append(files);
|
||||
@ -1875,7 +1885,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
|
||||
QString tinp = (*input).toQString();
|
||||
t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, tinp,
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString()));
|
||||
replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1897,7 +1907,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
inputs += Option::fixPathToTargetOS(inpf, false);
|
||||
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
|
||||
char buff[256];
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out);
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
|
||||
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
|
||||
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
|
||||
QString indeps;
|
||||
@ -1959,8 +1969,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
if (inputs.isEmpty())
|
||||
continue;
|
||||
|
||||
QString out = replaceExtraCompilerVariables(tmp_out, QString(), QString());
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, escapeFilePaths(inputs), QStringList() << out);
|
||||
QString out = replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell);
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, inputs, QStringList() << out, TargetShell);
|
||||
t << escapeDependencyPath(Option::fixPathToTargetOS(out)) << ":";
|
||||
// compiler.CONFIG+=explicit_dependencies means that ONLY compiler.depends gets to cause Makefile dependencies
|
||||
if (config.indexOf("explicit_dependencies") != -1) {
|
||||
@ -1976,19 +1986,19 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
QString in = Option::fixPathToTargetOS(inpf, false);
|
||||
QStringList deps = findDependencies(inpf);
|
||||
deps += escapeDependencyPath(in);
|
||||
QString out = unescapeFilePath(Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, inpf, QString())));
|
||||
QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, inpf, QString(), NoShell));
|
||||
if(!tmp_dep.isEmpty()) {
|
||||
QStringList pre_deps = fileFixify(tmp_dep, Option::output_dir, Option::output_dir);
|
||||
for(int i = 0; i < pre_deps.size(); ++i)
|
||||
deps += replaceExtraCompilerVariables(pre_deps.at(i), inpf, out);
|
||||
deps << replaceExtraCompilerVariables(pre_deps.at(i), inpf, out, NoShell);
|
||||
}
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, inpf, out);
|
||||
QString cmd = replaceExtraCompilerVariables(tmp_cmd, inpf, out, LocalShell);
|
||||
// NOTE: The var -> QMAKE_COMP_var replace feature is unsupported, do not use!
|
||||
for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3)
|
||||
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
|
||||
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
|
||||
char buff[256];
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out);
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
|
||||
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
|
||||
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
|
||||
QString indeps;
|
||||
@ -2982,8 +2992,8 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
|
||||
for (ProStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
|
||||
const ProStringList &inputs = project->values((*it2).toKey());
|
||||
for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
|
||||
QString out = Option::fixPathToTargetOS(unescapeFilePath(
|
||||
replaceExtraCompilerVariables(tmp_out.toQString(), (*input).toQString(), QString())));
|
||||
QString out = Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(tmp_out.toQString(), (*input).toQString(), QString(), NoShell));
|
||||
if (out == dep.real() || out.section(Option::dir_sep, -1) == dep_basename) {
|
||||
ret = QMakeLocalFileName(fileFixify(out, qmake_getpwd(), Option::output_dir));
|
||||
goto found_dep_from_heuristic;
|
||||
|
@ -52,20 +52,6 @@ QT_BEGIN_NAMESPACE
|
||||
#define QT_PCLOSE pclose
|
||||
#endif
|
||||
|
||||
struct ReplaceExtraCompilerCacheKey
|
||||
{
|
||||
mutable uint hash;
|
||||
QString var, in, out, pwd;
|
||||
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o);
|
||||
bool operator==(const ReplaceExtraCompilerCacheKey &f) const;
|
||||
inline uint hashCode() const {
|
||||
if(!hash)
|
||||
hash = qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
inline uint qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
|
||||
|
||||
struct ReplaceExtraCompilerCacheKey;
|
||||
|
||||
class MakefileGenerator : protected QMakeSourceFileInfo
|
||||
@ -81,6 +67,10 @@ class MakefileGenerator : protected QMakeSourceFileInfo
|
||||
mutable QHash<QString, QStringList> dependsCache;
|
||||
mutable QHash<ReplaceExtraCompilerCacheKey, QString> extraCompilerVariablesCache;
|
||||
|
||||
public:
|
||||
// We can't make it visible to VCFilter in VS2008 except by making it public or directly friending it.
|
||||
enum ReplaceFor { NoShell, LocalShell, TargetShell };
|
||||
|
||||
protected:
|
||||
enum TARG_MODE { TARG_UNIX_MODE, TARG_MAC_MODE, TARG_WIN_MODE } target_mode;
|
||||
|
||||
@ -132,9 +122,9 @@ protected:
|
||||
|
||||
//extra compiler interface
|
||||
bool verifyExtraCompiler(const ProString &c, const QString &f);
|
||||
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
|
||||
inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out)
|
||||
{ return replaceExtraCompilerVariables(val, QStringList(in), QStringList(out)); }
|
||||
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor forShell);
|
||||
inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell)
|
||||
{ return replaceExtraCompilerVariables(val, QStringList(in), QStringList(out), forShell); }
|
||||
|
||||
//interface to the source file info
|
||||
QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool);
|
||||
@ -281,6 +271,21 @@ inline bool MakefileGenerator::findLibraries()
|
||||
inline MakefileGenerator::~MakefileGenerator()
|
||||
{ }
|
||||
|
||||
struct ReplaceExtraCompilerCacheKey
|
||||
{
|
||||
mutable uint hash;
|
||||
QString var, in, out, pwd;
|
||||
MakefileGenerator::ReplaceFor forShell;
|
||||
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s);
|
||||
bool operator==(const ReplaceExtraCompilerCacheKey &f) const;
|
||||
inline uint hashCode() const {
|
||||
if (!hash)
|
||||
hash = (uint)forShell ^ qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
inline uint qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // MAKEFILE_H
|
||||
|
@ -308,7 +308,7 @@ ProjectGenerator::init()
|
||||
for (ProStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
|
||||
ProStringList &inputs = project->values((*it2).toKey());
|
||||
for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
|
||||
QString path = replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString());
|
||||
QString path = replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString(), NoShell);
|
||||
path = fixPathToQmake(path).section('/', -1);
|
||||
for(int i = 0; i < var_out.size(); ++i) {
|
||||
ProString v = var_out.at(i);
|
||||
|
@ -2295,9 +2295,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
QString cmd, cmd_name, out;
|
||||
QStringList deps, inputs;
|
||||
// Variabel replacement of output name
|
||||
out = Option::fixPathToTargetOS(
|
||||
Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()),
|
||||
false);
|
||||
out = Option::fixPathToTargetOS(Project->replaceExtraCompilerVariables(
|
||||
tmp_out, inFile, QString(), MakefileGenerator::NoShell), false);
|
||||
|
||||
// If file has built-in compiler, we've swapped the input and output of
|
||||
// the command, as we in Visual Studio cannot have a Custom Buildstep on
|
||||
@ -2318,9 +2317,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
if (!tmp_dep_cmd.isEmpty()) {
|
||||
// Execute dependency command, and add every line as a dep
|
||||
char buff[256];
|
||||
QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd,
|
||||
Option::fixPathToLocalOS(inFile, true, false),
|
||||
out);
|
||||
QString dep_cmd = Project->replaceExtraCompilerVariables(
|
||||
tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell);
|
||||
if(Project->canExecute(dep_cmd)) {
|
||||
dep_cmd.prepend(QLatin1String("cd ")
|
||||
+ Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
@ -2347,7 +2345,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
}
|
||||
for (int i = 0; i < deps.count(); ++i)
|
||||
deps[i] = Option::fixPathToTargetOS(
|
||||
Project->replaceExtraCompilerVariables(deps.at(i), inFile, out),
|
||||
Project->replaceExtraCompilerVariables(
|
||||
deps.at(i), inFile, out, MakefileGenerator::NoShell),
|
||||
false).trimmed();
|
||||
// Command for file
|
||||
if (combined) {
|
||||
@ -2367,16 +2366,19 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
// ### join gives path issues with directories containing spaces!
|
||||
cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
|
||||
inputs.join(' '),
|
||||
out);
|
||||
out,
|
||||
MakefileGenerator::TargetShell);
|
||||
} else {
|
||||
deps.prepend(inFile); // input file itself too..
|
||||
cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
|
||||
inFile,
|
||||
out);
|
||||
out,
|
||||
MakefileGenerator::TargetShell);
|
||||
}
|
||||
// Name for command
|
||||
if (!tmp_cmd_name.isEmpty()) {
|
||||
cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out);
|
||||
cmd_name = Project->replaceExtraCompilerVariables(
|
||||
tmp_cmd_name, inFile, out, MakefileGenerator::NoShell);
|
||||
} else {
|
||||
int space = cmd.indexOf(' ');
|
||||
if (space != -1)
|
||||
|
@ -893,7 +893,7 @@ void VcprojGenerator::init()
|
||||
extraCompilerSources[file] += quc.toQString();
|
||||
} else {
|
||||
QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables(
|
||||
compiler_out, file, QString()), false);
|
||||
compiler_out, file, QString(), NoShell), false);
|
||||
extraCompilerSources[out] += quc.toQString();
|
||||
extraCompilerOutputs[out] = QStringList(file); // Can only have one
|
||||
}
|
||||
@ -1532,7 +1532,8 @@ void VcprojGenerator::initResourceFiles()
|
||||
if(!qrc_files.isEmpty()) {
|
||||
for (int i = 0; i < qrc_files.count(); ++i) {
|
||||
char buff[256];
|
||||
QString dep_cmd = replaceExtraCompilerVariables(rcc_dep_cmd, qrc_files.at(i).toQString(), "");
|
||||
QString dep_cmd = replaceExtraCompilerVariables(
|
||||
rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell);
|
||||
|
||||
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
|
||||
if(canExecute(dep_cmd)) {
|
||||
@ -1605,16 +1606,16 @@ void VcprojGenerator::initExtraCompilerOutputs()
|
||||
QString tmp_out = project->first(ProKey(*it + ".output")).toQString();
|
||||
if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) {
|
||||
// Combined output, only one file result
|
||||
extraCompile.addFile(
|
||||
Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, QString(), QString()), false));
|
||||
extraCompile.addFile(Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false));
|
||||
} else {
|
||||
// One output file per input
|
||||
const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey());
|
||||
for (int i = 0; i < tmp_in.count(); ++i) {
|
||||
const QString &filename = tmp_in.at(i).toQString();
|
||||
if (extraCompilerSources.contains(filename))
|
||||
extraCompile.addFile(
|
||||
Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, tmp_out, QString()), false));
|
||||
extraCompile.addFile(Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(filename, tmp_out, QString(), NoShell), false));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1629,8 +1630,8 @@ void VcprojGenerator::initExtraCompilerOutputs()
|
||||
for (int i = 0; i < tmp_in.count(); ++i) {
|
||||
const QString &filename = tmp_in.at(i).toQString();
|
||||
if (extraCompilerSources.contains(filename))
|
||||
extraCompile.addFile(
|
||||
Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, QString(), QString()), false));
|
||||
extraCompile.addFile(Option::fixPathToTargetOS(
|
||||
replaceExtraCompilerVariables(filename, QString(), QString(), NoShell), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1650,9 +1651,10 @@ VCProjectWriter *VcprojGenerator::createProjectWriter()
|
||||
return new VCProjectWriter;
|
||||
}
|
||||
|
||||
QString VcprojGenerator::replaceExtraCompilerVariables(const QString &var, const QStringList &in, const QStringList &out)
|
||||
QString VcprojGenerator::replaceExtraCompilerVariables(
|
||||
const QString &var, const QStringList &in, const QStringList &out, ReplaceFor forShell)
|
||||
{
|
||||
QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out);
|
||||
QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out, forShell);
|
||||
|
||||
ProStringList &defines = project->values("VCPROJ_MAKEFILE_DEFINES");
|
||||
if(defines.isEmpty())
|
||||
|
@ -76,9 +76,10 @@ protected:
|
||||
virtual VCProjectWriter *createProjectWriter();
|
||||
virtual bool doDepends() const { return false; } //never necesary
|
||||
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
|
||||
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
|
||||
inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out)
|
||||
{ return MakefileGenerator::replaceExtraCompilerVariables(val, in, out); }
|
||||
using MakefileGenerator::ReplaceFor;
|
||||
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
|
||||
inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell)
|
||||
{ return MakefileGenerator::replaceExtraCompilerVariables(val, in, out, forShell); }
|
||||
virtual bool supportsMetaBuild() { return true; }
|
||||
virtual bool supportsMergedBuilds() { return true; }
|
||||
virtual bool mergeBuildProject(MakefileGenerator *other);
|
||||
|
Loading…
Reference in New Issue
Block a user