summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
Commit message (Collapse)AuthorAgeFilesLines
...
* CMake: Rename internal functions to contain qt_internalAlexandru Croitor2020-09-231-9/+36
| | | | | | | | | | Offer compatibility wrapper functions until we update all of the Qt repos to use the new names. Task-number: QTBUG-86815 Change-Id: I5826a4116f52a8509db32601ef7c200f9bd331de Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: build add flags for building QtAndroid.jarAssam Boudjelthia2020-09-161-1/+1
| | | | | | | | | | | | | Adds -source, -target, -Xlint:unchecked, -bootclasspath flags. Setting default javac build source and target versions to 8. Allow setting custom values for javac build versions via -DQT_ANDROID_JAVAC_SOURCE, and -DQT_ANDROID_JAVAC_TARGET. Task-number: QTBUG-86282 Change-Id: I98f4f193ac96016dc722d178594d7fd401202f68 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake.py: support multiple versions in QT_QML_SOURCE_VERSIONMitch Curtis2020-08-231-4/+8
| | | | | | Task-number: QTBUG-86174 Change-Id: I56f4a54874410a19f782ce4dda2e166789570fb9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtCore: Use system-wide libb2 if presentLinus Jahn2020-07-311-0/+1
| | | | | | | | | | | | This adds the option to build Qt with libb2, which is especially recommended, if you care about the performance of the BLAKE2 hashing algorithms. The bundled version is the pure reference C implementation of BLAKE2, while libb2 has many additional hardware optimizations. However, the API of both is the same, so no changes to the code were necessary here. Change-Id: I3563982f4e07be300291fe103c38b16a404b3ebb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Fix errors reported by flake8 and mypyAlexandru Croitor2020-07-311-9/+8
| | | | | | Change-Id: I842c0f8d7ec1d173fa1dbd74e769e2c370e70518 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: pro2cmake: Reformat files using blackAlexandru Croitor2020-07-311-61/+78
| | | | | Change-Id: Ic06840f9877d6b863f48a5eb97fcd6735ab9bde8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Teach pro2cmake to convert load(qt_app)Alexandru Croitor2020-07-311-13/+233
| | | | | | | | | | | | Changes pro2cmake to handle load(qt_app) projects and write out qt_internal_add_app calls. Also adds handling of macOS and Windows specific resource files for Qt apps only. Task-number: QTBUG-85757 Change-Id: I994d8d19ab2ae366a985cab7894b97d6a278a56f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Remove dead codeDimitrios Apostolou2020-07-101-28/+0
| | | | | | | Found by LGTM.com. Change-Id: I661e2287a6964b63d5b03c8913bc4b09f21ffdf1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix various issues with the Android buildAlexandru Croitor2020-07-091-0/+1
| | | | | | | | | | | | | | | | | | | Certain resources and compiled jar files have to be copied into the non-prefix build dir location. They were previously only installed, which doesn't do anything in a non-prefix build. Change pro2cmake to generate code that places the compiled java jars into QT_BUILD_DIR, so that non-prefix builds work. Place the module dependencies xml files into lib folder in non-prefix builds. Don't special case the output and install location of the Android QPA plugin. Task-number: QTBUG-85399 Change-Id: I4ac9d3929ea8ecc95ec99a77e621ad2121b68832 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: pro2cmake: Remove dead code regarding resource retainingAlexandru Croitor2020-07-071-22/+0
| | | | | | | | | qtdeclarative as of 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c always retains the resources, so there's no manual facility for retaining left. Remove the code. Change-Id: If79b66683897b5f430844e13c0230e41a2cf061d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: pro2cmake: Fix handling of QT_SKIP_QUICKCOMPILERAlexandru Croitor2020-07-071-10/+25
| | | | | | | | | | | | | | | | If a file was part of a resource that has a non-empty base directory, the script generated set_source_files_properties calls to the file path without including the base dir, which means the command did nothing. The script should set the QT_SKIP_QUICKCOMPILER on the full file path if a base dir is present, similar to how the alias handled. Refactor the alias property writing code to write all properties into the command that uses the full correct path. Change-Id: Ic75d51ecf60eef3ada9bd6ca26882de3447896e9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* pro2cmake.py: Parse qmldir import statements with versionsUlf Hermann2020-06-241-3/+6
| | | | | | | | | | | | You can write the following in a qmldir file these days: import QtQuick auto import QtQml 2.4 pro2cmake should understand and convert these to cmake. Change-Id: Ica1728de0c8d7a0b2b5aa341d20e60b23dfa7fe1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* pro2cmake: Parse "optional plugin" from qmldir filesUlf Hermann2020-06-091-1/+13
| | | | | | | Task-number: QTBUG-84639 Change-Id: Iedfa2e53c686a7c7c855efc7b9deee097a15f4b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Make it possible to build tools when cross-compilingLeander Beernaert2020-06-021-15/+30
| | | | | | | | | | | | | | | | | | | This patch allows tools to be built for the target platform when the QT_BUILD_TOOLS_WHEN_CROSSCOMPILING parameter is set at configuration time. To avoid naming conflicts, the target tools are suffixed with "_native". The qt_get_tool_target_name() function can be used to get the tool name for both scenarios (cross and non-cross compilation). Extend pro2cmake to refer to the right target name for tools. The relevant write_XXX functions have a new target_ref parameter that will be "${target_name}" for tools and literally the target name for everything else. Fixes: QTBUG-81901 Change-Id: If4efbc1fae07a4a3a044dd09c9c06be6d517825e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Check existence of QMLTYPES_INSTALL_DIRAlexandru Croitor2020-05-291-2/+4
| | | | | | | | | | | | | | | | When writing the qt6_qml_type_registration call, make sure to write the set(QT_QML_MODULE_INSTALL_QMLTYPES TRUE) statement only if an explicit path was provided via QMLTYPES_INSTALL_DIR / QT_QML_MODULE_INSTALL_DIR. This will remove the QT_QML_MODULE_INSTALL_QMLTYPES property from many examples and tests in qtdeclarative, thus not installing the .qmltypes file into the Qt prefix, thus polluting it. Task-number: QTBUG-84403 Change-Id: I5c64d42915896d14f2591cbb64d73d912dbf7c7d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Generate information about 3rdparty libs in module .pri filesJoerg Bornemann2020-05-191-1/+2
| | | | | | | | | | | | | For modules that are not yet ported to CMake and that use QMAKE_USE += libfoo we need to provide the information about libfoo in the qt_lib_XXX.pri files. Also, we now generate qt_ext_XXX.pri files for bundled 3rdparty libs. Task-number: QTBUG-75666 Change-Id: I9e4b057a197554ecb37c294c0bf09e2a2b3aa053 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Fix Scope.get_string for list valuesJoerg Bornemann2020-05-151-1/+2
| | | | | | | | | | | | | | QMake variables are always string lists, but some variables are used to represent single string values. People tend to fill those variables with multiple values and expect them to be joined by spaces. Exhibit A: qtdeclarative/tools/qml/qml.pro QMAKE_TARGET_DESCRIPTION = QML Runtime QMake supports this for many values. Do the same for Scope.get_string(). Change-Id: I6af22bc1bfed07a4d8eac94d7315051a5bcb7a4d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle QMAKE_TARGET_XXX variablesJoerg Bornemann2020-05-121-1/+18
| | | | | Change-Id: I62151e04d21c20d8c8ad5825464f26074c8abc3d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Fix cmake api detection for pluginsAlexandru Croitor2020-05-121-1/+1
| | | | | | | | We should search for the values of function names rather than the mapping key. Change-Id: Iedef7fcf4d716ff7f6d277d9626d9dc2dd781401 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* pro2cmake: Honor INSTALL_EXAMPLESDIR if definedChristophe Giboudeaux2020-05-071-2/+5
| | | | | | | | | | | | When building examples standalone, 'INSTALL_EXAMPLESDIR' may be undefined. The converted .pro files now check whether the variable is set to prevent installation into unexpected locations. Fixes: QTBUG-81797 Change-Id: I9f97568923c8103011a41d9af7cfe02dd1e40b56 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake.py: Generate .cmake.conf files for versioningMårten Nordheim2020-04-301-1/+12
| | | | | | | | And create one for QtBase at the same time. Fixes: QTBUG-83835 Change-Id: Icc6b022165a57bd4e22c23bdb0016522b99a5b80 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Translate (QT|QMAKE_USE)_FOR_PRIVATE into PRIVATE_MODULE_INTERFACETor Arne Vestbø2020-04-301-0/+4
| | | | | | Fixes: QTBUG-83063 Change-Id: I5b02cd236ef0fd3a9ed389294c05f8e3024463cd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix pro2cmake help textTor Arne Vestbø2020-04-301-1/+1
| | | | | Change-Id: I84980dda981c50da159e4bb81b08190b882d6978 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: convert QMLTYPES_FILENAME to QT_QMLTYPES_FILENAMEFabian Kosmale2020-04-301-0/+4
| | | | | Change-Id: I9afc6d4c0c9b3fd87ef28f15da0a984d778b83ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add qt6_add_plugin public APILeander Beernaert2020-04-221-2/+6
| | | | | | | | | | | | | | | This patch adds a publicly callable qt6_add_plugin() API to create plugins. This API is meant to cover cases such as the plugandpaint example. This patch also renames qt_add_plugin to qt_internal_add_plugin in order to avoid clashes with the public API. To avoid breaking the existing projects, a compatibility wrapper function is enabled by default unless QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified. Fixes: QTBUG-82961 Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Update pro2cmake and friend to convert QtVirtualkeyboardLeander Beernaert2020-04-151-0/+2
| | | | | | | | | | | | Expand $$MODULE_BASE_DIR to ${QT_BUILD_DIR}. Add library mappings for Hunspell. Add test mappings for QtVirtualKeyboard regarding 3rdparty Hunspell and T9Write. Change-Id: Ief007456d0471cbcf9a03d819291edec5f63680f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake expand variables for qt_add_resource()Leander Beernaert2020-04-141-0/+12
| | | | | Change-Id: Ida1196645dabcb0c3aee210d9bc5ee5632a9ccc5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Handle missing packages in project compile testsAlexandru Croitor2020-04-091-1/+7
| | | | | | | | | | | | | | | | | If a find_package() in a try_compile project doesn't find a package, and we then link against a non-existent target, the configuration failure of the compile test also fails the configuration of the project. To avoid that, separate library targets from non-targets, and make sure to only link against the targets if they exist. pro2cmake now outputs modified compile test project code which iterates over targets and non-target libraries, and links against them when needed. Change-Id: Ib0f4b5f07af13929c42d01a661df2cabdf9b926b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake: Handle $$PWD in included .pri files correct-ishAlexandru Croitor2020-04-081-1/+12
| | | | | | | | | | | | | | | | Previously the $$PWD was evaluated within the including .pro file, which generated incorrect relative paths to source files. Now we use a horrible hack to evaluate keys ending with SOURCES and HEADERS. If such is a case, use a map_file transformer which will use the included scope, thus creating correct relative paths. Fixes projects in qtdeclarative like src/qmltypregistrar and qmllint. Checked that it doesn't break projects in qtdeclarative and qtbase. Change-Id: I21f1e4c638c2cf8d0f67e94e1a583ebc54c175a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Implement proper exclusion of tools including installingAlexandru Croitor2020-04-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous approach didn't work for prefix builds. While a target might be excluded from building via EXCLUDE_FROM_ALL property, when calling make install it would still try to install the target and thus fail. It's not possible to modify an install() command in a post-processing step, so we switch the semantics around. pro2cmake will now write a qt_exclude_tool_directories_from_default_target() call before adding subdirectories. This will set an internal variable with a list of the given subdirectories, which is checked by qt_add_executable. If the current source dir matches one of the given subdirectories, the EXCLUDE_FROM_ALL property is set both for the target and the qt_install() command. This should fix the failing Android prefix builds of qttools. Amends 622894f96e93d62147a28a6f37b7ee6a90d74042 Change-Id: Ia19323a2ef72a3fb9cb752ad2d4f2742269d11c4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Reformat python scriptsAlexandru Croitor2020-04-061-2/+5
| | | | | | Change-Id: I1dfac318cdbbc4b4b7c76b113edca7db8f52f56b Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Allow specifiying custom output fileAlexandru Croitor2020-04-061-5/+24
| | | | | | Change-Id: If984d2bbc3e4b655a5eb58c68b282e3d13d51218 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake: Skip conversion of doc snippetsAlexandru Croitor2020-04-031-0/+5
| | | | | | | | Most of them are hand-written. Change-Id: Ia3d83cdc9e279420c9b4700993b428e10cf8fb22 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle standalone config.tests in configure libraries sectionAlexandru Croitor2020-04-031-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some library entries in configure.json have a test entry. An example is assimp in qtquick3d. qmake tries to find the library via the sources section, and then tries to compile the test found in config.tests/assimp/assimp.pro while automagically passing it the include and link flags it found for assimp. We didn't handle that in CMake, and now we kind of do. configurejson2cmake will now create a corresponding qt_config_compile_test call where it will pass a list of packages and libraries to find and link against. pro2cmake will in turn generate new code for the standalone config.test project. This code will iterate over packages that need to be found (like WrapAssimp) and then link against a list of passed-in targets. In this way the config.test/assimp/main.cpp file can successfully use assimp code (due to propagated include headers). qt_config_compile_test is augmented to take a new PACKAGES argument, with an example as follows PACKAGES PACKAGE Foo 6 COMPONENTS Bar PACKAGE Baz REQUIRED The arguments will be parsed and passed to the try_compile project, to call find_package() on them. We also need to pass the C/C++ standard values to the try_compile project, as well as other try_compile specific flags, like the toolchain, as given by qt_get_platform_try_compile_vars(). Change-Id: I4a3f76c75309c70c78e580b80114b33870b2cf79 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow excluding tools and apps from the default 'all' targetAlexandru Croitor2020-04-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | Qt uses the qtNomakeTools() function to mark a directory which will not be built as part of the default target. This is especially important when cross-compiling (to iOS for example) because the build process might fail. The condition for not building these "GUI tool sub-directory projects" is the absence of the "tools" value in qmake's QT_BUILD_PARTS variable. Introduce a QT_NO_MAKE_TOOLS CMake variable. If the value is true, it's equivalent to "tools" not being present in QT_BUILD_PARTS. Introduce qt_exclude_tool_directories_from_default_target(). It's the qmake counter part to qtNomakeTools(). Teach pro2cmake to generate it where appropriate. Change-Id: If2e5958d91847ab139af0e452608510286e73fa0 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix exception in pro2cmake about missing v1 apiLeander Beernaert2020-03-251-0/+1
| | | | | | | | This patch silences the exception about missing v1 api entry for the qt_add_3rdparty_library() function. Change-Id: I74a473ed1c063b13f0a9ca64dcb568b8f8b27235 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add support for bundled SQLite libraryLeander Beernaert2020-03-251-0/+2
| | | | | Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Consider system-assimp for conditionsAlexandru Croitor2020-03-231-0/+1
| | | | | | Change-Id: Idee55dfdd88b04792dc1485a818ab41218fa2707 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Skip inclusion of selfcover.priLeander Beernaert2020-03-191-0/+4
| | | | | | | | | Do not process selfcover.pri in the conversion as the output requires a lot of special case fixs ups. Change-Id: Iebee484db887973369b5604344a6d486f4bea20b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't use GUI for tests that use QT += testlib-privateAlexandru Croitor2020-03-191-3/+3
| | | | | | Change-Id: I90cac19928d6e6e30214a6480a5855479a8d4d77 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: pro2cmake: Handle javascript files not present in qmldirAlexandru Croitor2020-03-171-0/+5
| | | | | | | | | | If a file is present in a QML_FILES variable inside a qmake .pro file, but is not listed in the static qmldir file, mark the file so no qmldir entry created for it. Change-Id: I3ec77b6eedf70ea9124bf7f447ee3477204bc4f7 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake: Handle system tiff featureAlexandru Croitor2020-03-171-0/+1
| | | | | | | | Don't exclude it, because we use it in qtimageformats. Change-Id: I0004830580dd9711cf7a5bd934ecd5a7f9036800 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* cmake: Remove APPLE prefix from platform namesTor Arne Vestbø2020-03-161-1/+1
| | | | | | | None of the other platforms have it. Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix naming when referring to Apple macOSTor Arne Vestbø2020-03-161-1/+1
| | | | | Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake handle ${QT_SOURCE_TREE} for include statementsLeander Beernaert2020-03-121-0/+7
| | | | | | | | | | Replace ${QT_SOURCE_TREE} with top level project directory when encountered in include statements. This is required to parse tests/auto/testlib/selftests/test/test.pro. Change-Id: I80f31142cf5a35441d1424c38e21bb097e44cd0f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Reformat the python scripts using blackAlexandru Croitor2020-03-121-3/+3
| | | | | | Change-Id: I1e2eba46eb7c9dfefd267be91790be7898634c3a Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Handle LIBS_SUFFIX define correctlyAlexandru Croitor2020-03-121-0/+12
| | | | | | | | | Matches the LIBS_SUFFIX define we use in Android conditions and replaces it with a sane amount of escaped characters. Change-Id: I7d870f992c70b105dd80b6fa94f87d3fa5644006 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Fix opengles condition substitutionAlexandru Croitor2020-03-101-1/+1
| | | | | | | | Missing parenthesis caused wrong condiiton simplification in scopes. Change-Id: Ia2a1a97f4da36b185631a2a3c7855ae01595b0f7 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Remove old 3rdparty mechanism for double conversionAlexandru Croitor2020-03-101-0/+1
| | | | | | Change-Id: I2b20d4d9d95a1f7f59bc506046a1ebc20eb305f7 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add python version requirement note to pro2cmakeAlexandru Croitor2020-03-091-0/+3
| | | | | | Change-Id: Iccaf61e19fb7257ed21f656c287976d7d778ed1c Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>