From 5867481c77e960a7d7b4cb3e9a7a4dffb9d68e92 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 24 Feb 2010 17:03:30 +0100 Subject: Add support for qml imports directory in configure, qmake, and qmlengine --- configure | 22 ++++++++++++++++++++++ qmake/option.h | 3 ++- qmake/property.cpp | 3 +++ src/corelib/global/qlibraryinfo.cpp | 6 ++++++ src/corelib/global/qlibraryinfo.h | 3 ++- src/declarative/qml/qdeclarativeengine.cpp | 19 ++++++++++++------- tools/configure/configureapp.cpp | 16 +++++++++++++++- 7 files changed, 62 insertions(+), 10 deletions(-) diff --git a/configure b/configure index f8a2e95..1c3c99b 100755 --- a/configure +++ b/configure @@ -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 < ...... Plugins will be installed to (default PREFIX/plugins) + -importdir ...... Imports for QML will be installed to + (default PREFIX/imports) -datadir ........ Data used by Qt programs will be installed to (default PREFIX) -translationdir . Translations of Qt programs will be installed to @@ -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" <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 ]\n" // desc("Usage: configure [-prefix dir] [-bindir ] [-libdir ]\n" // "[-docdir ] [-headerdir ] [-plugindir ]\n" -// "[-datadir ] [-translationdir ]\n" +// "[-importdir ] [-datadir ] [-translationdir ]\n" // "[-examplesdir ] [-demosdir ][-buildkey ]\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 ", "Documentation will be installed to dir\n(default PREFIX/doc)"); desc( "-headerdir ", "Headers will be installed to dir\n(default PREFIX/include)"); desc( "-plugindir ", "Plugins will be installed to dir\n(default PREFIX/plugins)"); + desc( "-importdir ", "Imports for QML will be installed to dir\n(default PREFIX/imports)"); desc( "-datadir ", "Data used by Qt programs will be installed to dir\n(default PREFIX)"); desc( "-translationdir ","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n"); desc( "-examplesdir ", "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; -- cgit v0.12