diff options
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | qmake/option.h | 3 | ||||
-rw-r--r-- | qmake/property.cpp | 3 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 6 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 19 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 16 |
7 files changed, 62 insertions, 10 deletions
@@ -792,6 +792,7 @@ QT_INSTALL_HEADERS= QT_INSTALL_LIBS= QT_INSTALL_BINS= QT_INSTALL_PLUGINS= +QT_INSTALL_IMPORTS= QT_INSTALL_DATA= QT_INSTALL_TRANSLATIONS= QT_INSTALL_SETTINGS= @@ -1140,6 +1141,9 @@ while [ "$#" -gt 0 ]; do plugindir) QT_INSTALL_PLUGINS="$VAL" ;; + importdir) + QT_INSTALL_IMPORTS="$VAL" + ;; datadir) QT_INSTALL_DATA="$VAL" ;; @@ -3185,6 +3189,17 @@ if [ -z "$QT_INSTALL_PLUGINS" ]; then #default fi QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"` +#imports +if [ -z "$QT_INSTALL_IMPORTS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_IMPORTS="/Developer/Applications/Qt/imports" + fi + fi + [ -z "$QT_INSTALL_IMPORTS" ] && QT_INSTALL_IMPORTS="$QT_INSTALL_PREFIX/imports" #fallback +fi +QT_INSTALL_IMPORTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_IMPORTS"` + #data if [ -z "$QT_INSTALL_DATA" ]; then #default QT_INSTALL_DATA="$QT_INSTALL_PREFIX" @@ -3347,6 +3362,8 @@ cat <<EOF (default PREFIX/include) -plugindir <dir> ...... Plugins will be installed to <dir> (default PREFIX/plugins) + -importdir <dir> ...... Imports for QML will be installed to <dir> + (default PREFIX/imports) -datadir <dir> ........ Data used by Qt programs will be installed to <dir> (default PREFIX) -translationdir <dir> . Translations of Qt programs will be installed to <dir> @@ -4142,6 +4159,7 @@ HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_IN LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"` BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"` PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"` +IMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_INSTALL_IMPORTS"` DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"` TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"` SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"` @@ -4166,6 +4184,7 @@ if [ ! -z "$QT_HOST_PREFIX" ]; then HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"` HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"` HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"` + HOSTIMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_HOST_PREFIX/IMPORTS"` HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"` HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"` HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"` @@ -4182,6 +4201,7 @@ static const char qt_configure_headers_path_str [256 + 12] = "$HOSTHEADERS_ static const char qt_configure_libraries_path_str [256 + 12] = "$HOSTLIBRARIES_PATH_STR"; static const char qt_configure_binaries_path_str [256 + 12] = "$HOSTBINARIES_PATH_STR"; static const char qt_configure_plugins_path_str [256 + 12] = "$HOSTPLUGINS_PATH_STR"; +static const char qt_configure_imports_path_str [256 + 12] = "$HOSTIMPORTS_PATH_STR"; static const char qt_configure_data_path_str [256 + 12] = "$HOSTDATA_PATH_STR"; static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR"; static const char qt_configure_settings_path_str [256 + 12] = "$HOSTSETTINGS_PATH_STR"; @@ -4199,6 +4219,7 @@ static const char qt_configure_headers_path_str [256 + 12] = "$HEADERS_PATH static const char qt_configure_libraries_path_str [256 + 12] = "$LIBRARIES_PATH_STR"; static const char qt_configure_binaries_path_str [256 + 12] = "$BINARIES_PATH_STR"; static const char qt_configure_plugins_path_str [256 + 12] = "$PLUGINS_PATH_STR"; +static const char qt_configure_imports_path_str [256 + 12] = "$IMPORTS_PATH_STR"; static const char qt_configure_data_path_str [256 + 12] = "$DATA_PATH_STR"; static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR"; static const char qt_configure_settings_path_str [256 + 12] = "$SETTINGS_PATH_STR"; @@ -4223,6 +4244,7 @@ cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF #define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12; #define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12; #define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12; +#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12; #define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12; #define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12; #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12; diff --git a/qmake/option.h b/qmake/option.h index 514e442..a2ca676 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -205,7 +205,8 @@ public: TranslationsPath, SettingsPath, DemosPath, - ExamplesPath + ExamplesPath, + ImportsPath }; static QString location(LibraryLocation); }; diff --git a/qmake/property.cpp b/qmake/property.cpp index cab034f..fde7c65 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -95,6 +95,8 @@ QMakeProperty::value(QString v, bool just_check) return QLibraryInfo::location(QLibraryInfo::BinariesPath); else if(v == "QT_INSTALL_PLUGINS") return QLibraryInfo::location(QLibraryInfo::PluginsPath); + else if(v == "QT_INSTALL_IMPORTS") + return QLibraryInfo::location(QLibraryInfo::ImportsPath); else if(v == "QT_INSTALL_TRANSLATIONS") return QLibraryInfo::location(QLibraryInfo::TranslationsPath); else if(v == "QT_INSTALL_CONFIGURATION") @@ -191,6 +193,7 @@ QMakeProperty::exec() specialProps.append("QT_INSTALL_LIBS"); specialProps.append("QT_INSTALL_BINS"); specialProps.append("QT_INSTALL_PLUGINS"); + specialProps.append("QT_INSTALL_IMPORTS"); specialProps.append("QT_INSTALL_TRANSLATIONS"); specialProps.append("QT_INSTALL_CONFIGURATION"); specialProps.append("QT_INSTALL_EXAMPLES"); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index a9ea44a..9690406 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -266,6 +266,11 @@ QLibraryInfo::location(LibraryLocation loc) path = QT_CONFIGURE_PLUGINS_PATH; break; #endif +#ifdef QT_CONFIGURE_IMPORTS_PATH + case ImportsPath: + path = QT_CONFIGURE_IMPORTS_PATH; + break; +#endif #ifdef QT_CONFIGURE_DATA_PATH case DataPath: path = QT_CONFIGURE_DATA_PATH; @@ -470,6 +475,7 @@ QLibraryInfo::location(LibraryLocation loc) \value LibrariesPath The location of installed librarires. \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 DataPath The location of general Qt data. \value TranslationsPath The location of translation information for Qt strings. \value SettingsPath The location for Qt settings. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index e64b760..4a7ba06 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -76,7 +76,8 @@ public: TranslationsPath, SettingsPath, DemosPath, - ExamplesPath + ExamplesPath, + ImportsPath }; static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path() diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 3229570..4435a5b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -170,7 +170,6 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QDeclarativeEnginePrivate::defineModule(); } globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine); - fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml")); // env import paths QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); @@ -1384,6 +1383,9 @@ public: paths += QFileInfo(base.toLocalFile()).path(); paths += importPath; paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath; + QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); + if (!builtinPath.isEmpty()) + paths += builtinPath; foreach (const QString &p, paths) { dir = p+QLatin1Char('/')+url; @@ -1592,14 +1594,17 @@ QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const Adds \a path as a directory where installed QML components are defined in a URL-based directory structure. - For example, if you add \c /opt/MyApp/lib/qml and then load QML + For example, if you add \c /opt/MyApp/lib/imports and then load QML that imports \c com.mycompany.Feature, then QDeclarativeEngine will look - in \c /opt/MyApp/lib/qml/com/mycompany/Feature/ for the components - provided by that module (and in the case of versioned imports, - for the \c qmldir file definiting the type version mapping. + in \c /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components + provided by that module. A \c qmldir file is required for definiting the + type version mapping and possibly declarative extensions plugins. + + The engine searches in the base directory of the qml file, then + the paths added via addImportPath(), then the paths specified in the + \c QML_IMPORT_PATH environment variable, then the builtin \c ImportsPath from + QLibraryInfo. - By default, only the "qml" subdirectory of QLibraryInfo::location(QLibraryInfo::DataPath) - is included on the import path. */ void QDeclarativeEngine::addImportPath(const QString& path) { diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3b5a10a..1fe4503 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1065,6 +1065,12 @@ void Configure::parseCmdLine() dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i); } + else if( configCmdLine.at(i) == "-importdir" ) { + ++i; + if(i==argCount) + break; + dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i); + } else if( configCmdLine.at(i) == "-datadir" ) { ++i; if(i==argCount) @@ -1482,6 +1488,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; dictionary[ "QT_INSTALL_PREFIX" ] = ""; dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins"; + dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports"; dictionary[ "ARM_FPU_TYPE" ] = "softvfp"; dictionary[ "SQL_SQLITE" ] = "yes"; dictionary[ "SQL_SQLITE_LIB" ] = "system"; @@ -1558,7 +1565,7 @@ bool Configure::displayHelp() desc("Usage: configure [-buildkey <key>]\n" // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n" // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n" -// "[-datadir <dir>] [-translationdir <dir>]\n" +// "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n" // "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n" "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n" "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n" @@ -1598,6 +1605,7 @@ bool Configure::displayHelp() desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)"); desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)"); desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)"); + desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)"); desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)"); desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n"); desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)"); @@ -2646,6 +2654,8 @@ void Configure::generateOutputVars() dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" ); if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() ) dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" ); + if( !dictionary[ "QT_INSTALL_IMPORTS" ].size() ) + dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/imports" ); if( !dictionary[ "QT_INSTALL_DATA" ].size() ) dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] ); if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() ) @@ -3150,6 +3160,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << QString(dictionary["QT_INSTALL_IMPORTS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl @@ -3164,6 +3175,7 @@ void Configure::generateConfigfiles() << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl @@ -3179,6 +3191,7 @@ void Configure::generateConfigfiles() << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl + << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl @@ -3325,6 +3338,7 @@ void Configure::displayConfig() cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl; cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl; cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl; + cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl; cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl; cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl; cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl; |