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>
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>
so use map_qt_library instead of map_qt_base_library
Change-Id: I4dd0097fff3ffd9ec4aad36d11d79ea23a08cb90
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
There is no need to try and avoid extra () and NOTs: Those will be
removed by sympy later anyway.
Change-Id: I39d3e4d1d829579e532bfbbf6c69e0f1e06e9a22
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Treat ANDROID_EMBEDDED as ANDROID when simplifying conditions.
Change-Id: I2cf0ea1e1a3e882e3a7b7276867dcee452866ade
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Do not go into an infinite loop when replacing a variable with itself.
Change-Id: I2765b1c0c567753f26ca75e0533c1d193362b456
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
This adds an overly simplistic mapping -- just like it does for the
rest of the qmake test functions.
Change-Id: I0c9e3b70c1c3d0c68a245706a141aa7b7cb4d8bf
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Expand qmake values when dealing with source file names, include
directories and more. This handles cases where variables are used
to refer to sources (e.g. $$VERSIONTAGGING_SOURCES in corelib) as
well as things like $$QT_SOURCE_TREE and friends.
Note that $$PWD and $$OUT_PWD are still need hand-holding since they
refer to the scopes directory relative to the top level directory --
which pro2cmake.py does not know.
Change-Id: I011ef55416ff820053d5f844b3008836849f5075
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
.pro-files support things like contains(Foo, bar), etc.
Map that in such a way that only one identifier will be visible to
CMake to unconfuse the logic handling on that side. These conditions
will need manual fixup later!
Change-Id: Id4946e694a9adccf9f54bcce26a6c227cd921007
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Remove leading './' from paths before writing them into CMakeLists.txt.
Change-Id: I5680a3470cf491a8805b559197f94f8e6a6ce9b7
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Fix handling of things like:
foo:bar:buz: {
do something
} else: wat {
do something else
}
The else relates to foo AND bar AND buz, not just to buz in this case.
Change-Id: I40d1fa295b4d6dd95ae5e1ce2d58372edc807b86
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Map the dlopen feature to 'ON'. The effect is that cmake will figure
out whether or not linking to 'dl' is necessary or not.
The user-visible feature is 'library' anyway: That enables dynamic
library loading -- and will link in 'dl' as needed.
Change-Id: I0d68275a7234efba7f926150f120bb37b4a1163f
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Dump scope trees for all scopes that contain a variable
'PRO2CMAKE_SCOPE_DEBUG' (set to any value).
Change-Id: If17bb1697a32ccaa427a858c2330ab2b019d0fa8
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This makes scopes much simpler to destinguish from each other.
Change-Id: I1af42f181b5899aba749bcf9267a345385149f90
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Show the total_condition (if set) when dumping a scope.
Change-Id: I9dfe98c2251f1d28881771042f17d723cedc8907
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Generate debug output whenever a qmake scope with a variable
'PRO2CMAKE_MERGE_DEBUG' is involved in a scope merge.
Change-Id: I0ad94b881db9930de689c199adbac084efe6c03b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Convert QMAKE_USE, QMAKE_CXX_FLAGS and QMAKE_LFLAGS into CMake.
Change-Id: I53a5b91664b6ab71892d4381c00f8d744d7d7abd
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Make use of @property to make code a bit nicer.
Change-Id: Iff0bfed57874cf13b7e5f85acde2660a397933d7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Qt 6 will use external libraries for everything, so
default all QT_FEATURE_system_foo to "ON".
Change-Id: I884a4293c64487271be08de5fab82e6858d0a2ed
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>
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>
Make sure complex things in qmake (e.g. function calls, etc.) are
mapped better to cmake. When there is no way to properly map the
qmake construct, then make sure to map everything into one
identifier.
This is to keep the structure of the condition simple.
Change-Id: I6d88e0cb85fce1041bbfdc96604dab7bd4e65856
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Return the current scope's condition, not the total condition from
recursive_evaluate_scope. That is the part the "else" referrs to.
The parent_condition stays identical for all branches, so that should
not get negated.
Change-Id: I0da91483d4d748d01a29ac16890d709d8d659843
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This should somewhat simplify the generated CMakeLists.txt files,
especially in complex cases like corelib or network.
Change-Id: I208c8f99a64cbb6c97d51dd3ae428bb234982202
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
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>
Report more error conditions in debug dump and make the output
easier to read in the non-error case by wrapping all strings in
"".
Change-Id: I3c99deda3dfa27dcc0c9ce2800bfb891747e6934
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Having a good representation is nice, but unfortunately very hard: pro2cmake.py
sees just a small part of the entire qmake build system at a time, so the information
it has is incomplete to start with. It is not worthwhile to pass the supposedly full
information around -- which will then need to get de-duplicated again -- considering
that the information is not complete in the first place.
So go back to the simplistic approach we used earsier. That is good enough and does not
suffer from the problem of having multi-part arguments getting messed up when the
scopes get de-duplicated.
Change-Id: I553329650d6b8046f7ad8b1282e3d0c961293a28
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This makes it easier to see what is still missing.
Change-Id: I186abd609f20be680ac0943ac89068f764142a79
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Do not add scopes that are going to get merged into their parent scope
as a child of the parent scope. This leads to the information of the
child scope being duplicated.
Change-Id: If4d6a83b9c9eac477959e7774e9cf65fd4df98e6
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Indent the individual parts of a scope relative to the scope itself.
This makes things a bit more readable.
Change-Id: Iffbffd69bc960118f9657a1b7fb488da3c7b48dd
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This avoids some includes being done several times: We used to generate
scopes for the include files, add them to our current scope and then
traverse the children of the current scope.
Switch the order to avoid traversing the newly added scopes twice.
Change-Id: Icb9c53c9f54772d3305e0fb121824c23d5469e09
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Ignore include files that go into 3rdparty code. Qt 6 should work
with external libraries, so there is no need to drag in 3rdparty
include directories, etc.
Change-Id: I990f3a8a4983e1458843b4122420b9daec763ccb
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Do not needlessly add () and NOT all over the conditions.
Change-Id: If907357306eb3f8ab5b2878bcad5902171a90476
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Make the output of the project structure debug dump more readable.
Change-Id: Ib80b41f7fdb8e14ff878284c46f3760d84f4f004
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Change-Id: Ieb33141601c29ec2f3c30c6725179f1fb234e53a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Set new keys in the parent scope instead of just appending to existing
scopes.
Change-Id: I901c3f418429d8aed56acb39b1dbe566c5468920
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Change-Id: Ice9db97db5bf1fb347bff07bcaf91daac87fa983
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Do not include the same file over and over again...
Change-Id: Ia0748b9ebe58388549ba23ec7e24ce3d9b738987
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is less self-contained than what we have, but significantly speeds
up cmake configure/generate runs.
This patch also warns when a feature is already defined.
Change-Id: I8cab63e208ba98756b47d362a39b462f5ec55e20
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add a comment that a library was removed when running into "QT -= gui"
and similar lines.
Change-Id: I17b7922827f228c6b45e1e6867fdc5e316af3781
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Map "qtHaveModule(foo)" in qmake to "TARGET Qt::Foo" in cmake.
Change-Id: I63c251f0f2dfd2e95adc996a83b528e9b4e9636e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>