From a162a3cbbc3c27b42c86f870aba051a408f04ed4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 23 Apr 2014 16:26:26 +0200 Subject: Android: Add "unversioned_libname" configuration On Android, there's a limitation set on the names of the libraries you deploy that they must start with "lib" and end with ".so", so Android apps will link against and deploy with the unversioned libQt5FooBar.so libraries. When cross-compiling on Windows however, due to the lack of symbolic links, the only installed library used to be the main library target "libQt5FooBar.so.X.Y.Z" (for version X.Y.Z.) This has been worked around in packaging, but breaks building add-on modules on top of Qt, and is clearly wrong. This patch introduces a new "unversioned_libname" configuration in qmake which is currently only supported for the Unix makefile generator and only enabled for Android builds. When it is enabled, only the unversioned library "libQt5FooBar.so" will be created. Task-number: QTBUG-38347 Change-Id: Ia8897ca7a23a62e2a526d0e02854899b02eb19dc Reviewed-by: Oswald Buddenhagen --- qmake/generators/unix/unixmake.cpp | 4 ++- qmake/generators/unix/unixmake2.cpp | 70 ++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 25 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 4c3df4efe8..5ea47cc867 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -749,7 +749,9 @@ UnixMakefileGenerator::defaultInstall(const QString &t) target = "$(QMAKE_TARGET)"; } else if(project->first("TEMPLATE") == "lib") { if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) { - if(!project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin")) { + if (!project->isActiveConfig("staticlib") + && !project->isActiveConfig("plugin") + && !project->isActiveConfig("unversioned_libname")) { if(project->isEmpty("QMAKE_HPUX_SHLIB")) { links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; } else { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 6e08c138ed..a28760015e 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -234,14 +234,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->isEmpty("QMAKE_BUNDLE")) { t << "TARGETD = " << escapeFilePath(var("TARGET_x.y")) << endl; t << "TARGET0 = " << escapeFilePath(var("TARGET_")) << endl; - } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { - t << "TARGETD = " << escapeFilePath(var("TARGET_x.y.z")) << endl; - t << "TARGET0 = " << escapeFilePath(var("TARGET_")) << endl; - t << "TARGET1 = " << escapeFilePath(var("TARGET_x")) << endl; - t << "TARGET2 = " << escapeFilePath(var("TARGET_x.y")) << endl; - } else { - t << "TARGETD = " << escapeFilePath(var("TARGET_x")) << endl; + } else if (!project->isActiveConfig("unversioned_libname")) { t << "TARGET0 = " << escapeFilePath(var("TARGET_")) << endl; + if (project->isEmpty("QMAKE_HPUX_SHLIB")) { + t << "TARGETD = " << escapeFilePath(var("TARGET_x.y.z")) << endl; + t << "TARGET1 = " << escapeFilePath(var("TARGET_x")) << endl; + t << "TARGET2 = " << escapeFilePath(var("TARGET_x.y")) << endl; + } else { + t << "TARGETD = " << escapeFilePath(var("TARGET_x")) << endl; + } } } writeExtraCompilerVariables(t); @@ -574,22 +575,36 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { - t << "\n\t" - << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)\n\t" - << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; - t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" - << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" - << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); - if(!destdir.isEmpty()) + t << "\n\t"; + + if (!project->isActiveConfig("unversioned_libname")) + t << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)"; + else + t << "-$(DEL_FILE) $(TARGET)"; + + t << "\n\t" << var("QMAKE_LINK_SHLIB_CMD"); + + if (!project->isActiveConfig("unversioned_libname")) { + t << "\n\t" + << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" + << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" + << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); + } + if (!destdir.isEmpty()) { t << "\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" - << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" - << "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t" - << "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t" - << "-$(MOVE) $(TARGET) " << destdir << " \n\t" - << "-$(MOVE) $(TARGET0) " << destdir << " \n\t" - << "-$(MOVE) $(TARGET1) " << destdir << " \n\t" - << "-$(MOVE) $(TARGET2) " << destdir << " \n\t"; + << "-$(MOVE) $(TARGET) " << destdir << " "; + + if (!project->isActiveConfig("unversioned_libname")) { + t << "\n\t" + << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" + << "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t" + << "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t" + << "-$(MOVE) $(TARGET0) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET1) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET2) " << destdir << " "; + } + } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -924,8 +939,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; - t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " - << destdir << "$(TARGET2) $(TARGETA)\n"; + if (!project->isActiveConfig("unversioned_libname")) { + t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " + << destdir << "$(TARGET2) $(TARGETA)\n"; + } else { + t << "\t-$(DEL_FILE) $(TARGETA)\n"; + } } else { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; } @@ -1165,7 +1184,10 @@ void UnixMakefileGenerator::init2() project->first("VER_MIN") + "." + project->first("VER_PAT")); } - project->values("TARGET") = project->values("TARGET_x.y.z"); + if (project->isActiveConfig("unversioned_libname")) + project->values("TARGET") = project->values("TARGET_"); + else + project->values("TARGET") = project->values("TARGET_x.y.z"); } if(project->isEmpty("QMAKE_LN_SHLIB")) project->values("QMAKE_LN_SHLIB").append("ln -s"); -- cgit v1.2.3 From c1625ef8237cff4d313a07ac7091a50c9444a106 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 23 Apr 2014 08:54:12 +0300 Subject: Fix vcxproj generation on Windows Phone f412f2b5 refactored the platform tool set retrieval, but made the call too early to choose the right tool set on Windows Phone. This fixes the call so that it does not depend on the WinPhone member variable, and also makes it forward-compatible with Windows Phone 8.1. Task-number: QTBUG-38516 Change-Id: Ide91563f5c7f909c4d1a258adc29af6c94595dc9 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_vcproj.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index ac258e2841..2bd3301e16 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -397,8 +397,8 @@ QString VcprojGenerator::retrievePlatformToolSet() const return envVar; QString suffix; - if (vcProject.Configuration.WinPhone) - suffix = "_wp80"; + if (project->isActiveConfig("winphone")) + suffix = '_' + project->first("WINTARGET_VER").toQString().toLower(); else if (project->first("QMAKE_TARGET_OS") == "xp") suffix = "_xp"; -- cgit v1.2.3