12using namespace QMakeInternal;
18 QMakeEvaluator::initStatics();
39 const QStringList &vals = values(variable);
50 ret.reserve(values.size());
51 for (
const ProString &str : values)
52 ret << d->m_option->expandEnvVars(str.toQString());
61 ret.reserve(values.size());
62 for (
const ProString &str : values)
63 if (str.sourceFile() == pro->id())
64 ret << d->m_option->expandEnvVars(str.toQString());
68QString
ProFileEvaluator::sysrootify(
const QString &path,
const QString &baseDir)
const
72 Qt::CaseSensitivity cs = Qt::CaseInsensitive;
74 Qt::CaseSensitivity cs = Qt::CaseSensitive;
76 const bool isHostSystemPath =
77 option->sysroot.isEmpty() || path.startsWith(option->sysroot, cs)
78 || path.startsWith(baseDir, cs) || path.startsWith(d->m_outputDir, cs);
80 return isHostSystemPath ? path : option->sysroot + path;
84 const QString &variable,
const QString &baseDirectory)
const
87 for (
const QString &el : values(variable)) {
88 QString absEl = IoUtils::isAbsolutePath(el)
89 ? sysrootify(el, baseDirectory) : IoUtils::resolvePath(baseDirectory, el);
90 if (IoUtils::fileType(absEl) == IoUtils::FileIsDir)
91 result << QDir::cleanPath(absEl);
97 const QString &variable,
const QString &baseDirectory,
const QStringList &searchDirs,
101 const auto vals = pro ? values(variable, pro) : values(variable);
102 for (
const QString &el : vals) {
104 if (IoUtils::isAbsolutePath(el)) {
105 const QString elWithSysroot = QDir::cleanPath(sysrootify(el, baseDirectory));
106 if (d->m_vfs->exists(elWithSysroot, QMakeVfs::VfsCumulative)) {
107 result << elWithSysroot;
110 absEl = elWithSysroot;
112 for (
const QString &dir : searchDirs) {
113 QString fn = QDir::cleanPath(dir + QLatin1Char(
'/') + el);
114 if (d->m_vfs->exists(fn, QMakeVfs::VfsCumulative)) {
119 if (baseDirectory.isEmpty())
121 absEl = QDir::cleanPath(baseDirectory + QLatin1Char(
'/') + el);
124 int nameOff = absEl.lastIndexOf(QLatin1Char(
'/'));
125 QString absDir = d->m_tmp1.setRawData(absEl.constData(), nameOff);
128 if (IoUtils::fileType(absDir) == IoUtils::FileIsDir) {
129 QString wildcard = d->m_tmp2.setRawData(absEl.constData() + nameOff + 1,
130 absEl.size() - nameOff - 1);
131 if (wildcard.contains(QLatin1Char(
'*')) || wildcard.contains(QLatin1Char(
'?'))) {
133 for (
const QString &fn : theDir.entryList(QStringList(wildcard)))
134 if (fn != QLatin1String(
".") && fn != QLatin1String(
".."))
135 result << absDir + QLatin1Char(
'/') + fn;
147 if (templ.size() >= 1) {
148 const QString &t = templ.at(0).toQString();
149 if (!t.compare(QLatin1String(
"app"), Qt::CaseInsensitive))
151 if (!t.compare(QLatin1String(
"lib"), Qt::CaseInsensitive))
153 if (!t.compare(QLatin1String(
"script"), Qt::CaseInsensitive))
155 if (!t.compare(QLatin1String(
"aux"), Qt::CaseInsensitive))
157 if (!t.compare(QLatin1String(
"subdirs"), Qt::CaseInsensitive))
165 d->m_qmakespec = specDir;
184 return d->m_qmakespec;
187#ifdef PROEVALUATOR_CUMULATIVE
188void ProFileEvaluator::setCumulative(
bool on)
190 d->m_cumulative = on;
197 for (
auto it = extraVars.cbegin(), end = extraVars.cend() ; it != end; ++it)
209 d->m_outputDir = dir;
ProFileEvaluator::TemplateType templateType() const
ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs, QMakeHandler *handler)
void setExtraConfigs(const QStringList &extraConfigs)
void setExtraVars(const QHash< QString, QStringList > &extraVars)
QStringList values(const QString &variableName, const ProFile *pro) const
QString value(const QString &variableName) const
bool contains(const QString &variableName) const
QString resolvedMkSpec() const
bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags=QMakeEvaluator::LoadAll)
QStringList absoluteFileValues(const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, const ProFile *pro) const
void setOutputDir(const QString &dir)
QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const
QStringList values(const QString &variableName) const
QString propertyValue(const QString &val) const
bool loadNamedSpec(const QString &specDir, bool hostSpec)
ProKey(const QString &str)
PROITEM_EXPLICIT ProKey(const char *str)
QString toQString() const
void setExtraConfigs(const ProStringList &extraConfigs)
ProStringList values(const ProKey &variableName) const
void setExtraVars(const ProValueMap &extraVars)
ProValueMapStack m_valuemapStack
ProString propertyValue(const ProKey &name) const
QMap< ProKey, ProStringList > ProValueMap