diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-10-15 13:23:13 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-19 15:25:54 +0100 |
commit | df3631045c35aaed0b9de4ae5e643c8019972d13 (patch) | |
tree | 9e4c1bc3489d7e88ccc164f6d6c76142bcad483e | |
parent | 36270e45058b84c2fc3cb9683278983eedea3a1b (diff) |
Add a new location for QML 2.x imports
This commits adds a -qmldir configuration option for the configures to
allow the user to change the default location (it defaults to
$archdatadir/qml).
It adds a QLibraryInfo::Qml2ImportsPath value for
QLibraryInfo::location, a qmake property of QT_INSTALL_QML and a qt.conf
configure location entry "Qml2Imports".
At the same time, it makes the qmake .prf files dealing with QML plugins
be the QML 2 version. Those files are new in Qt 5, so we have the option
to choose which version we want to use.
Discussed-on: http://lists.qt-project.org/pipermail/development/2012-October/007136.html
Change-Id: I8c1c53e8685a5934ed0a9a42ba5663297b81a677
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
-rwxr-xr-x | configure | 17 | ||||
-rw-r--r-- | mkspecs/features/qml_module.prf | 4 | ||||
-rw-r--r-- | mkspecs/features/qml_plugin.prf | 10 | ||||
-rw-r--r-- | mkspecs/features/qt_config.prf | 2 | ||||
-rw-r--r-- | mkspecs/features/qt_module.prf | 3 | ||||
-rw-r--r-- | mkspecs/features/qt_module_fwdpri.prf | 3 | ||||
-rw-r--r-- | qmake/property.cpp | 1 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 13 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.h | 2 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 15 |
10 files changed, 58 insertions, 12 deletions
@@ -884,6 +884,7 @@ QT_INSTALL_LIBS= QT_INSTALL_BINS= QT_INSTALL_PLUGINS= QT_INSTALL_IMPORTS= +QT_INSTALL_QML= QT_INSTALL_ARCHDATA= QT_INSTALL_DATA= QT_INSTALL_TRANSLATIONS= @@ -993,7 +994,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style options that pass an argument - -prefix|-docdir|-headerdir|-plugindir|-importdir|-archdatadir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1208,6 +1209,9 @@ while [ "$#" -gt 0 ]; do importdir) QT_INSTALL_IMPORTS="$VAL" ;; + qmldir) + QT_INSTALL_QML="$VAL" + ;; archdatadir) QT_INSTALL_ARCHDATA="$VAL" ;; @@ -2816,6 +2820,12 @@ if [ -z "$QT_INSTALL_IMPORTS" ]; then #default fi QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"` +#qml +if [ -z "$QT_INSTALL_QML" ]; then #default + QT_INSTALL_QML="$QT_INSTALL_ARCHDATA/qml" #fallback +fi +QT_INSTALL_QML=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_QML"` + if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default QT_INSTALL_TRANSLATIONS="$QT_INSTALL_DATA/translations" #fallback fi @@ -3012,8 +3022,10 @@ Installation options: (default PREFIX) -plugindir <dir> ...... Plugins will be installed to <dir> (default ARCHDATADIR/plugins) - -importdir <dir> ...... Imports for QML will be installed to <dir> + -importdir <dir> ...... Imports for QML1 will be installed to <dir> (default ARCHDATADIR/imports) + -qmldir <dir> ......... Imports for QML2 will be installed to <dir> + (default ARCHDATADIR/qml) -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir> (default PREFIX) -docdir <dir> ......... Documentation will be installed to <dir> @@ -3497,6 +3509,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = { "qt_binspath=$QT_INSTALL_BINS", "qt_plugpath=$QT_INSTALL_PLUGINS", "qt_impspath=$QT_INSTALL_IMPORTS", + "qt_qml2path=$QT_INSTALL_QML", "qt_adatpath=$QT_INSTALL_ARCHDATA", "qt_datapath=$QT_INSTALL_DATA", "qt_trnspath=$QT_INSTALL_TRANSLATIONS", diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index 03ef88221e..a452592c9b 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -10,9 +10,9 @@ for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_) OTHER_FILES += $$fq_qml_files qml1_target: \ - instbase = $$[QT_INSTALL_IMPORTS]/QtDeclarative -else: \ instbase = $$[QT_INSTALL_IMPORTS] +else: \ + instbase = $$[QT_INSTALL_QML] exists($$[QT_HOST_PREFIX]/.qmake.cache) { # These bizarre rules copy the files to the qtbase build directory diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf index b938bf493e..c700dda41f 100644 --- a/mkspecs/features/qml_plugin.prf +++ b/mkspecs/features/qml_plugin.prf @@ -17,17 +17,19 @@ isEmpty(CXX_MODULE) { TARGET = declarative_$${TARGET} } isEmpty(TARGETPATH): TARGETPATH = $$eval(QT.$${CXX_MODULE}.name) -DESTDIR = $$eval(QT.$${CXX_MODULE}.imports)/$$TARGETPATH QMLTYPEFILE = $$_PRO_FILE_PWD_/plugins.qmltypes exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE # Install rules -qml1_target: \ - instbase = $$[QT_INSTALL_IMPORTS]/QtDeclarative -else: \ +qml1_target { + DESTDIR = $$eval(QT.$${CXX_MODULE}.imports)/$$TARGETPATH instbase = $$[QT_INSTALL_IMPORTS] +} else { + DESTDIR = $$eval(QT.$${CXX_MODULE}.qml)/$$TARGETPATH + instbase = $$[QT_INSTALL_QML] +} target.path = $$instbase/$$TARGETPATH INSTALLS += target diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf index 305ff1cb81..5d250ea346 100644 --- a/mkspecs/features/qt_config.prf +++ b/mkspecs/features/qt_config.prf @@ -21,6 +21,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS] QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS] QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS] + QT_MODULE_QML_BASE = $$[QT_INSTALL_QML] include($$mod) } } @@ -29,6 +30,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri unset(QT_MODULE_PLUGIN_BASE) unset(QT_MODULE_BIN_BASE) unset(QT_MODULE_IMPORT_BASE) + unset(QT_MODULE_QML_BASE) } load(qt_functions) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 0d004f29c8..85b89d568c 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -81,7 +81,8 @@ MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri "QT.$${MODULE}.libs = \$\$QT_MODULE_LIB_BASE" \ "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]" \ "QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \ - "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE$$MODULE_IMPORT_SUFFIX" \ + "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \ + "QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" \ "QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ $$module_privdep \ $$module_build_type \ diff --git a/mkspecs/features/qt_module_fwdpri.prf b/mkspecs/features/qt_module_fwdpri.prf index 33ceff1cd5..cd3aed9e0f 100644 --- a/mkspecs/features/qt_module_fwdpri.prf +++ b/mkspecs/features/qt_module_fwdpri.prf @@ -52,6 +52,7 @@ "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \ "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \ "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \ + "QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \ "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ $$module_rpathlink \ @@ -69,7 +70,7 @@ include($$MODULE_FWD_PRI) for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ name depends private_depends module_config CONFIG DEFINES sources \ - includes private_includes bins libs plugins imports \ + includes private_includes bins libs plugins imports qml \ )):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient) cache(QT_CONFIG, transient) diff --git a/qmake/property.cpp b/qmake/property.cpp index 35f0ba9e7b..8379b2a58c 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -65,6 +65,7 @@ static const struct { { "QT_INSTALL_TESTS", QLibraryInfo::TestsPath, false }, { "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, false }, { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, false }, + { "QT_INSTALL_QML", QLibraryInfo::Qml2ImportsPath, false }, { "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, false }, { "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false }, { "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, false }, diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 13d3a879c7..a756577311 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -257,6 +257,15 @@ QLibraryInfo::isDebugBuild() #endif // QT_BOOTSTRAPPED +/* + * To add a new entry in QLibrary::LibraryLocation, add it to the enum above the bootstrapped values and: + * - add its relative path in the qtConfEntries[] array below + * (the key is what appears in a qt.conf file) + * - add a property name in qmake/property.cpp propList[] array + * (it's used with qmake -query) + * - add to qt_config.prf, qt_module.prf, qt_module_fwdpri.prf + */ + static const struct { char key[14], value[13]; } qtConfEntries[] = { @@ -267,6 +276,7 @@ static const struct { { "Binaries", "bin" }, { "Plugins", "plugins" }, // should be ${ArchData}/plugins { "Imports", "imports" }, // should be ${ArchData}/imports + { "Qml2Imports", "qml" }, // should be ${ArchData}/qml { "ArchData", "." }, { "Data", "." }, { "Translations", "translations" }, // should be ${Data}/translations @@ -444,7 +454,8 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) \value LibrariesPath The location of installed libraries. \value BinariesPath The location of installed Qt binaries (tools and applications). \value PluginsPath The location of installed Qt plugins. - \value ImportsPath The location of installed QML extensions to import. + \value ImportsPath The location of installed QML extensions to import (QML 1.x). + \value Qml2ImportsPath The location of installed QML extensions to import (QML 2.x). \value ArchDataPath The location of general architecture-dependent Qt data. \value DataPath The location of general architecture-independent Qt data. \value TranslationsPath The location of translation information for Qt strings. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 7f035194ef..5d6e42965f 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -70,12 +70,14 @@ public: BinariesPath, PluginsPath, ImportsPath, + Qml2ImportsPath, ArchDataPath, DataPath, TranslationsPath, ExamplesPath, TestsPath, // Insert new values above this line + // Please read the comments in qlibraryinfo.cpp before adding #ifdef QT_BOOTSTRAPPED // These are not subject to binary compatibility constraints SysrootPath, diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 239060e4d2..a08989d157 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1067,6 +1067,14 @@ void Configure::parseCmdLine() break; dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i); } + + else if (configCmdLine.at(i) == "-qmldir") { + ++i; + if (i == argCount) + break; + dictionary[ "QT_INSTALL_QML" ] = configCmdLine.at(i); + } + else if (configCmdLine.at(i) == "-archdatadir") { ++i; if (i == argCount) @@ -1595,6 +1603,7 @@ bool Configure::displayHelp() desc( "-archdatadir <dir>", "Architecture-dependent data used by Qt will be installed to <dir>\n(default PREFIX)"); desc( "-plugindir <dir>", "Plugins will be installed to <dir>\n(default ARCHDATADIR/plugins)"); desc( "-importdir <dir>", "Imports for QML1 will be installed to <dir>\n(default ARCHDATADIR/imports)"); + desc( "-qmldir <dir>", "Imports for QML2 will be installed to <dir>\n(default ARCHDATADIR/qml)"); desc( "-datadir <dir>", "Data used by Qt programs will be installed to <dir>\n(default PREFIX)"); desc( "-docdir <dir>", "Documentation will be installed to <dir>\n(default DATADIR/doc)"); desc( "-translationdir <dir>", "Translations of Qt programs will be installed to <dir>\n(default DATADIR/translations)"); @@ -3414,7 +3423,8 @@ void Configure::displayConfig() sout << "Libraries installed to......" << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBS"]) << endl; sout << "Arch-dep. data to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_ARCHDATA"]) << endl; sout << "Plugins installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << endl; - sout << "Imports installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << endl; + sout << "QML1 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << endl; + sout << "QML2 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_QML"]) << endl; sout << "Binaries installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_BINS"]) << endl; sout << "Arch-indep. data to........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DATA"]) << endl; sout << "Docs installed to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DOCS"]) << endl; @@ -3550,6 +3560,8 @@ void Configure::generateQConfigCpp() dictionary["QT_INSTALL_PLUGINS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/plugins"; if (!dictionary["QT_INSTALL_IMPORTS"].size()) dictionary["QT_INSTALL_IMPORTS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/imports"; + if (!dictionary["QT_INSTALL_QML"].size()) + dictionary["QT_INSTALL_QML"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/qml"; if (!dictionary["QT_INSTALL_DATA"].size()) dictionary["QT_INSTALL_DATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"]; if (!dictionary["QT_INSTALL_DOCS"].size()) @@ -3597,6 +3609,7 @@ void Configure::generateQConfigCpp() << " \"qt_binspath=" << formatPath(dictionary["QT_INSTALL_BINS"]) << "\"," << endl << " \"qt_plugpath=" << formatPath(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl << " \"qt_impspath=" << formatPath(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl + << " \"qt_qml2path=" << formatPath(dictionary["QT_INSTALL_QML"]) << "\"," << endl << " \"qt_adatpath=" << formatPath(dictionary["QT_INSTALL_ARCHDATA"]) << "\"," << endl << " \"qt_datapath=" << formatPath(dictionary["QT_INSTALL_DATA"]) << "\"," << endl << " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl |