aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/clang/clang_defines.pri3
-rw-r--r--src/shared/clang/clang_installation.pri28
-rw-r--r--src/shared/proparser/qmakeglobals.cpp64
-rw-r--r--src/shared/proparser/qmakeglobals.h2
-rw-r--r--src/shared/proparser/qmakevfs.cpp20
-rw-r--r--src/shared/proparser/qmakevfs.h11
m---------src/shared/qbs0
7 files changed, 91 insertions, 37 deletions
diff --git a/src/shared/clang/clang_defines.pri b/src/shared/clang/clang_defines.pri
new file mode 100644
index 00000000000..e1d219989f0
--- /dev/null
+++ b/src/shared/clang/clang_defines.pri
@@ -0,0 +1,3 @@
+DEFINES += CLANG_VERSION=\\\"$${LLVM_VERSION}\\\"
+CLANG_RESOURCE_DIR=$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)
+DEFINES += "\"CLANG_RESOURCE_DIR=\\\"$${CLANG_RESOURCE_DIR}\\\"\""
diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri
index 9c7c3ce85fe..1eb605a1cfe 100644
--- a/src/shared/clang/clang_installation.pri
+++ b/src/shared/clang/clang_installation.pri
@@ -64,8 +64,9 @@ defineReplace(findClangOnWindows) {
}
CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
- -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangASTMatchers \
- -lclangToolingCore -lclangAST -lclangLex -lclangBasic
+ -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
+ -lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic
+win32:CLANGTOOLING_LIBS += -lversion
BIN_EXTENSION =
win32: BIN_EXTENSION = .exe
@@ -91,15 +92,30 @@ isEmpty(CLANG_LIB): error("Cannot find Clang shared library in $$LLVM_LIBDIR")
!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBCLANG_LIBS = -L$${LLVM_LIBDIR}
LIBCLANG_LIBS += $${CLANG_LIB}
-!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBTOOLING_LIBS = -L$${LLVM_LIBDIR}
-LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS
-contains(QMAKE_DEFAULT_INCDIRS, $$LLVM_INCLUDEPATH): LLVM_INCLUDEPATH =
+
+QTC_NO_CLANG_LIBTOOLING=$$(QTC_NO_CLANG_LIBTOOLING)
+isEmpty(QTC_NO_CLANG_LIBTOOLING) {
+ !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): LIBTOOLING_LIBS = -L$${LLVM_LIBDIR}
+ LIBTOOLING_LIBS += $$CLANGTOOLING_LIBS $$LLVM_STATIC_LIBS
+ contains(QMAKE_DEFAULT_INCDIRS, $$LLVM_INCLUDEPATH): LLVM_INCLUDEPATH =
+} else {
+ warning("Clang LibTooling is disabled.")
+}
isEmpty(LLVM_VERSION): error("Cannot determine clang version at $$LLVM_INSTALL_DIR")
!versionIsAtLeast($$LLVM_VERSION, 3, 9, 0): {
error("LLVM/Clang version >= 3.9.0 required, version provided: $$LLVM_VERSION")
}
-unix:LLVM_CXXFLAGS = -fno-rtti -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
+LLVM_CXXFLAGS = $$system($$llvm_config --cxxflags, lines)
+LLVM_CXXFLAGS ~= s,-fno-exceptions,
+LLVM_CXXFLAGS ~= s,-std=c++11,
+LLVM_CXXFLAGS ~= s,-std=c++0x,
+LLVM_CXXFLAGS ~= s,-O2,
+LLVM_CXXFLAGS ~= s,/W4,
+LLVM_CXXFLAGS ~= s,/EHc-,
+LLVM_CXXFLAGS ~= s,-Werror=date-time,
+# split-dwarf needs objcopy which does not work via icecc out-of-the-box
+LLVM_CXXFLAGS ~= s,-gsplit-dwarf,
LLVM_IS_COMPILED_WITH_RTTI = $$system($$llvm_config --has-rtti, lines)
diff --git a/src/shared/proparser/qmakeglobals.cpp b/src/shared/proparser/qmakeglobals.cpp
index f3600b33e0e..3511320c8f7 100644
--- a/src/shared/proparser/qmakeglobals.cpp
+++ b/src/shared/proparser/qmakeglobals.cpp
@@ -324,6 +324,13 @@ bool QMakeGlobals::initProperties()
QT_PCLOSE(proc);
}
#endif
+ parseProperties(data, properties);
+ return true;
+}
+#endif
+
+void QMakeGlobals::parseProperties(const QByteArray &data, QHash<ProKey, ProString> &properties)
+{
const auto lines = data.split('\n');
for (QByteArray line : lines) {
int off = line.indexOf(':');
@@ -334,47 +341,46 @@ bool QMakeGlobals::initProperties()
QString name = QString::fromLatin1(line.left(off));
ProString value = ProString(QDir::fromNativeSeparators(
QString::fromLocal8Bit(line.mid(off + 1))));
+ if (value.isNull())
+ value = ProString(""); // Make sure it is not null, to discern from missing keys
properties.insert(ProKey(name), value);
if (name.startsWith(QLatin1String("QT_"))) {
- bool plain = !name.contains(QLatin1Char('/'));
- if (!plain) {
- if (!name.endsWith(QLatin1String("/get")))
+ enum { PropPut, PropRaw, PropGet } variant;
+ if (name.contains(QLatin1Char('/'))) {
+ if (name.endsWith(QLatin1String("/raw")))
+ variant = PropRaw;
+ else if (name.endsWith(QLatin1String("/get")))
+ variant = PropGet;
+ else // Nothing falls back on /src.
continue;
name.chop(4);
+ } else {
+ variant = PropPut;
}
if (name.startsWith(QLatin1String("QT_INSTALL_"))) {
- if (plain) {
- properties.insert(ProKey(name + QLatin1String("/raw")), value);
- properties.insert(ProKey(name + QLatin1String("/get")), value);
- }
- properties.insert(ProKey(name + QLatin1String("/src")), value);
- if (name == QLatin1String("QT_INSTALL_PREFIX")
- || name == QLatin1String("QT_INSTALL_DATA")
- || name == QLatin1String("QT_INSTALL_BINS")) {
- name.replace(3, 7, QLatin1String("HOST"));
- if (plain) {
- properties.insert(ProKey(name), value);
- properties.insert(ProKey(name + QLatin1String("/get")), value);
+ if (variant < PropRaw) {
+ if (name == QLatin1String("QT_INSTALL_PREFIX")
+ || name == QLatin1String("QT_INSTALL_DATA")
+ || name == QLatin1String("QT_INSTALL_LIBS")
+ || name == QLatin1String("QT_INSTALL_BINS")) {
+ // Qt4 fallback
+ QString hname = name;
+ hname.replace(3, 7, QLatin1String("HOST"));
+ properties.insert(ProKey(hname), value);
+ properties.insert(ProKey(hname + QLatin1String("/get")), value);
+ properties.insert(ProKey(hname + QLatin1String("/src")), value);
}
- properties.insert(ProKey(name + QLatin1String("/src")), value);
+ properties.insert(ProKey(name + QLatin1String("/raw")), value);
}
- } else if (name.startsWith(QLatin1String("QT_HOST_"))) {
- if (plain)
- properties.insert(ProKey(name + QLatin1String("/get")), value);
- properties.insert(ProKey(name + QLatin1String("/src")), value);
+ } else if (!name.startsWith(QLatin1String("QT_HOST_"))) {
+ continue;
}
+ if (variant < PropGet)
+ properties.insert(ProKey(name + QLatin1String("/get")), value);
+ properties.insert(ProKey(name + QLatin1String("/src")), value);
}
}
- return true;
}
-#else
-void QMakeGlobals::setProperties(const QHash<QString, QString> &props)
-{
- QHash<QString, QString>::ConstIterator it = props.constBegin(), eit = props.constEnd();
- for (; it != eit; ++it)
- properties.insert(ProKey(it.key()), ProString(it.value()));
-}
-#endif
#endif // QT_BUILD_QMAKE
QT_END_NAMESPACE
diff --git a/src/shared/proparser/qmakeglobals.h b/src/shared/proparser/qmakeglobals.h
index 9942113681b..98b269a30a2 100644
--- a/src/shared/proparser/qmakeglobals.h
+++ b/src/shared/proparser/qmakeglobals.h
@@ -123,10 +123,10 @@ public:
void setQMakeProperty(QMakeProperty *prop) { property = prop; }
ProString propertyValue(const ProKey &name) const { return property->value(name); }
#else
+ static void parseProperties(const QByteArray &data, QHash<ProKey, ProString> &props);
# ifdef PROEVALUATOR_INIT_PROPS
bool initProperties();
# else
- void setProperties(const QHash<QString, QString> &props);
void setProperties(const QHash<ProKey, ProString> &props) { properties = props; }
# endif
ProString propertyValue(const ProKey &name) const { return properties.value(name); }
diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp
index 6115a024572..4dd1192aff7 100644
--- a/src/shared/proparser/qmakevfs.cpp
+++ b/src/shared/proparser/qmakevfs.cpp
@@ -32,6 +32,10 @@ using namespace QMakeInternal;
#include <qfile.h>
#include <qfileinfo.h>
+#ifndef QT_NO_TEXTCODEC
+#include <qtextcodec.h>
+#endif
+
#define fL1S(s) QString::fromLatin1(s)
QT_BEGIN_NAMESPACE
@@ -42,6 +46,9 @@ QMakeVfs::QMakeVfs()
, m_magicExisting(fL1S("existing"))
#endif
{
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec = 0;
+#endif
}
bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, VfsFlags flags,
@@ -184,7 +191,11 @@ QMakeVfs::ReadResult QMakeVfs::readFile(
*errStr = fL1S("Unexpected UTF-8 BOM");
return ReadOtherError;
}
- *contents = QString::fromLocal8Bit(bcont);
+ *contents =
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec ? m_textCodec->toUnicode(bcont) :
+#endif
+ QString::fromLocal8Bit(bcont);
return ReadOk;
}
@@ -242,4 +253,11 @@ void QMakeVfs::invalidateContents()
}
#endif
+#ifndef QT_NO_TEXTCODEC
+void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
+{
+ m_textCodec = textCodec;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/shared/proparser/qmakevfs.h b/src/shared/proparser/qmakevfs.h
index 02c0a6406b4..b6b93fb5dd5 100644
--- a/src/shared/proparser/qmakevfs.h
+++ b/src/shared/proparser/qmakevfs.h
@@ -36,6 +36,10 @@
# endif
#endif
+#ifndef QT_NO_TEXTCODEC
+QT_FORWARD_DECLARE_CLASS(QTextCodec)
+#endif
+
#ifdef PROEVALUATOR_DUAL_VFS
# ifndef PROEVALUATOR_CUMULATIVE
# error PROEVALUATOR_DUAL_VFS requires PROEVALUATOR_CUMULATIVE
@@ -79,6 +83,10 @@ public:
void invalidateContents();
#endif
+#ifndef QT_NO_TEXTCODEC
+ void setTextCodec(const QTextCodec *textCodec);
+#endif
+
private:
#ifndef PROEVALUATOR_FULL
# ifdef PROEVALUATOR_THREAD_SAFE
@@ -88,6 +96,9 @@ private:
QString m_magicMissing;
QString m_magicExisting;
#endif
+#ifndef QT_NO_TEXTCODEC
+ const QTextCodec *m_textCodec;
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeVfs::VfsFlags)
diff --git a/src/shared/qbs b/src/shared/qbs
-Subproject 3fec40fad03aa1c4c7bb85a435c6aa9abe3a6bb
+Subproject 3f76c27847c157a0292a4caf73617f7d1d86ede