aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/Qt6QmlMacros.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Add 'MANUAL_MOC_JSON_FILES' support by 'qt6_qml_type_registration'Alexey Edelev2021-02-021-1/+6
| | | | | | | | | | | Pass the 'qt6_qml_type_registration' function's 'MANUAL_MOC_JSON_FILES' argument to 'qt6_extract_metatypes', if specified. Align the 'qmltyperegistrar' test to modifications in the 'qt_manual_moc' and 'qt6_qml_type_registration' functions. Task-number: QTBUG-84906 Change-Id: I6b23526e1cc4633f55536871cbb7bc6d891f1dea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix cmake dependencies around qmltypes filesUlf Hermann2021-02-011-1/+8
| | | | | | | | | | | | qmltypes files are generated by qmltyperegistrar, and conditionally consumed by qmlcachegen. In turn, the C++ files generated by qmlcachegen must not declare any moc'able constructs as that would be a circular dependency via the metatypes.json files. Codify this condition as a SKIP_AUTOGEN property on the generated C++ files. Change-Id: Ied2ca6ad202dd20039bca9823ef1de4fffcf64d5 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a -i <qmltypes> option to qmlcachegenUlf Hermann2021-01-121-0/+5
| | | | | | | | | | | | | qmlcachegen needs to see the qmltypes file for the current project so that it can query it for C++ types exposed to QML. This is only relevant when generating C++ code, which qmlcachegen itself cannot do. However, in order to write a compatible drop-in, we need it. Also, hide related ignored options from --help in qmlcachegen. Change-Id: Id2f1b8b1750351c7de8dfe49e4065ef1b29423b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Encode target name into foreign_types.txt fileUlf Hermann2021-01-111-1/+1
| | | | | | | | Otherwise you cannot have multiple targets in the same directory. Change-Id: Ibf50a4e0752273965e4570527085787cf8060710 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* CMake: Make error in defer qmldir file generation more verboseAlexey Edelev2021-01-041-0/+5
| | | | | | | | | | | When CMake version >=3.19 is used, qmldir file for qml module is generated using DEFER CMake call. If find_package of Qml component was not explicitly called error message is not really obvious. Add explicit fatal error for this case and point to possible solution. Fixes: QTBUG-89622 Change-Id: I82fee717478461762deb2d66a1bc347680b48d06 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Implement command for running qmllint on targetMaximilian Goldstein2021-01-041-2/+16
| | | | | | | | | Adds qt6_target_enable_qmllint which automatically picks up all QML files marked for processing by qmlcachegen which then can be checked using a ${TARGETNAME}_qmllint target. Change-Id: I1d228d3435e6ad2389e9885f55952231c69d38ec Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Automatically create qmllint targets for modulesMaximilian Goldstein2020-12-161-0/+18
| | | | | | | | Adds ${TARGET}_qmllint targets to every qt module using qmlfiles. You may specify additional import paths by adding them to QML2_IMPORT_PATH. Change-Id: Icb920756a26c49db5e8edb9c0f691b90af9d5311 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Disable static plugin imports for qml static pluginsAlexandru Croitor2020-12-101-0/+3
| | | | | | | | | | | | There is no point in generating cpp files containing Q_IMPORT_PLUGIN() macro calls for qml static plugins. It causes unnecessary compiling of 10+ files for each such plugin. In a static Qt build, plugin imports should only be done for executables, tools and applications. Pick-to: 6.0 Change-Id: I9d02ca9272a0765e2620cd8860afadd8546e3c37 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Allow passing --qmljs-runtime to the qmlcachegen implementationUlf Hermann2020-12-021-0/+5
| | | | | | | | | | | | This signals qmlcachegenplus to not paste the whole JavaScript type system into each generated file. In turn, user projects need to add a dependency in order to build against the JS runtime. qmlcachegen ignores the option. Change-Id: I0f87dedb969e99e94fbb712b7faa23d84f76dfbe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow passing --direct-calls to the qmlcachegen implementationUlf Hermann2020-12-011-0/+6
| | | | | | | | | | | | | qmlcachegenplus has an argument --direct-calls which instructs it to call methods of known C++ types directly rather than through the JS engine or the metaobject. This is faster but requires that all those types are visible to the generated code. Introduce a way to pass this option on a per-target base. Adjust qmlcachegen to ignore the option. Change-Id: I474e577e4a197f6ca4c8b8e868dfd39983e77041 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix resource object file paths in qml plugin prl filesAlexandru Croitor2020-11-301-2/+4
| | | | | | | | | | | | | | | Pass the new INSTALL_LOCATION argument to qt_internal_record_rcc_object_files to ensure correct paths to resource object files in plugin prl files. Amends 8a54a6fc2efd13f0310ec71793f624cdf28bd1c9 Task-number: QTBUG-87702 Task-number: QTBUG-88425 Change-Id: I539c29fd9745b8ed2ad063ac2a82e086efc22ef0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit ce35f02b338fc74e72cd25cfad111dff9f6459f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix broken static plugins linkingAlexey Edelev2020-11-261-1/+1
| | | | | | | | | | Restore prefix of generated qml files resources. Non-prefixed resource names break static linking of qml plugins. Amends 08eb485a006dc2baca42eb280ae60e9f0fc00dff Pick-to: 6.0 Change-Id: Idb489536b9b863232300609ec595c6f5c29daf3e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Change generated resources namingAlexey Edelev2020-11-241-4/+1
| | | | | | | | | | | Remove redundant 'target' prefix for generated resource name for qml files. It's expected that 'qt6_add_resources' will created resource targets prefixed with '${target}_'. Fixes: QTBUG-88581 Pick-to: 6.0 Change-Id: Ie63fce11931a2cb566aa1902a77227ef86ca1ea8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Match qmake generated resource name for qmldir filesAlexandru Croitor2020-11-181-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing static builds, mkspecs/qml_module.prf embeds the qmldir file and any additional foo.qml files into a generated Qt resource file. The resource name is called qmake_<qml_plugin_uri>.qrc. In turn, certain Qt modules and plugins code call Q_INIT_RESOURCE(<qml_plugin_uri>) to initialize the resources. When Qt is built with CMake there were 2 differences. Because the resource files are not compiled into the static libraries but rather passed around as object files, there is no need to call Q_INIT_RESOURCE() anymore. The second difference was that the generated resource name for resources containing the qmldir file was '<qml_plugin_uri>_qmldir'. The differences in the CMake build caused issues when linking a QtQuick3D example project with a static Qt. That happened due to the mismatch of the generated resource name in the Q_INIT_RESOURCE() call. Unfortunately these calls can't be removed during the build system transition phase because that would break qmake Qt builds. To fix this, change the name of the CMake generated resource to match the qmake name. This avoids the undefined symbol errors during linking, but is actually a no-op! That's because the global initializer in the linked resource object file will be called before the manual Q_INIT_RESOURCE() call, effectively making the latter a no-op. Note there is one more difference regarding the CMake build. The Qt CMake builds creates 2 different resource files, one for the qmldir file (inside qt6_add_qml_module) and another separate resource for qml files (inside qt6_target_qml_files). qmake in comparison creates only one resource file for both. In practice this shouldn't affect or break anything, because even if there is no explicit Q_INIT_RESOURCE() call for the qml files resource, the global initializer will still be called from the linked in object file. An issue might happen if there are qml files, but no qmldir file, because then the qmake-required Q_INIT_RESOURCE() would not be called due to the missing qmldir resource (as generated by CMake). I think such a scenario is very unlikely if not impossible. Task-number: QTBUG-88425 Change-Id: Ib12d93d0dae52785ba8182db6829f03524723ca7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Record resource object file information for static buildsAlexandru Croitor2020-11-181-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | After any call to qt6_add_resources we need to record info about the resource object files. These will be embedded into the appropriate prl files to ensure that any application built with qmake links in the resources (only relevant for static Qt builds). The implementation is a bit ugly, but it gets the job done for now. It checks for the existence of an internal Qt function in the public macros and calls it if it's available. That will only happen when doing Qt builds. For regular app projects the functions will not be called, but we don't generate .prl files for such projects either way. Note that this comes with the same limitation as described in the changes for fixing QTBUG-88425. Specifically, the functions will only record resource object files for targets built as part of the current CMake invocation (aka just one repo for non-top-level builds). This handles the most common issues, but is not a complete fix. Task-number: QTBUG-87702 Change-Id: If632fdf9867cec4b24b1c6136d23ee9d8b56e650 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Replace 'file' with 'configure_file' in 'qmldir' generationAlexey Edelev2020-11-181-3/+40
| | | | | | | | | | | | | | | Collect content of 'qmldir' file that is generated by 'qt6_add_qml_module' and 'qt6_target_qml_files' functions, instead of write content to file immediately. Use 'cmake_language(DEFER CALL)' to call 'configure_file' write whole 'qmldir', when finalizing CMAKE_CURRENT_SOURCE_DIR scope. This way a reconfiguration will not rewrite the files, touch the timestamps, and thus needlessly rebuild. Task-number: QTBUG-88172 Change-Id: Idca68e4ceed13d0aa7eac443e769d5677557b880 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do generate typeinfo qmldir entries for pure QML modulesUlf Hermann2020-11-161-3/+1
| | | | | | | | | | As we generated qmltypes files (albeit empty), we also have to advertise them in the qmldir files. Otherwise qmllint will complain, as that is a common mistake in old modules where qmldir files were written manually. Change-Id: I4c96610930d89558cd363b7f9db28ec6e21ed4d5 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Allow building pure QML modules not backed by C++ sourcesAlexandru Croitor2020-11-121-5/+63
| | | | | | | | | | | | | | | | When no C++ sources are passed to qt_internal_add_qml_plugin (a pure QML module), create a C++ backed Qt plugin anyway. In such a case, generate a dummy plugin.cpp containing a QQmlEngineExtensionPlugin subclass. The class name is autogenerated from the QML import URI. The class constructor will call the qmltyperegistrar generated void qml_register_types_foo() function, to ensure the needed module versions are registered for the QML module. Change-Id: I19959dafdf0dc837c6037e7dc1d549b7420110a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Add past-major-version optionMaximilian Goldstein2020-11-101-0/+20
| | | | | | | | Adds the option to specify past major versions of modules to be registered. This is necessary for modules that don't export any types themselves to work when built statically. Change-Id: I4b4a379f92707ec64cbb32f91db9d010440b95a2 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* CMake: Clean up logic to prepare building pure QML modulesUlf Hermann2020-11-061-7/+16
| | | | | | | | | | | | | | Make sure we don't create bogus typeinfo entries, do create a target if there are no C++ files, and do install created targets. This way we do build the qmlcachegen-created files and link them into a library which is subsequently deployed. It's not a real plugin, though, and we need to specially handle this in QML. That's material for a separate change. Change-Id: I516d4611b6041a23489ce57df38dd83114dcc5de Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* libinfix build: adjust qmldir entriesFabian Kosmale2020-11-061-2/+2
| | | | | | | Fixes: QTBUG-88209 Change-Id: Iae298355ce0b85945ea6c5c39805794f5f997845 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix singleton declaration in qt6_target_qml_targetJoerg Bornemann2020-10-201-1/+1
| | | | | | | | The declaration is to be written without the square brackets. Fixes: QTBUG-87684 Change-Id: I8fb7fb1f9204cb56d2fa1e2c10ec585ff0e2b512 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Adjust to public API renaming in qtbaseAlexandru Croitor2020-10-181-1/+1
| | | | | | Task-number: QTBUG-86827 Change-Id: Ibeae878cbd7cc43031aeb13b2c480215c849f8bc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Mark some of the public APIs as TPAlexandru Croitor2020-10-161-1/+6
| | | | | | | | | | We don't have tests for them yet. The API surface is quite big. Some options might not make sense anymore. Task-number: QTBUG-86827 Change-Id: I4aebdb2cdfa716433681d32967ab32f1c171925c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add generated qrc files to the qmlimportscannerCristian Adam2020-10-151-1/+7
| | | | | | | | | | | | The list of generated qrc files is passed to qmlimportscanner via the -qrcFiles parameter. qt_import_qml_plugins(pointer) needs to be explicitly called in CMake unlike qmake which does the equivalent behind the scenes. Task-number: QTBUG-85994 Change-Id: Ia49a5e1fe5df11c0b3b8ff4c1765377767ca2478 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Rename qt6_quick_compiler_process_resources to be internalAlexandru Croitor2020-10-131-2/+2
| | | | | | Task-number: QTBUG-86827 Change-Id: Idb9934d18dbe54baf223d30923b03becd3e53a50 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* Allow optional imports in qmldir filesUlf Hermann2020-10-081-15/+27
| | | | | | | | | | This is useful for modules that select their imports at runtime using qmlRegisterModuleImport(). We can list all possible variants as optional imports so that tools can see what types might be available. Task-number: QTBUG-87130 Change-Id: I8a37bdde79aef3619fd1f05e5ea6781d521afa88 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Allow installation of qmltypes filesUlf Hermann2020-10-081-0/+13
| | | | | | | | This is what qmake does on install_qmltypes and we do want to install the qmltypes files of our own modules. Change-Id: Iad430aab87f21331abf332ca5c92f9d7edc47bb0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add versionless functions for new public APIAlexandru Croitor2020-10-061-0/+17
| | | | | | | | | Add some missing versionless functions. Task-number: QTBUG-86827 Change-Id: I98c554429555a7692b1315658884c173129cbe81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow the same syntax for depends and import entries in qmldirUlf Hermann2020-10-061-9/+13
| | | | | | | | | | Our qmldir parser does the same now and we need it in order to declare auto dependencies. Task-number: QTBUG-87164 Change-Id: Ie70474e238283c2ba936aeff49fb35acfd843da6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix in-source example buildsAlexandru Croitor2020-09-171-2/+2
| | | | | | | | | | | | QT_QMLTYPES_FILENAME can contain a path including subdirectories, so before creating the marker file in the .generated subfolder, we need to recreate the whole directory structure. Amends 1d67ecd790fe08a7cea1327ee754a9b8e74d113f Change-Id: I20ad48202d4e643df1ed3b86e631abb12d179b9d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Make reconfiguration work for in-source buildsAlexandru Croitor2020-09-161-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Qml plugins can either use a plugins.qmltypes file from the source repository, or opt into generating it if the file doesn't exist. There is a use case for the file not to be generated for some Qml tests. To protect against accidentally overriding the source repo file, an error is shown if the file exists in the source directory and we also also try to generate it. With an in-source build, all plugins.qmltypes files are generated in the source directory, and this causes the above check to be triggered on reconfiguration. To avoid the false issue, create a new "${CMAKE_CURRENT_BINARY_DIR}/.generated/plugins.qmltypes" file to serve as a marker that the actual file was generated, and is not part of the source repository. If the marker file exists, don't error out. Change-Id: Ieca28b4da0251f67f8c066cbac471c8e6e955758 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Use strict C++ (no GNU extensions) when compiling qml modulesAlexandru Croitor2020-08-261-0/+1
| | | | | | | | Uses the new function exposed by qtbase, to mimic CONFIG += c++_strict from qmake. Change-Id: I972cd899f8e4c7b51e792e0e20433d016d4ac4b6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Qt6QmlMacros.cmake: support multiple versions in QT_QML_SOURCE_VERSIONMitch Curtis2020-08-231-6/+9
| | | | | | Task-number: QTBUG-86174 Change-Id: Ibd3755898ac5d292ee3d5b188a5a95f7d2f627dd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Adjust naming of Qt Qml plugins for AndroidAlexandru Croitor2020-08-171-0/+20
| | | | | | | | | | | | | | | | | | | | The names are identical to the qmake ones now, following the scheme that the plugin file name should contain the TARGET_PATH, aka the directory path of the plugin, encoded in the file name itself because that's how the Android Qml plugin loader expects them. A second change is needed to pass the correct library suffix as the define, so that the Qml plugin loader actually finds them. After that, the following error goes away. libemitters_x86: qrc:/particles/emitters/emitters.qml:51:1: module "QtQuick" plugin "qtquick2plugin" not found import QtQuick 2.0 Task-number: QTBUG-85399 Change-Id: I16b9f877db3e5c8266429772a44231f1a356515c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix incorrect variable name check in qt6_import_qml_pluginsAlexandru Croitor2020-08-161-1/+1
| | | | | | | | | | | | | | The function checked for Qt6_IS_SHARED_LIBS_BUILD instead of QT6_IS_SHARED_LIBS_BUILD which ended up executing qmlimportscanner in a shared build as well, thus breaking building examples in a shared build. Fix that. Amends 9a79791e7975de811102f89686a5d631eeac9d16. Task-number: QTBUG-85961 Task-number: QTBUG-85994 Change-Id: I4869aae182a5cf85fdd9fd04a41dc4c53e9157b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Initial work on handling Qt Qml static pluginsAlexandru Croitor2020-08-131-1/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 we added a QmlImportScanner package that provided a qt5_import_qml_plugins() function. Calling it with a target ensured running qmlimportscanner to find and link necessary qml static plugins for an application to work. This is the initial port of that to Qt 6, with a few differences. It introduces 2 function names, the version-less one and qt6_ prefixed one, qt_import_qml_plugins and qt6_import_qml_plugins. Implementation notes. In Qt 5 we figured out what link flags to pass by parsing the plugin prl files. In Qt 6, CMake can generate appropriate plugin targets with dependencies, as well as Config files that can look for the dependent packages. Use that information for finding the dependencies and linking. Note this relies on the assumption that find_package(Qt6Qml) will already include all available Qml plugin Config files, so that the targets exist in scope by the time qt_import_qml_plugins is called and links against those targets. The automatic inclusion is handled by a change in qtbase. In Qt 5 the function was available as part of QmlImportScanner package. In Qt 6 the function is moved to QmlMacros, so it's enough to find_package(Qt6Qml) to use it. A dummy QmlImportScanner package is provided for backwards compatibility, that simply finds the Qml package. Another change is to make the resource name added by qt6_target_qml_files unique (include the target name), because qmlcachegen generates a cpp file with a static initializer function name that includes the resource name. This caused duplicate symbol errors when linking more than one qtquickcontrols2 style plugin into an application when the resource name was not unique. There are a couple of TODOs left: - Figure out if it's possible to automatically call qt_import_qml_plugins for applications that link against Qml. Perhaps using our hacky scope finalizers. - Figure out how to handle scanning of resources. Task-number: QTBUG-85961 Task-number: QTBUG-85994 Change-Id: I42f61e4acc6f74a3cdc030dba9e41ce789bc28f6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Partially fix static qtdeclarative builds when using qmakeAlexandru Croitor2020-08-061-0/+4
| | | | | | | | | | | | | | | | | | | | | Mimics e1e2b2d8ca89bbd90afe3e884e95bc7372bd22d5 in qtbase. Moc needs to be passed the URI as an argument, so that QQmlImportsPrivate::populatePluginPairVector doesn't fail finding the statically compiled QtQuick plugin. Fixes the following error static plugin for module "QtQuick" with name "QtQuick2Plugin" has no metadata URI import QtQuick 2.0 ^ This doesn't completely fix static qtdeclarative builds though. Task-number: QTBUG-85865 Change-Id: I1b43c3cd97b35c7222e05ecf6dcbaa16050f920f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Qt6QmlMacros.cmake: take the file path into consideration when copying QML filesRichard Moe Gustavsen2020-07-301-2/+6
| | | | | | | | | | | | | | | | | When a QML plugin has QML files, and those files are placed inside a directory (other than the root), qmldir will also refer to those files prefixed with that directory. Likewise, when the plugin is installed, the QML files will need to copied so that they mirror this structure. (This is also how qmake does it). This patch will implement the same logic for cmake, so that we check if the QML files are located elsewhere than the root of the project, and if so, copy them into the same location in the installation folder. Change-Id: Iaebe4144d9b10b7d4922b53c546ca2f76bc0be1e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Require bigobj support for typeregistrar filesFabian Kosmale2020-07-101-0/+2
| | | | | | | We already had this for mingw,this adds the equivalent for MSVC. Change-Id: I0febe36ca124ed62d5c4f94bdaed46cb55832525 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-2/+20
| | | | | | | | | | | | | You can now import the latest version, a specific version, or, "auto" which is the same version as the parent module. [ChangeLog][QtQml] You can now procedurally add module imports to modules, using qmlRegisterModuleImport(). However, actual import statements in qmldir files should be preferred wherever possible. Fixes: QTBUG-84899 Change-Id: I3b32dd8b07a19d31b6538b9a6bb436840862f345 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix failing 32 bit debug builds on MinGWAlexandru Croitor2020-06-151-0/+8
| | | | | | | | | | | | | | | | | When doing a doing a 32 debug build, and trying to compile one of the qml type registrations files, the following error can happen as.exe: quick_qmltyperegistrations.cpp.obj: too many sections (44466) Fatal error: can't close src/quick/CMakeFiles/Quick.dir/quick_qmltyperegistrations.cpp.obj: File too big The fix is to compile these specific files with the -Wa,-mbig-obj compile flag, which uses a munged COFF format that allows more than 32k sections in one file. Task-number: QTBUG-84886 Change-Id: Ic22e0ac409af6232db83c8a4856d5d260a0e20ff Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Allow QML plugins to be optionalUlf Hermann2020-06-091-1/+12
| | | | | | | | | | | If a plugin does nothing but load the library that provides the types, we can skip the plugin loading by linking the library directly. State that in the qmldir file, and evaluate it when loading the module. Task-number: QTBUG-84639 Change-Id: I2097237866a50f66c55e4653ad119fe10e18a893 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake Build: Ensure right suffix and prefixes for modules / pluginsCristian Adam2020-05-291-0/+9
| | | | | | | Same procedure as Qt Base's modules / plugins. Change-Id: I0fa86c2d137ba1abdd5c156f435d078e4f56ac8d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Quote the arguments to CMD's 'set' commandMÃ¥rten Nordheim2020-05-291-1/+1
| | | | | | | This avoids issues with some special characters and spaces. Change-Id: I79e95e75a4c1f0bf554811ebd3d2636912a3858c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Warn when the qt6_add_qml_module INSTALL_PATH is missingAlexandru Croitor2020-05-291-19/+30
| | | | | | | | | | | | | | | | | | | | If a user uses the public API function to create a qml module, they should also provide the installation path for the qml files, the compiled plugin (if C++ is involved), and the other accompanying files like qmldir. The user can specify the installation path via the INSTALL_PATH option to qt6_add_qml_module. Warn the user when they haven't done so. Also because we can't really guess where to install (we don't want to install into the Qt qml install prefix and pollute the content there), make sure to not install the files somewhere randomly. Task-number: QTBUG-84403 Change-Id: I1d8e9035b07952347f5edf854bf39869d128df4e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix qt6_target_qml_files install locationAlexandru Croitor2020-05-291-1/+1
| | | | | | | | It had a typo. Task-number: QTBUG-84403 Change-Id: Icee656e48f3acfd0d8c28dc1aa0083d2b662fd48 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Workaround fix to not install example metatypes.json filesAlexandru Croitor2020-05-291-2/+12
| | | | | | | | | | | We should not pollute the Qt install prefix lib/metatypes folder with json files that were built as part of examples. Work around this, by checking if the example qml module has an install path specified, and install there instead. Task-number: QTBUG-84403 Change-Id: I55fab7f4e2b02a74e28cf343a1aeecf59201d7cc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Explicitly require install location for plugin.qmltypesAlexandru Croitor2020-05-291-29/+36
| | | | | | | | | | | | | | If a user doesn't specify an explicit installation path for the plugin.qmltypes file, warn them about it, and make sure not to try and install the file. For internal Qt modules and plugins, we always set the path via the private qt_add_qml_module api call or by specifying the installation path explicitly via the QT_QML_MODULE_INSTALL_DIR property. Task-number: QTBUG-84403 Change-Id: I587fd70f9c767ae26f5268bb8fefc7ea678e170f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove --dependencies option from qmltyperegistrarUlf Hermann2020-05-261-5/+0
| | | | | | | | | | | We don't need to list the dependencies in the qmltypes files. The information given in the qmldir file should be enough. Ultimately, we should get rid of all hidden dependencies. Task-number: QTBUG-84286 Change-Id: Iaf67d476b449215715270043591d8c4858104ea6 Reviewed-by: Christian Kamm <mail@ckamm.de> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>