summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-11 18:01:13 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-11 18:10:41 +0100
commitf4d8cafc1b034f544ca84b849c23ab99bc1600e7 (patch)
treef1150b5aeaec4753f2ddfcd17643666b3a82dd9d /qmake
parente5b422382a512a8267a0eb24e6543a8cf84478d9 (diff)
parentb03133231b99922a72831c4ec23faf55516ef404 (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/3rdparty/harfbuzz-ng/src/hb-private.hh src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/sql/doc/src/sql-driver.qdoc Change-Id: I38f0e82fcd37926cbf3c1915e009a731040d4598
Diffstat (limited to 'qmake')
-rw-r--r--qmake/doc/src/qmake-manual.qdoc59
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--qmake/generators/unix/unixmake2.cpp64
-rw-r--r--qmake/generators/win32/mingw_make.cpp3
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp29
-rw-r--r--qmake/generators/win32/msvc_nmake.h2
6 files changed, 126 insertions, 33 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index a4e28b4d0c..16b498d36e 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -939,6 +939,8 @@
order in which they are given.
\row \li precompile_header \li Enables support for the use of
\l{Using Precompiled Headers}{precompiled headers} in projects.
+ \row \li precompile_header_c (MSVC only) \li Enables support for the use of
+ \l{Using Precompiled Headers}{precompiled headers} for C files.
\row \li warn_on \li The compiler should output as many warnings as possible.
If \c warn_off is also specified, the last one takes effect.
\row \li warn_off \li The compiler should output as few warnings as possible.
@@ -1821,9 +1823,55 @@
Specifies the name of the property list file, \c{.plist}, you
would like to include in your \macos, iOS, tvOS, and watchOS application bundle.
- In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@,
- which qmake will replace with the actual executable name. Other variables
- include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@.
+ In the \c{.plist} file, you can define some variables which
+ qmake will replace with the relevant values:
+
+ \table
+ \header
+ \li Placeholder(s)
+ \li Effect
+ \row
+ \li \c ${PRODUCT_BUNDLE_IDENTIFIER}, \c @BUNDLEIDENTIFIER@
+ \li Expands to the target bundle's bundle identifier string,
+ for example: \c{com.example.myapp}. Determined by concatenating the
+ values of QMAKE_TARGET_BUNDLE_PREFIX and QMAKE_BUNDLE, separated
+ by a full stop (\c{.}).
+ \row
+ \li \c ${EXECUTABLE_NAME}, \c @EXECUTABLE@, \c @LIBRARY@
+ \li Equivalent to the value of QMAKE_APPLICATION_BUNDLE_NAME,
+ QMAKE_PLUGIN_BUNDLE_NAME, or QMAKE_FRAMEWORK_BUNDLE_NAME
+ (depending on the type of target being created),
+ or TARGET if none of the previous values are set.
+ \row
+ \li \c ${ASSETCATALOG_COMPILER_APPICON_NAME}, \c @ICON@
+ \li Expands to the value of ICON.
+ \row
+ \li \c ${QMAKE_PKGINFO_TYPEINFO}, \c @TYPEINFO@
+ \li Expands to the value of QMAKE_PKGINFO_TYPEINFO.
+ \row
+ \li \c ${QMAKE_FULL_VERSION}, \c @FULL_VERSION@
+ \li Expands to the value of VERSION expressed with three version components.
+ \row
+ \li \c ${QMAKE_SHORT_VERSION}, \c @SHORT_VERSION@
+ \li Expands to the value of VERSION expressed with two version components.
+ \row
+ \li \c ${MACOSX_DEPLOYMENT_TARGET}
+ \li Expands to the value of QMAKE_MACOSX_DEPLOYMENT_TARGET.
+ \row
+ \li \c ${IPHONEOS_DEPLOYMENT_TARGET}
+ \li Expands to the value of QMAKE_IPHONEOS_DEPLOYMENT_TARGET.
+ \row
+ \li \c ${TVOS_DEPLOYMENT_TARGET}
+ \li Expands to the value of QMAKE_TVOS_DEPLOYMENT_TARGET.
+ \row
+ \li \c ${WATCHOS_DEPLOYMENT_TARGET}
+ \li Expands to the value of QMAKE_WATCHOS_DEPLOYMENT_TARGET.
+ \endtable
+
+ \note When using the Xcode generator, the above \c{${var}}-style
+ placeholders are replaced directly by the Xcode build system and are not
+ handled by qmake. The \c{@var@} style placeholders work only with the qmake
+ Makefile generators and not with the Xcode generator.
If building for iOS, and the \c{.plist} file contains the key
\c NSPhotoLibraryUsageDescription, qmake will include an additional plugin
@@ -4577,6 +4625,11 @@
\snippet code/doc_src_qmake-manual.pro 106
+ To use the precompiled header also for C files on MSVC nmake target, add
+ \c precompile_header_c to the \l{CONFIG} variable. If the header is
+ used also for C++ and it contains C++ keywords/includes, enclose them
+ with \c{#ifdef __cplusplus}).
+
\section1 Notes on Possible Issues
On some platforms, the file name suffix for precompiled header files is
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 0622ace71b..db7a1b2714 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -279,7 +279,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
QString configName = (as_release ? "Release" : "Debug");
QMap<QString, QString> settings;
- settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
{
@@ -1493,7 +1492,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
settings.insert("PROVISIONING_PROFILE_SPECIFIER", project->first("QMAKE_PROVISIONING_PROFILE").toQString());
}
- settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index f7097e58dc..8ecfa0bf31 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -155,6 +155,20 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
}
}
+static QString rfc1034Identifier(const QString &str)
+{
+ QString s = str;
+ for (QChar &ch : s) {
+ const char c = ch.toLatin1();
+
+ const bool okChar = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z')
+ || (c >= 'a' && c <= 'z') || c == '-' || c == '.';
+ if (!okChar)
+ ch = QChar::fromLatin1('-');
+ }
+ return s;
+}
+
void
UnixMakefileGenerator::writeMakeParts(QTextStream &t)
{
@@ -806,14 +820,23 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << mkdir_p_asstring(destdir) << "\n\t";
ProStringList commonSedArgs;
if (!project->values("VERSION").isEmpty()) {
- commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "."
- << project->first("VER_MIN") << ",g\" ";
- commonSedArgs << "-e \"s,@FULL_VERSION@," << project->first("VER_MAJ") << "."
- << project->first("VER_MIN") << "."
- << project->first("VER_PAT") << ",g\" ";
+ const ProString shortVersion =
+ project->first("VER_MAJ") + "." +
+ project->first("VER_MIN");
+ commonSedArgs << "-e \"s,@SHORT_VERSION@," << shortVersion << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${QMAKE_SHORT_VERSION}," << shortVersion << ",g\" ";
+ const ProString fullVersion =
+ project->first("VER_MAJ") + "." +
+ project->first("VER_MIN") + "." +
+ project->first("VER_PAT");
+ commonSedArgs << "-e \"s,@FULL_VERSION@," << fullVersion << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${QMAKE_FULL_VERSION}," << fullVersion << ",g\" ";
}
- commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
+ const ProString typeInfo = project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
+ ? QString::fromLatin1("????")
+ : project->first("QMAKE_PKGINFO_TYPEINFO").left(4);
+ commonSedArgs << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" ";
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
if (bundlePrefix.isEmpty())
@@ -826,8 +849,18 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (bundleIdentifier.endsWith(".framework"))
bundleIdentifier.chop(10);
// replace invalid bundle id characters
- bundleIdentifier.replace('_', '-');
+ bundleIdentifier = rfc1034Identifier(bundleIdentifier);
commonSedArgs << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${PRODUCT_BUNDLE_IDENTIFIER}," << bundleIdentifier << ",g\" ";
+
+ commonSedArgs << "-e \"s,\\$${MACOSX_DEPLOYMENT_TARGET},"
+ << project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET").toQString() << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${IPHONEOS_DEPLOYMENT_TARGET},"
+ << project->first("QMAKE_IPHONEOS_DEPLOYMENT_TARGET").toQString() << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${TVOS_DEPLOYMENT_TARGET},"
+ << project->first("QMAKE_TVOS_DEPLOYMENT_TARGET").toQString() << ",g\" ";
+ commonSedArgs << "-e \"s,\\$${WATCHOS_DEPLOYMENT_TARGET},"
+ << project->first("QMAKE_WATCHOS_DEPLOYMENT_TARGET").toQString() << ",g\" ";
if (!isFramework) {
ProString app_bundle_name = var("QMAKE_APPLICATION_BUNDLE_NAME");
@@ -843,11 +876,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "@sed ";
for (const ProString &arg : qAsConst(commonSedArgs))
t << arg;
- t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
+ const QString iconName = icon.section(Option::dir_sep, -1);
+ t << "-e \"s,@ICON@," << iconName << ",g\" "
+ << "-e \"s,\\$${ASSETCATALOG_COMPILER_APPICON_NAME}," << iconName << ",g\" "
<< "-e \"s,@EXECUTABLE@," << app_bundle_name << ",g\" "
<< "-e \"s,@LIBRARY@," << plugin_bundle_name << ",g\" "
- << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
+ << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" "
+ << "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" "
+ << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" "
<< "" << info_plist << " >" << info_plist_out << endl;
//copy the icon
if (!project->isEmpty("ICON")) {
@@ -873,9 +909,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for (const ProString &arg : qAsConst(commonSedArgs))
t << arg;
t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" "
- << "-e \"s,@TYPEINFO@,"
- << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
- QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
+ << "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" "
+ << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" "
+ << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" "
<< "" << info_plist << " >" << info_plist_out << endl;
}
break;
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 792ffb1997..d6d6b04148 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -324,7 +324,8 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
t << "\n\t" <<var("QMAKE_PRE_LINK");
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE");
- if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
+ const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
+ if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {
t << "\n\t" << objectsLinkLine << " " ;
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index b4c2579c5c..ccc2ea6d2b 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -51,7 +51,7 @@ static QString nmakePathList(const QStringList &list)
.replace('#', QLatin1String("^#")).replace('$', QLatin1String("$$"));
}
-NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), usePCH(false)
+NmakeMakefileGenerator::NmakeMakefileGenerator() : usePCH(false), usePCHC(false)
{
}
@@ -324,6 +324,8 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
<< escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t")
<< "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP "
<< escapeFilePath(precompH) << endl << endl;
+ }
+ if (usePCHC) {
QString precompRuleC = QString("-c -Yc -Fp%1 -Fo%2")
.arg(escapeFilePath(precompPchC), escapeFilePath(precompObjC));
t << escapeDependencyPath(precompObjC) << ": " << escapeDependencyPath(precompH) << ' '
@@ -335,14 +337,14 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QString NmakeMakefileGenerator::var(const ProKey &value) const
{
- if (usePCH) {
+ if (usePCH || usePCHC) {
const bool isRunC = (value == "QMAKE_RUN_CC_IMP_BATCH"
|| value == "QMAKE_RUN_CC_IMP"
|| value == "QMAKE_RUN_CC");
- if (isRunC
- || value == "QMAKE_RUN_CXX_IMP_BATCH"
- || value == "QMAKE_RUN_CXX_IMP"
- || value == "QMAKE_RUN_CXX") {
+ const bool isRunCpp = (value == "QMAKE_RUN_CXX_IMP_BATCH"
+ || value == "QMAKE_RUN_CXX_IMP"
+ || value == "QMAKE_RUN_CXX");
+ if ((isRunCpp && usePCH) || (isRunC && usePCHC)) {
QFileInfo precompHInfo(fileInfo(precompH));
QString precompH_f = escapeFilePath(precompHInfo.fileName());
QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3")
@@ -410,21 +412,24 @@ void NmakeMakefileGenerator::init()
// Setup PCH variables
precompH = project->first("PRECOMPILED_HEADER").toQString();
usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
+ usePCHC = !precompH.isEmpty() && project->isActiveConfig("precompile_header_c");
if (usePCH) {
// Created files
precompObj = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext;
precompPch = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch.pch";
- precompObjC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c" + Option::obj_ext;
- precompPchC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c.pch";
// Add linking of precompObj (required for whole precompiled classes)
- project->values("OBJECTS") += precompObj;
- project->values("OBJECTS") += precompObjC;
+ project->values("OBJECTS") += precompObj;
// Add pch file to cleanup
- project->values("QMAKE_CLEAN") += precompPch;
- project->values("QMAKE_CLEAN") += precompPchC;
+ project->values("QMAKE_CLEAN") += precompPch;
// Return to variable pool
project->values("PRECOMPILED_OBJECT") = ProStringList(precompObj);
project->values("PRECOMPILED_PCH") = ProStringList(precompPch);
+ }
+ if (usePCHC) {
+ precompObjC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c" + Option::obj_ext;
+ precompPchC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c.pch";
+ project->values("OBJECTS") += precompObjC;
+ project->values("QMAKE_CLEAN") += precompPchC;
project->values("PRECOMPILED_OBJECT_C") = ProStringList(precompObjC);
project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC);
}
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index 4b0935bb66..67b609d0a6 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -53,7 +53,7 @@ protected:
QString var(const ProKey &value) const;
QString precompH, precompObj, precompPch;
QString precompObjC, precompPchC;
- bool usePCH;
+ bool usePCH, usePCHC;
public:
NmakeMakefileGenerator();