diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-10-25 16:28:40 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-11-01 17:35:59 +0000 |
commit | 7e86b98836342035684cc1c1aa49292224faed07 (patch) | |
tree | 68fdf9844651538b6027ce9f61255214b9460da2 /src/shared/proparser | |
parent | 4148b05e0abe268c1299b5d3f672197a8f1acc92 (diff) |
unify {,obj}c++{source,header} handling in qmake project manager
consistently with Xcode, qmake nowadays knows only one SOURCES list,
which is automatically classified by extension.
to replicate that, we actually copy the objective_c.prf file from qt
5.6.3 and use it to override whatever comes with qt, so we can treat all
qt versions uniformly.
also, the code model throws away the information which files were listed
as sources and which as headers. this is technically incorrect, as a
source may be only included rather than compiled, but there is no point
in extracting information which is not used.
conclusion: lump all c-like sources into one variable as far as project
processing is concerned.
and as far as configuration goes, our code model doesn't differentiate
anyway, so the duplicated setup paths can be eliminated as well.
Change-Id: I24b1bc056f8d9eb579c9378817f602912ab49971
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/shared/proparser')
-rw-r--r-- | src/shared/proparser/objective_c.prf | 12 | ||||
-rw-r--r-- | src/shared/proparser/proparser.pri | 2 | ||||
-rw-r--r-- | src/shared/proparser/proparser.qrc | 3 | ||||
-rw-r--r-- | src/shared/proparser/qmakeevaluator.cpp | 39 |
4 files changed, 41 insertions, 15 deletions
diff --git a/src/shared/proparser/objective_c.prf b/src/shared/proparser/objective_c.prf new file mode 100644 index 0000000000..ed1ad8ad38 --- /dev/null +++ b/src/shared/proparser/objective_c.prf @@ -0,0 +1,12 @@ + +# Objective-C/C++ sources go in SOURCES, like all other sources +SOURCES += $$OBJECTIVE_SOURCES +unset(OBJECTIVE_SOURCES) + +# Strip C/C++ flags from QMAKE_OBJECTIVE_CFLAGS just in case +QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS + +# Add Objective-C/C++ flags to C/C++ flags, the compiler can handle it +QMAKE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS +QMAKE_CXXFLAGS += $$QMAKE_OBJECTIVE_CFLAGS +unset(QMAKE_OBJECTIVE_CFLAGS) diff --git a/src/shared/proparser/proparser.pri b/src/shared/proparser/proparser.pri index a3667e5291..53ab86cf57 100644 --- a/src/shared/proparser/proparser.pri +++ b/src/shared/proparser/proparser.pri @@ -29,4 +29,4 @@ SOURCES += \ ioutils.cpp RESOURCES += proparser.qrc -DEFINES += QMAKE_BUILTIN_PRFS +DEFINES += QMAKE_BUILTIN_PRFS QMAKE_OVERRIDE_PRFS diff --git a/src/shared/proparser/proparser.qrc b/src/shared/proparser/proparser.qrc index 9193eaa31c..10f360fa49 100644 --- a/src/shared/proparser/proparser.qrc +++ b/src/shared/proparser/proparser.qrc @@ -3,4 +3,7 @@ <file>spec_pre.prf</file> <file>spec_post.prf</file> </qresource> + <qresource prefix="/qmake/override_features" > + <file>objective_c.prf</file> + </qresource> </RCC> diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 19e9f8b232..5e318b170d 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1953,23 +1953,34 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( // needs to be determined. Failed lookups are represented via non-null empty strings. QString *fnp = &m_featureRoots->cache[qMakePair(fn, currFn)]; if (fnp->isNull()) { - int start_root = 0; - const QStringList &paths = m_featureRoots->paths; - if (!currFn.isEmpty()) { - QStringRef currPath = IoUtils::pathName(currFn); - for (int root = 0; root < paths.size(); ++root) - if (currPath == paths.at(root)) { - start_root = root + 1; - break; - } - } - for (int root = start_root; root < paths.size(); ++root) { - QString fname = paths.at(root) + fn; - if (IoUtils::exists(fname)) { - fn = fname; +#ifdef QMAKE_OVERRIDE_PRFS + { + QString ovrfn(QLatin1String(":/qmake/override_features/") + fn); + if (QFileInfo::exists(ovrfn)) { + fn = ovrfn; goto cool; } } +#endif + { + int start_root = 0; + const QStringList &paths = m_featureRoots->paths; + if (!currFn.isEmpty()) { + QStringRef currPath = IoUtils::pathName(currFn); + for (int root = 0; root < paths.size(); ++root) + if (currPath == paths.at(root)) { + start_root = root + 1; + break; + } + } + for (int root = start_root; root < paths.size(); ++root) { + QString fname = paths.at(root) + fn; + if (IoUtils::exists(fname)) { + fn = fname; + goto cool; + } + } + } #ifdef QMAKE_BUILTIN_PRFS fn.prepend(QLatin1String(":/qmake/features/")); if (QFileInfo::exists(fn)) |