summaryrefslogtreecommitdiffstats
path: root/src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Add flag for capturing target platform in generatorShveta Mittal2024-11-221-0/+1
| | | | | | | | This commit introduces a new flag to the generator to capture the target platform. This information will be passed from CMake to the Jinja templates, allowing for dynamic decision-making within the templates based on the specified target platform. Task-number: QTBUG-130661 Change-Id: I95fd6e075671b961c413c79a6342b538a96dd0f4 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
* CMake: Replace aux target with a source_group for the IDE integrationDominik Holland2024-08-281-10/+3
| | | | | | | Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I88223dbbd85a6bcfd8f14323ee884dd435d5c7a8 Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Add support for building with QT_BUILD_STANDALONE_EXAMPLESDominik Holland2024-08-221-6/+6
| | | | | | | | | Also make sure to show a FATAL_ERROR in case we couldn't find a working venv. Pick-to: 6.8 Change-Id: I2e4663a312eb163290cddf59e430d905498b8c95 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Change default output dir of qt_ifcodegen_add_qml_moduleDominik Holland2024-06-251-2/+5
| | | | | | | | | The new default OUTPUT_DIRECTORY is now the URI with dots replaced by forward slashes. Pick-to: 6.8 Change-Id: I1a3b069483ca7d37731effc49d3fb0d5f537ed12 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Only remove ifcodegen output folder if conditions are trivialZoltan Gera2024-06-191-2/+6
| | | | | | | | | | | | | | The user can set the output folder for code generation to be the current binary folder of the build. In this case, a simple prefix check is passing while the current folder can contain other cmake-related data which is removed unintentionally. Removing the folder should only be done if the output folder is a real subfolder of the current build directory and it has the name of the template, so the use case is the default one usually set. Pick-to: 6.8 Change-Id: Iac0eb4f470bfeb677192decf0b73a5288472ae70 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
* cmake: Regenerate code when the TEMPLATE argument changesZoltan Gera2024-06-131-1/+23
| | | | | | | | | | | | Keep track of all parameters from the calls of ifcodegen, so forcing a regeneration can be done in case parameters change. Also unsuccessful ifcodegen calls are automatically retried until they succeed. All this affects cmake's configuration time logic regarding ifcodegen usage. Fixes: QTBUG-100411 Pick-to: 6.8 Change-Id: I9cef009aae460072b0e1fc2ca988d7f254dcfb11 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
* Use Python venv instead of virtualenv everywhereZoltan Gera2024-06-051-16/+48
| | | | | | | | | | | | | | | | Python has venv in its standard library set, so using it instead of the virtualenv package can make virtual environment deployment easier with less dependencies used. The newer venv package is now used for both compiled and interpreted workflows. Instead of making virtual environments relocatable, they are distributed with a generated requirements file which makes it possible for them to be regenerated after relocation. Fixes: QTBUG-104239 Pick-to: 6.8 Change-Id: I7795457be74637188ad1b1c448cca117491e4799 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
* CMake: Improve the ifcodegen warning reporting for QtCreatorDominik Holland2024-06-051-3/+5
| | | | | | | | | | | | | | | For every warning reported by ifcodegen we already send a CMAKE_WARNING with the corresponding message. This is useful to see the CMake call causing the warning, but it doesn't highlight the file the warning is in. In addition we now also post the full warning including the file as a normal CMake message. This is picked up by QtCreator and shows the error directly and the correct file and line number. Pick-to: 6.8 Change-Id: Ib2af05dc3c37d71eea6f85b78361e87f275a6be7 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Fix module build using -DQT_BUILD_TESTS=ONDominik Holland2024-06-041-67/+64
| | | | | | | | | | Make sure to always create a dummy target until ifcodegen is ready to be used. Pick-to: 6.8 Change-Id: I3153a33073be0c23e8070d37f8fdd0217fd26eb1 Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Deprecate the IMPORT_PATH function argumentDominik Holland2024-05-291-11/+18
| | | | | | | | | | The new argument is named IDL_IMPORT_PATH. The argument needs to be renamed as it clashes with the IMPORT_PATH of qt_add_qml_module. Otherwise the IMPORT_PATH argument is not forwarded correctly to qt_add_qml_module in the new qt_ifcodege_add_qml_module function. Change-Id: I2b857579b26c063c4a423afab7880a1c56d38a1d Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Add a new qt_ifcodegen_add_qml_module functionDominik Holland2024-05-291-0/+64
| | | | | | | | | | This makes it easier to generate qml modules as it will take the URI and VERSION from the ifcodegen template, but also allows to be passed to the function to overwrite the values. Fixes: QTBUG-118780 Change-Id: I15b2f06c6ac8373286d002dc64d8d34941df11df Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Add a new qt_ifcodegen_add_plugin functionDominik Holland2024-05-291-0/+101
| | | | | | | | | | This makes it easier to generate backend plugins while making sure those plugins are of the correct type and use the correct class name to support static linking. Fixes: QTBUG-123370 Change-Id: I4f32cce7df308bbe320a2063b5a9840de77a050f Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* CMake: Find the correct python3 interpreter when cross-compilingDominik Holland2023-09-041-0/+5
| | | | | | | | | | | | When cross-compiling using a yocto SDK, find_package returns the target interpreter, which is incompatible. We need to explicitly search in the host sysroot for the python interpreter. Fixes: QTBUG-116662 Pick-to: 6.2 6.5 6.6 Change-Id: Ia24a73ea3117cf38f930455a0758b17d3b86dff5 Reviewed-by: Bernd Weimer <bernd.weimer@qt.io>
* ifcodegen: Add support for deprecating annotationsDominik Holland2023-08-101-0/+4
| | | | | | | | | | When a deprecated annotation is used a warning is printed. The CMake integration has been improved to also forward those warnings to the user. Pick-to: 6.6 Change-Id: Ib77dcbb58f9697b8dfb1f2cf837319f371a0578e Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* ifcodegen: Always set a UTF-8 locale when running ifcodegenDominik Holland2023-06-231-1/+5
| | | | | | | | Fixes: QTBUG-114686 Pick-to: 6.6 Change-Id: I6dd445af4c40fee7768c4c970ccec1e74a07f21f Reviewed-by: Robert Griebl <robert.griebl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use the correct variable name when filtering HEADER filesAlexey Edelev2023-04-061-1/+1
| | | | | | | | | | | | | ARG_PREFIX can be non-set so the default value is set to VAR_PREFIX. We should use it when filtering header files and setting the GENERATED property. Amends: ed930aa68c3dc0c3cf0a837ae8b544a8b9fc110e Pick-to: 6.5 Task-number: QTBUG-112684 Change-Id: Ie7946115f7d02e6a3a3b3037bf30b039466c4867 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Mark all the generated header files as GENERATED explicitlyAlexey Edelev2023-04-061-0/+10
| | | | | | | | | | | The property is used in the Qt build system internal functionality to detect the generated files and apply the required postprocessing. This also could be useful for user projects. Fixes: QTBUG-112684 Pick-to: 6.5 Change-Id: Id265b5f4b194a79d4daa9c09461f2a48a4118d70 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Compile ifcodegen into a binaryDominik Holland2023-03-311-14/+29
| | | | | | | | | | | | | | | | | | | | The generator is packaged using nuitka as a standalone onefile binary package. The resulting binary doesn't depend on a lot of files and contains everything which is needed for the generator to work. The binary replaces the error prone virtualenv packaging. The compilation takes some time and doesn't have any benefit for qt-module developers. Because of that, the compilation needs to be enabled by using the -compiled-ifcodegen configure option. The current virtualenv packaging is not removed from the repository yet, but once the new binary proves to be a good replacement the code can be removed. Change-Id: I43cc97429553b72bac7391d0d558615277988151 Fixes: QTBUG-105233 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* ifcodegen: Improvements on python cache handling and error reportingDominik Holland2022-10-191-2/+6
| | | | | | | | | | | | | | | | | | Make sure to call python using the -B flag. This makes sure new byte code is NOT written into a __pycache__ folder next to the python file. This keeps the git repository clean from unwanted files and help in case of errors introduced from that cache at the cost of slight performance degradation. Reporting ifcodegen errors using FATAL_ERROR does add additional newlines and doesn't allow the command to be copied easily. To fix that, the command and error log is now reported as a normal cmake message and building is stopped with a FATAL_ERROR afterwards. Pick-to: 6.2 6.3 6.4 Change-Id: I9f300959fa47a8d895f224beb0645fc32f5179b5 Reviewed-by: Robert Griebl <robert.griebl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* ifcodegen: Don't set CMake wide environment variablesDominik Holland2022-10-191-6/+7
| | | | | | | | | | | Instead of setting the environment variables for ifcodegen using CMakes set command, we now set the environment variables only for the call itself using "cmake -E env". Fixes: QTBUG-107661 Pick-to: 6.2 6.3 6.4 Change-Id: I1f2b85e90d30f43a201e08d2632666fe709c4340 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* Adapt virtualenv handling to also work with older python versionsDominik Holland2022-08-051-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | This partially reverts 70ba71837aa1c93eb2a37fc90ed66c90e5c79f6a, which causes problems when a installed virtualenv should e used. The PYTHONHOME environment varible is always needed, as it tells python where to search for its base libraries. 70ba71837aa1c93eb2a37fc90ed66c90e5c79f6a was needed to also build with python3.10 on Debian. The problem there seems to be related to their additional python patches and how python detects a virtualenv. Usually the VIRTUAL_ENV environment variable is enough for that and causes the site-packages folder inside the virtualenv to be added to the search path. To fix this we now set the PYTHONPATH environment variable as well, to force the site-packages folder to be always within the search path. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-105211 Change-Id: I64baa314c3d3aa947a651f6c168f47d69ab1558d Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* ifcodegen: Don't set the PYTHONHOME environment variableDominik Holland2022-06-141-1/+0
| | | | | | | | | | | This causes issues with newer python/virtualenv versions and doesn't seem to be needed for older ones to work correctly either. Fixes: QTBUG-103919 Pick-to: 6.2 6.3 6.4 Change-Id: I112dd5ce3acfc05c85e8e5dba569c6ad4758be2d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Add support for using multiple ifcodegen calls in one CMakeLists.txtDominik Holland2022-02-171-4/+10
| | | | | | | | | | This is done by changing the default value of the OUTPUT_DIR argument to be template specific. Fixes: QTBUG-100410 Pick-to: 6.3 Change-Id: I807d10ce60965b0c1c0a06db8276e22d4658e183 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Report an error when no TEMPLATE is provided to ifcodegen_extend_targetDominik Holland2022-02-171-1/+7
| | | | | | | | | In the documentation it is already marked as mandatory, but the code happily accepted it without it. Pick-to: 6.2 6.3 Change-Id: If0b12260728a5729009fb4371886c4b6f85ba701 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* Add cmake/qmake option for defining the template search pathDominik Holland2021-09-161-7/+41
| | | | | | | | | | | This makes it easier to define your own set of templates within a repository and use it without having to define the absolute path to the template. Pick-to: 6.2 Fixes: AUTOSUITE-1644 Change-Id: I8ab2677ebb50940445362f1a404adbe23ec7a5b7 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Apply qt6_ prefix to the set_ifcodegen_variable macroDominik Holland2021-09-151-1/+13
| | | | | | | | The old macro is still available, but marked deprecated. Pick-to: 6.2 Change-Id: Ibb08209dc708ce1d65f12d338df406e0b4cf9ee8 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* ifcodegen: Install the ifcodgen templates into DATA instead of ARCHDATADominik Holland2021-08-241-1/+1
| | | | | Change-Id: Ibcb7ce164dab3ea3f1ef073f1ad73c0129614704 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Better cross-compilation supportDominik Holland2021-08-241-29/+84
| | | | | | | | | | | | | | | | | | | | | | | | Start using the ifcodegen from the host Qt, instead of building and installing a new ifcodegen into the target Qt. As a consequence the templates are now separate from the generator, similar to mkspecs and qmake binary. This change introduces a new qt_ensure_ifcodegen() function which detects the correct ifcodegen binary and the correct template location and stores them as CACHE variables. Similar to other build tools, the ifcodegen is now installed to libexec, while the templates are installed to archdata. The config log and summary shows which codegen location is used and depending on that the related Python information. Change-Id: I20043a122d2af5acfab4629892ae2f0e46962993 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Fix building the examples as standalone projectsDominik Holland2021-08-241-0/+1
| | | | | | | | We need to include the QtFindPackageHelpers explicitly in this case, in order to use qt_find_package in our functions. Change-Id: Iafaa74a85b42fca055268cd08fbc5d3dedd736db Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* Refactor the ifcodegen CMake APIDominik Holland2021-07-091-85/+244
| | | | | | | | | | | | | | | | | | | | | | | The new API consists of three public functions: ifcodegen_generate: Generates code but doesn't import it to CMake ifcodegen_extend_target: Extends a given target by autogenerated code. ifcodegen_import_variables: Imports CMake variablse from the autogenerated code, in order to use your own CMake logic for building. The latter two function are also generating code by default, but this can be disabled by passing the NO_GENERATE option. The IFCODEGEN_ prefix for all input variables as been dropped to be more in line with all other cmake functions. Change-Id: I62a1b88717655ad8df0c54ca5a92eacbde3d5b83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* ifcodegen: Streamline the naming for the various input variablesDominik Holland2021-07-051-54/+54
| | | | | | | | | | | | All qmake variables which were previously prefixed with QFACE_ are now prefixed with IFCODEGEN_ to match the new name of the generator and also match the prf file name. The --format argument of the generator (QFACE_FORMAT) will be renamed to --template and the new qmake variable name is IFCODEGEN_TEMPLATE. Change-Id: If5166091335bd12f71c82ffb93f9de3c6a60c92f Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* cmake: Improve ifcodegen log messagesDominik Holland2021-07-051-13/+16
| | | | | | | | | | | | | | By default only basic messages are printed, for which qface file is currently processed. In case of an error, the command and the full generation output is printed as a FATAL_ERROR stopping the cmake run. Verbose output can be enabled by passing the --log-level=verbose argument to cmake, setting the IFCODEGEN_VERBOSE cmake variable to ON, or by passing the VERBOSE argument to one of the autogeneration functions. Change-Id: I6305225739e41e79607a9c38b8fd5dee7ab3539e Reviewed-by: Robert Griebl <robert.griebl@qt.io>
* Rename all files to match the new module nameDominik Holland2021-06-161-0/+232
This is a follow-up of the previous commit. Task-number: AUTOSUITE-1633 Change-Id: I6feb63a346a4c94c434df83cd1255904fe8acc68 Reviewed-by: Robert Griebl <robert.griebl@qt.io>