summaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* run_pro2cmake: Fix the file preference sorterAlexandru Croitor2019-10-081-1/+3
| | | | | | | | | | | | When invoking the script with "." as the only argument, and there are multiple .pro files in the current directory, the script would not choose the correct preferred .pro file (the one that has the same name as the current directory). Fix the sorter to handle such a case. Change-Id: I6df70d7c577649f8854bca9b8879f13bdb1b4d26 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Don't add default Qt libraries to bootstrapped toolsAlexandru Croitor2019-10-071-1/+7
| | | | | | Change-Id: I3ccc20ed5fcd2eaceb5af09df4a8bf7ccb2d525f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Handle parentheses in if() scopes betterAlexandru Croitor2019-10-071-0/+13
| | | | | | | | | | | | | | The unwrap_if handler just removed the if keyword from a condition expression, and return the rest of the condition as-is. This proves not be enough, because map_condition splits on spaces and tries to map platform keywords, which would fail for values like "unix)". Change unwrap_if to add additional space between the values in the parentheses. Change-Id: I769ab430363d008a9fd91eaba014c88bd5ee43bd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Fix QT_BUILD_TREE variable mappingAlexandru Croitor2019-10-071-1/+1
| | | | | | | | | | | | | CMake doesn't have a PROJECT_BUILD_DIR variable, but it does have a PROJECT_BINARY_DIR variable. Note that this might still be the wrong thing to do according to 35a30c7ebbd50e8b5b1fad7c00bd6c36b0dca8b9 , but it's still somwehat better. Change-Id: I493f82a791d933a16011d91774aaac4bcaffc5e5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Allow disabling condition cacheAlexandru Croitor2019-10-072-2/+19
| | | | | | | | | New option --skip-condition-cache allows forcing recomputation of condition simplification. Useful when debugging certain condition mappings. Change-Id: I68a85c2e4085ad7a3043d7334db71a334a6469e9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix pro2cmake.py path replacementFrederik Gladhorn2019-10-071-1/+1
| | | | | | | I forgot to add .items() in ed35e1ac845cfa1e4f3e46983f0d4c39d9ea0a4f. Change-Id: Ic46134daffa8f1a1b5b59040c8bcca76d32dbb35 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: clean up target.path and DESTDIR replacementsFrederik Gladhorn2019-10-071-7/+20
| | | | | Change-Id: I0891008cff939aa98b39a28a23710add0781901e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: allow $$[QT_INSTALL_PREFIX]Frederik Gladhorn2019-10-071-0/+2
| | | | | | | This is used in QtPurchasing. Change-Id: I29c3a87d844eeaf3fd1b64057e33d64054f14a89 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: add tests in corelib/serializationFrederik Gladhorn2019-10-071-1/+4
| | | | | | | | | | | | | The DEFINES -= QT_NO_LINKED_LIST is no longer needed, so just remove it from .pro and CMakeLists.txt. Handle $$[QT_INSTALL_TESTS] and $$TARGET in target.path. When we have DESTDIR set, do not use target.path for OUTPUT_DIRECTORY. Fixes: QTBUG-78219 Change-Id: I5161a955b25ff2f3b35428dc4b935a7c9d2d425b Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* Add expansion for QQC2_SOURCE_TREELeander Beernaert2019-10-071-0/+6
| | | | | | | | | | | Test in QtQuickControls2 rely on this variable, which basically points to the root of the project. We can't use PROJECT_SOURCE_DIR since it will vary depending on whether we build tests as stanadlone or part of the build. Change-Id: Ic59a79af2b4b62611d6c32391c936e98e469dea0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* cmake: add more tests in corelib/threadFrederik Gladhorn2019-10-041-0/+8
| | | | | | | | | | | | This fixes the qatomicinteger magic by making $$basename work for one particular case. qthreadstorage still needs investigation. Task-number: QTBUG-78221 Change-Id: I7bb38f6ca24273bcf0443ab25685c8e815814c3c Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make SDL2 library-mapping use a wrapperMårten Nordheim2019-10-031-1/+1
| | | | | | | | | | Since at least one system provides config files without an included target. Change-Id: If1f336aab4cec9704412349d7951849ee8c3dabb Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Handle SOURCES subtractionsAlexandru Croitor2019-10-011-0/+151
| | | | | | | | | | | | | | | SOURCES -= foo.cpp statements should now be handled correctly by the script. The script uses the same principle as for subdir handling: go through all scopes to collect source removals, and then generate new scopes with total conditions that take into account both additions and subtractions and their conditions. Should handle NO_PCH_SOURCES case as well. Tested on gui.pro, network.pro and qtconnectivity bluetooth.pro. Change-Id: I0cc913ef64cecf09e8ada4e6a3ce3ccb4365b44e Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Implement persistent caching for simplify_conditionAlexandru Croitor2019-10-012-1/+115
| | | | | | | | | | | | | | | | | | | Store the results of simplify_condition in a json cache file, next to the pro2cmake.py script. Dramatically speeds up re-conversion of projects. The cache is cleared whenever the content of the condition_simplifier.py file changes, effectively presuming that the condition computing code has changed. Sample times. Initial corelib.pro conversion - 142.13 seconds. Next re-conversion with hot cache - 1.17 seconds. Change-Id: I8790b2736358236e4b23bcb5f10f45a36fdfa426 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Move sympy condition simplification code into separate fileAlexandru Croitor2019-10-013-206/+239
| | | | | | Change-Id: I3f062bf939b452bb41b7a27508a83cbf93abff8c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* CMake: Generate wayland protocol code for examples as wellJohan Klokkhammer Helsing2019-10-011-1/+6
| | | | | | Task-number: QTBUG-78177 Change-Id: Id1c49013244e5ba51b99c1538b314181efe786fb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Add qtremoteobjectsJoerg Bornemann2019-10-011-0/+1
| | | | | | Change-Id: I6cb2ee0c83e0dd3bf830a063f5790e35cbf73285 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add CMake support for directfb plug-inJean-Michaël Celerier2019-09-301-0/+1
| | | | | | Change-Id: I126545e1da54018ce081b42a29e62ca30ee04d64 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle WINDOWS_SDK_VERSION and simplificationsAlexandru Croitor2019-09-271-0/+29
| | | | | | | | | | | | | Add custom code to handle WINDOWS_SDK_VERSION comparisons, similar to how it was done for QT_GCC_MAJOR_VERSION. Also fix simplify_condition to do mapping of conditions to unified tokens, similar how it was done for target conditions, so that the simplification process does not fail because of whitespace. Change-Id: Ia0cec6e1ffeed4c7859bb2a44423d0160222f425 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Handle one more hardcoded condition CONFIG(osx)Alexandru Croitor2019-09-271-0/+1
| | | | | | | | | | | | We can't really handle this in a generic way now, because the values of CONFIG() can not be directly mapped to features. It might be possible in the future if we make sure that all configure.json entries that have output publicConfig or privateConfig also generate a feature. For now just hardcode the case. Change-Id: Ie6b82b87973deb84012c3620b41920b343ffb2da Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix run_pro2cmake only_qtbase_main_modules optionAlexandru Croitor2019-09-271-1/+1
| | | | | | | | | There was a missing f prefix for the f-string, and thus no replacements were done. Change-Id: If778d4ce25905c302de22a76c27af00a63f3c515 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: Add BlueZ to the list of libraries used by Qt (connectivity)Oliver Wolff2019-09-251-0/+1
| | | | | | | Task-number: QTBUG-78181 Change-Id: I4eda42c4e42ccb28ebb64eb060d02a33c3af6b03 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* CMake: Add missing library-mappings for QtWaylandJohan Klokkhammer Helsing2019-09-251-0/+6
| | | | | | | | | | I haven't checked if the config for wayland-kms actually works, as that requires building for a target that supports it (RCar M3 or similar). Task-number: QTBUG-78177 Change-Id: Ib30a63a4e5feb955d17763c37e32ad3f2c13d358 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Do not error out if $$files is called with a 2nd parameterJoerg Bornemann2019-09-241-4/+0
| | | | | | | | | | Do not stop the whole conversion if we encounter $$files(..., true). Ignore the 2nd parameter for now. Change-Id: If9334ce9719b98c33716dc7f18ba8aede05fe8b1 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Add SKIP_TYPE_REGISTRATION option to add_qml_moduleLeander Beernaert2019-09-241-0/+4
| | | | | | | | | | If the qml files are not listed in the qmldir file they do not need to be written again, since it is expected that they are registered by the c++ plugin code. Change-Id: I624aedb182583f942bf1d1a322861c47a64b5065 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Fix call of write_statecharts for examplesJoerg Bornemann2019-09-241-1/+1
| | | | | Change-Id: I5417a20deda07b96499ac4f2707e7234b0f4eb7b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Don't generate GUI applications for config.testsAlexandru Croitor2019-09-241-6/+0
| | | | | | | | | | On macOS the config.tests executable should not be a bundle, and on Windows it should be a subsystem console application. Change-Id: I2c8078cc9537df42683f3ff3bcce409402824555 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* configurejson2cmake: Generate label for out-of-line testsAlexandru Croitor2019-09-241-0/+1
| | | | | | Change-Id: Iaaf8d2f19269043dfad34d4ec32ec8163e9616e4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Skip requires "skip build" message for subdir projectsAlexandru Croitor2019-09-241-1/+1
| | | | | | | | It makes too much noise when configuring. Change-Id: I0a65cb99d0dc9a6c0d288cf548035cca1bea57bc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake.py: generate code for WAYLAND*SOURCESJohan Klokkhammer Helsing2019-09-241-1/+31
| | | | | | | | | | WAYLANDCLIENTSOURCES and WAYLANDSERVERSOURCES is used heavily throughout QtWayland. Task-number: QTBUG-78177 Change-Id: I4507447054c435f78e82c2ca3e9404288db6c1f6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: Implement the ~= operator in pro2cmakeJoerg Bornemann2019-09-231-2/+34
| | | | | | Change-Id: I3fadd0038d517d197cce898d10edd6ba452adea9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Ignore generated .qrc filesJoerg Bornemann2019-09-231-0/+3
| | | | | | | | | | | ...instead of complaining about non-existing files. qtscxml/tests/auto/scion/scion.pro has RESOURCES = $$OUT_PWD/scion.qrc Change-Id: I5737fe5078c87689152fc7fa0d8d25ddc2b1a00f Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Improve handling of requires clausesAlexandru Croitor2019-09-231-11/+42
| | | | | | | | | | | | | | | | | | | | | | | Change the grammar to parse and extract the whole expression that is present in the requires clause. Make sure to preprocess the parsed content as a condition, so that the value passed to map_condition and simplify_condition is valid and the functions can handle more complicated conditions like qtConfig() and if(). Wrap the final condition with an extra pair of parentheses, so that the negated condition is computed correctly. Handle the require clause in subdir projects, top level tests projects, regular test projects, as well as top level repo projects. Examples are not yet handled, because the would require some kind of CMake public api to e.g. query if a feature is enabled. Change-Id: I9af96cf022e47b66f24db3ca15d3803dda7a5d7c Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Fix regexp for parsing env var expansionAlexandru Croitor2019-09-231-1/+1
| | | | | | | | | | | | | The qmake syntax for env var expansion is "$$()". The parantheses are not optional, so the optional "?" modifiers should be removed. This fixes the failing test_recursive_expansion pytest. Amends c58df80cf7926b07da9fe6515230bd4295c1fc6d. Change-Id: I5d7217555287ee7d96d6b38027964b1141af208a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Handle if() conditions with pyparsingAlexandru Croitor2019-09-231-6/+15
| | | | | | | | | | | | | | Previously we used a regular expression that matched parentheses, but the regexp didn't match the parantheses in a balanced way if there was more than one pair. Instead use a helper function that uses pyparsing to match balanced parantheses, and removes the if keyword, leaving just the nested expression. Change-Id: Ie621e6a305e57aa411838288599366ccfba063cc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Fix regressions introduced by reformat changeAlexandru Croitor2019-09-231-17/+3
| | | | | | | | | | | | | | | | | | | Sympy uses eval() inside its code, and that can raise an AttributeError exception, so we have to catch that. This happened when converting qml.pro in qtdeclarative. Also the formatting change removed the raising of an exception when an unhandled function was encountered in handle_function_value, which caused not returning any value in such a case. Instead just return the whole expression string, without checking if the function is in some whitelist. Also encountered in qml.pro. Amends 91634c3c9b8d4f68f0ebd2ac76a8b5b79e4b4c94. Change-Id: I47b73af1de0180becb9ef4fb78a8c35a04928d34 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Fix default mutable arguments usageAlexandru Croitor2019-09-221-5/+17
| | | | | | Change-Id: I91f2632f46539a1e5009b598625d78f61a051588 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Small fixes and adjustments reported by flake8 and IDEAlexandru Croitor2019-09-221-11/+22
| | | | | | Change-Id: I13fd2f20414647b75c8da237857248808dddaa40 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Reformat python files using blackAlexandru Croitor2019-09-222-26/+49
| | | | | | Change-Id: I0cc8ed89e2057b65f4fa34294eccffae642f2c73 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* pro2cmake: Handle generation of config.testsAlexandru Croitor2019-09-221-1/+122
| | | | | | | | | | | | | | | | | | | | | Handle conversion of config.tests that are used as out-of-line tests in configure.json. The script should able to handle conversion of simple config tests including nested scopes. One thing that will probably be needed in the future is handling of pkconfig which is used in qtwebengine config.tests. There is also a hardcoded list of config tests which should not be automatically converted by pro2cmake, either because they were hand written, or because it doesn't make sense to convert them for now. Incidentally, we should fix example conversion to also handle nested scopes, similarly to how it's done for config.tests. Change-Id: I862e67c4d19d5ed8cb7fc7c9f9aaf6e3d503aa03 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* configurejson2cmake: handle out-of-line config testsAlexandru Croitor2019-09-221-1/+11
| | | | | | | | | | | | | | Generate appropriate qt_config_compile_test() calls for config tests that have CMake projects. These are protected by an if(EXISTS) check so that configuration doesn't fail for repos where the config tests have not been ported yet. Adjust the qt_config_compile_test() function to use try_compile for projects specified via new PROJECT_PATH argument. Change-Id: I83c061e384f68688a654b782fd7a9bede282d1e3 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Skip converting projects under tests/auto/installed_cmakeAlexandru Croitor2019-09-211-0/+2
| | | | | Change-Id: Id26320fb55f7f0ae4b18726b0794a4a1f169c80f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Adapt string formatting in util/cmakeCristian Maureira-Fredes2019-09-214-121/+118
| | | | | | | | Second and final batch of changes related to string formatting styling. Change-Id: Ifc0e999ee95fe52fd076ac2f001b4a58f82ab5be Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Let pro2cmake use private statechart API for non-examplesJoerg Bornemann2019-09-201-2/+5
| | | | | Change-Id: If6206f2377e90ba7f8502029a1cc74856a2e03a1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add support for requires() statements in top-level .pro filesSimon Hausmann2019-09-201-2/+29
| | | | | | | | | | | | | | | | | | | | | For example qtserialport has requires(!winrt) and with this patch it gets translated to project(...) if(WINRT) return() endif() find_package(...) qt_build_repo(...) Change-Id: Ic38b803b464037a42adc55930947f57c5efa7b45 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add platform mapping for emscriptenSimon Hausmann2019-09-201-0/+1
| | | | | | | | EMSCRIPTEN is the name in cmake land as per emscripten's toolchain file. Change-Id: I11fa444204003f25f14fbf993ecf6766bf37d884 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* configurejson2cmake: Add special case handling for Windows BT config testsOliver Wolff2019-09-201-0/+5
| | | | | | Change-Id: Id73c44f5b7faff7392e7a8245e5e26e7dfe78cd8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* pro2cmake: Translate STATECHARTS to qt6_add_statechartsJoerg Bornemann2019-09-201-0/+13
| | | | | Change-Id: I461768e67ce8fa7dae70a057df340e9c9a2bc14e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake: Do not mis-report used values as ignoredTobias Hunger2019-09-201-0/+4
| | | | | | | | | | Do not mis-report "PLUGIN_TYPE", "PLUGIN_CLASS_NAME", "CLASS_NAME" and "MODULE_PLUGIN_TYPES" as ignored. The script evaluates these. Change-Id: I26546a7eff61a20afe68168a865fe3ac99f66319 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* CMake: pro2cmake: Handle OBJECTIVE_HEADERSTobias Hunger2019-09-201-1/+1
| | | | | Change-Id: I9a7b9c96530e8c922cf4aa5b6580e5579829db87 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>