summaryrefslogtreecommitdiffstats
path: root/util/cmake/tests
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-166-162/+12
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* pro2cmake: Handle QT_(MAJOR_|MINOR_|PATCH_)VERSION conditionsJoerg Bornemann2022-03-082-0/+16
| | | | | | Task-number: QTBUG-98852 Change-Id: I4c86fff7bbcc6c42cd04094f2409c3d04779597c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Generate find_package call for Qt5/Qt6 for examplesJoerg Bornemann2022-03-081-3/+5
| | | | | | | | This makes the QT_VERSION_(MAJOR|MINOR|PATH) variables available. Task-number: QTBUG-98852 Change-Id: I7e40f2a7ac09975ce21e45cda384af928e1fa629 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle optional Qt modulesJoerg Bornemann2022-03-082-0/+12
| | | | | | | | | ...and write a separate find_package(Qt6 OPTIONAL_COMPONENTS Foo Bar) call for those. Task-number: QTBUG-96799 Change-Id: I3386487774c386edde6767dca92ce433bfed906e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Add a blackbox test for converting from qmake to CMakeJoerg Bornemann2022-03-082-0/+76
| | | | | | | | | If you can set the environment variable DEBUG_PRO2CMAKE_TEST_CONVERSION to 1, the output of pro2cmake is written to the temp directory. This helps analysing test failures. Change-Id: Ida42c5b76a67172d00ce0d2488adc7fb376c6b11 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle qmake condition operator precedenceAlexandru Croitor2022-02-282-0/+25
| | | | | | | | | | | | | | | | Unfortunately qmake does not have operator precedence in conditions, and each sub-expression is simply evaluated left to right. So c1|c2:c3 is evaluated as (c1|c2):c3 and not c1|(c2:c3). To handle that in pro2cmake, wrap each condition sub-expression in parentheses. It's ugly, but there doesn't seem to be another way of handling it, because SymPy uses Python operator precedence for condition operators, and it's not possible to change the precendece. Fixes: QTBUG-78929 Change-Id: I6ab767c4243e3f2d0fea1c36cd004409faba3a53 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Fix test_realworld_comment_scopeJoerg Bornemann2022-02-281-1/+1
| | | | | | | | Change the expected value from None to [], because that's the value of the if branch. It has been like that since v6.0.0 at least. Change-Id: Iefdb22a772fc5540ad5a38566be5a7f529e00cb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Fix test_scope_handling.pyJoerg Bornemann2022-02-281-6/+5
| | | | | | | | | | | | | When the android-embedded scope was removed in 7a4b586f4b8d1b73d1af3d24ff5112e4dc231ea6, the conditions in test_scope_handling.py were adjusted following the laws of logic. However, the scope handling code does not follow the same laws. Effectively revert the part of said commit in test_scope_handling.py but use "UNKNOWN_PLATFORM" instead of "ANDROID_EMBEDDED". Change-Id: Ic090451e2a28b50f5be5668503e216cbe3871633 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-174-13/+10
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* cmake: Remove APPLE prefix from platform namesTor Arne Vestbø2020-03-162-17/+17
| | | | | | | 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-162-14/+14
| | | | | Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle operation evaluation order when including childrenAlexandru Croitor2019-11-121-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of processing included_children operations either before or after the parent scope, collect all operations within that scope and its included children scopes, and order them based on line number information. This requires propagating line numbers for each operation as well as line numbers for each include() statement, all the way from the parser grammar to the operator evaluation routines. This should improve operation handling for included_children (via include()), but not for regular children (introduced by ifs or elses), aka this doesn't solve the whole imperative vs declarative dilemma. Sample projects where the improvement should be seen: tests/auto/gui/kernel/qguiapplication and src/plugins/sqldrivers/sqlite. This amends f745ef0f678b42c7a350d0b427ddafeab4d38451 Change-Id: I40b8302ba6aa09b6b9986ea60eac87de8676b469 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake scripts: move parser into separate fileFrederik Gladhorn2019-10-102-4/+2
| | | | | | | | | The code is nicely separated between parsing and processing. Splitting that into two files makes it easier to follow which function belongs to which part. Change-Id: I576b8613b0d05b2dae3f9c6fa65d9ed5b582a0f7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake scripts: fix test_scope_handlingFrederik Gladhorn2019-10-101-1/+1
| | | | | | | The file parameter for a new Scope got renamed to qmake_file. Change-Id: I6cb9d010892f3e3132fac09eead1dbf45d6ba86d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move sympy condition simplification code into separate fileAlexandru Croitor2019-10-011-1/+1
| | | | | | Change-Id: I3f062bf939b452bb41b7a27508a83cbf93abff8c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Add support for converting qtTargetLibrary() value assignmentsLeander Beernaert2019-08-082-0/+9
| | | | | | | | | | | | | | | | | | Add support to pro2cmake to handle variable assignments via functions, e.g: TARGET = $$qtTargetLibrary($$TARGET). The evalulation of the functions happens during parsing and is very rudementary in nature. Currently it only covers the qtTargetLibrary(), required for certain projects, and quote(), required for passing unit tests. If we run into any unhanlded function an exception will be thrown. This patch also changes the TARGET property on Scope to expand the value. Change-Id: I678b7058067348a3972944bdba110f556cf22447 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Enable recursive expansion of simple qmake variablesLeander Beernaert2019-07-181-0/+8
| | | | | | | | | | | | | | | | | | | | | Allow _expand_value to expand variables that may have more than one level of expansion when the regular expression covers all of the input. E.g.: A = Foo B = $$A/Bar scope.expand('$$B') While the original code was able to expand the string '$$B/source.cpp' to 'Foo/Bar/source.cpp', it could not expand the string '$$B' completely. The latter would always return '$$A/Bar' instead of the expected 'Foo/Bar' string. A test case has been added which coveres the above example. Change-Id: Ie3b5739c24ecbeb67d408dd204b0f54bab1d0f3f Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix comment fixup in pro2cmakeAlexandru Croitor2019-06-061-0/+19
| | | | | | | | | | | | | Comments should be removed before line continuations, otherwise the semantics of an assignment change. Found this during reconversion of qtimageformats. Adjust test to specifically test for all the expected values. Amends 76f5b784ce54730ed8d6ad4bb9c39c9a05c5d81d. Change-Id: Iaa46bbc9cbd7b2390fe9b5f0078ac33d225a9258 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove all line continuations when processing qmake syntaxAlexandru Croitor2019-05-231-4/+4
| | | | | | | | | | | | | We constantly had to adjust the qmake grammar to handle line continuations (\\\n) in weird places. Instead of doing that, just do a preprocess step to remove all the LCs like we do with comments, and simplify the grammar not to take into account the LCs. From some manual testing it doesn't look like we get any regressions. Change-Id: I2017d59396004cf67b6cb54977583db65c65e7d3 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Improve qmake syntax parser in pro2cmake.pyAlexandru Croitor2019-05-234-0/+22
| | | | | | | | | | | | | | | | | Some qtdeclarative pro files caused exceptions when trying to parse them using the script. This included the following: - handling conditions divided by newlines and backslashes - handling conditions that have no scope The parser has been fixed to deal with those cases and relevant tests were added. After the change, all qtdeclarative project files are parseable by the script. Change-Id: Ib9736423f7fb3bcc1944b26cfb3114306b4db9a7 Reviewed-by: Qt CMake Build Bot Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix the fix to correctly handle comments in multi-line assignmentsAlexandru Croitor2019-05-202-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous fix where the Grammar comment style was changed to remove the newlines was incorrect, because if you have foo=1#comment bar=2 after the Grammar comment ignoring, it would transform into foo=1bar=2 which will clearly fail to parse, so the new line has to stay. But we would still have the following case which would fail: foo=a \ # comment b Apparently qmake things that's the equivalent of foo=a b but the grammar parses it as foo=a \ \n (newline) b Thus the parsing fails because there's a newline and then some weird 'b' token which the grammar does not expect. The best fix I found is to preprocess the source, to remove completely commented out lines. So: foo=a \ # comment b gets transformed into foo=a \ b Change-Id: I2487a0dbf94a6ad4d917d0a0ce05247341e9b7da Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix parsing qmake assignments that have comments in betweenAlexandru Croitor2019-05-172-0/+8
| | | | | | | | | | | | | | | | For some reason the python comment regex that we used does not ignore the line break at the end of a comment line. This caused issues when parsing multi line assignments with comments in between. Use our own regex for comments to circumvent the issue. It was found while trying to port the qtimageformats repo. Added a pytest as well. Change-Id: Ie4bbdac2d1e1c133bc787a995224d0bbd8238204 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CMake: Fix test_scope_handlingTobias Hunger2019-05-171-31/+31
| | | | | | | Adapt to updated APIs in pro2cmake.py Change-Id: I39898b675e27d6295ef6cfa049c82b245d71188a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix test_operationsTobias Hunger2019-05-171-4/+4
| | | | | | | Fix test_operations and do some small mypy cleanups along the way Change-Id: I6586b5d3491e5dcf44252c098516f0922fa60420 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix turned logic in RemoveOperationJędrzej Nowacki2019-03-281-0/+57
| | | | | | | | | | | It is regression caused by a0a94576fae26bcbbf3823a6ee4b554886e84925 ("Fix RemoveOperation"). Add unit test for all operation types to make sure this code actually works:-) Change-Id: I97c94cb3411f05de89422e3fa2222f2217a09e49 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CMake: pro2cmake.py: Simplify code and add test for line continuationTobias Hunger2019-02-282-0/+15
| | | | | | | Simplify code a bit and add a test for line continuation fixup. Change-Id: If865bc94d7d419c65d3280b5f9613ebc0d3db74a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Handle for loops without blockTobias Hunger2019-02-282-0/+10
| | | | | | | | Handle for loops with a single line of instructions and add a test for that. Change-Id: I041ae30f64abcbd3db7df29933647f047b92ede3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Make \$\$QT_FOO work in assignmentsTobias Hunger2019-02-282-0/+9
| | | | | | | This broke somewhere along the way. Add a test for this. Change-Id: I106ddff6eb86a51ef132285d1bc623f3b5cf71fb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Fix parsing of Line continuation before end of fileTobias Hunger2019-02-282-0/+9
| | | | | | | ... and add a test case for this. Change-Id: If20d737b54ecb3f9e128e59070b238c840acad6c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Fix parsing of for loopsTobias Hunger2019-02-282-0/+18
| | | | | | | Ignore for loops in the pro2cmake.py parser and add a unit test for that. Change-Id: I2a0c075c45cf56f4f24ada2d53e8e8e94ce19f26 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Handle complex conditionsTobias Hunger2019-02-282-0/+18
| | | | | Change-Id: Ifb047e5736f1831ddbd65b210e760c2729378334 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Warn and fix broken line continuationTobias Hunger2019-02-281-0/+46
| | | | | | | | Warn on broken line continuation in .pro-files, but fix up the issue and proceed. Change-Id: Ibe68011b312bcea25620ce790a0b44b2983fbd88 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Handle values with () in assignmentsTobias Hunger2019-02-272-0/+8
| | | | | Change-Id: I0f59c7fa57cd6c64b151f439d4eea4ae56dca288 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* CMake: pro2cmake.py: Improve condition simplification codeTobias Hunger2019-02-272-2/+23
| | | | | | | | | Improve the code that simplifies conditions to take "OS families" into account. E.g. if a system must be ANDROID, then it is redundant to express that it is NOT APPLE_OSX. Change-Id: Ib7e62726c309bf84b9e5e0d6a6e3465511db0ead Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* CMake: pro2cmake.py: Better parsing of scopes with elseTobias Hunger2019-02-276-4/+171
| | | | | | | | Parse conditions more exactly as before, enabling proper handling of else scopes. Change-Id: Icb5dcc73010be4833b2d1cbc1396191992df1ee4 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* CMake: pro2cmake.py: Use propertiesTobias Hunger2019-01-311-23/+23
| | | | | | | Make use of @property to make code a bit nicer. Change-Id: Iff0bfed57874cf13b7e5f85acde2660a397933d7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake.py: Merge more scopesTobias Hunger2019-01-311-0/+282
| | | | | | | | | | | * Remove scopes with condition 'OFF' * Merge scopes with identical conditions This e.g. merges children with a condition that simplifies to 'ON' with their parent scope. Change-Id: Ieb3d60e1234f189ac45869853555ca8c0cfb5c76 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake.py: Simplify conditionsTobias Hunger2019-01-291-0/+165
| | | | | | | | | Use pysym to simplify conditions in extend_target. Do some manual changes to the condition based on domain knowledge. Change-Id: I7fbb9ebc93b620a483c6a3a796d84c9bc0e36ef7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: pro2cmake.py: Fix pyls warningsTobias Hunger2019-01-291-1/+15
| | | | | | | | Fix pyls warnings in pro2cmake.py as well as its tests. Change-Id: Ib8ee1daa9b97735d13c0fde43616daa46de9e171 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Begin port of qtbase to CMakeSimon Hausmann2018-11-0117-0/+258
Done-by: Alexandru Croitor <alexandru.croitor@qt.io> Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Done-by: Kevin Funk <kevin.funk@kdab.com> Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Done-by: Simon Hausmann <simon.hausmann@qt.io> Done-by: Tobias Hunger <tobias.hunger@qt.io> Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-by: Volker Krause <volker.krause@kdab.com> Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>