Commit Graph

37912 Commits

Author SHA1 Message Date
Albert Astals Cid
404a2a56c6 cmake: Silence CMP0083 warnings until we can depend on cmake 3.14
Change-Id: Idbbe325bf088a68f875ab0e7b2eeb30badf864a7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-30 10:38:21 +00:00
Albert Astals Cid
5e339a0f97 cmake: Add trivial FindLibproxy.cmake
And fix link to it

Change-Id: Ie4f29a35a83d19ab83933faf3bcd7d62cffa68b8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-29 15:07:54 +00:00
Liang Qi
4bb44a17f6 CMake: fix build for QtNetwork on macOS
Change-Id: I32e4550d67e9d72b56de4aafaddec5e2f80792b8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-29 09:30:44 +00:00
Tobias Hunger
0c43850687 CMake: pro2cmake.py: Better printing of scopes
Change-Id: Ibeb77a23c90d3a47c78d17c4683e4af3c64449fc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-29 09:29:46 +00:00
Tobias Hunger
4a2562e5db CMake: pro2cmake.py: Simplify conditions
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>
2019-01-29 09:29:38 +00:00
Tobias Hunger
2cdef0f527 CMake: pro2cmake.py: More mappings!
Add some more mappings from qmake to CMake equivalents conditions.

Change-Id: I57b7bea9d6628e1c2b8d6ae88f799219942b571e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-29 09:01:36 +00:00
Tobias Hunger
aee1d1e96b CMake: pro2cmake.py: Work on mapping of conditions to cmake
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>
2019-01-29 09:01:26 +00:00
Tobias Hunger
404d0b5975 CMake: pro2cmake.py: Resolve file names for RESOURCES
Change-Id: I821cdc88c7f45260997e118ab2abfd7ba6526b75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-29 09:01:16 +00:00
Tobias Hunger
0a9e5e139a CMake: pro2cmake.py: Fix handling of complex else branches
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>
2019-01-29 09:01:07 +00:00
Tobias Hunger
0e2762651c CMake: pro2cmake.py: merge extend_targets with identical conditions
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>
2019-01-29 09:00:56 +00:00
Tobias Hunger
1c1bb53c55 CMake: pro2cmake.py: Fix pyls warnings
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>
2019-01-29 09:00:45 +00:00
Tobias Hunger
e2ff9e3b99 CMake: Introduce Q_OBJECT qdoc macro
CMake's moc file scanning is rather primitive: It will run moc on any
file containing a line that starts with Q_OBJECT (and similar macros).

We have four files in QtBase that contain such a macro at the start
of the line in a qdoc comment. These four files were excluded from
automatic moc handling by cmake, which is not ideal, since this will
silently fail when somebody actually adds a Q_OBJECT macro in code.

This patch introduces a macro Q_OBJECT for qdoc. This macro will be
replaced with Q_OBJECT in the generated documentation.  While not nice,
at least a failure to use \Q_OBJECT is noticeable: Moc will warn about
the file.

Change-Id: I829893c1166eee306fe30058d4ea0256affd45ea
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-01-25 14:33:26 +00:00
Tobias Hunger
0690c145db CMake: pro2cmake.py: Better output in debug dumps
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>
2019-01-23 15:41:44 +00:00
Tobias Hunger
2f50466995 CMake: pro2cmake.py: Give up on faithful representation of -=, +=, *= and =
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>
2019-01-23 15:41:34 +00:00
Tobias Hunger
024edf4bfd CMake: pro2cmake.py: Report keys that were not converted in each scope
This makes it easier to see what is still missing.

Change-Id: I186abd609f20be680ac0943ac89068f764142a79
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-23 15:41:24 +00:00
Tobias Hunger
6ad9352544 CMake: pro2cmake.py: Do not print trailing / in directory names
Change-Id: I3da83b8908791e033cf33221631d2fe988f83957
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-23 15:41:13 +00:00
Tobias Hunger
29ff5f77ee CMake: pro2cmake.py: Do not double-report include files
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>
2019-01-23 12:06:22 +00:00
Tobias Hunger
cc593426eb CMake: pro2cmake.py: Better indentation in debug dump
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>
2019-01-23 12:02:35 +00:00
Tobias Hunger
6e9a2dd3c6 CMake: pro2cmake.py: Visit scopes depth-first for include resolution
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>
2019-01-23 11:53:01 +00:00
Tobias Hunger
3f3517923e CMake: pro2cmake.py: Ignore 3rdparty code that gets included
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>
2019-01-23 11:52:44 +00:00
Tobias Hunger
23e3aaf2cd CMake: pro2cmake.py: Nicer printing of conditions
Do not needlessly add () and NOT all over the conditions.

Change-Id: If907357306eb3f8ab5b2878bcad5902171a90476
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-23 11:52:25 +00:00
Tobias Hunger
e5bee37762 CMake: pro2cmake.py: Improve debugging dump
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>
2019-01-18 08:52:58 +00:00
Tobias Hunger
1d7e724e39 CMake: pro2cmake: Fix printing of the different operations
Change-Id: Ieb33141601c29ec2f3c30c6725179f1fb234e53a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-18 08:52:42 +00:00
Tobias Hunger
d73b06fc35 CMake: pro2cmake.py: Fix merging of scopes
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>
2019-01-18 08:52:33 +00:00
Tobias Hunger
db3cc89185 CMake: Fix include path handling in pro2cmake.py
Change-Id: Ice9db97db5bf1fb347bff07bcaf91daac87fa983
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-18 08:50:59 +00:00
Tobias Hunger
9162aa5da9 CMake: pro2cmake: fix include file handling
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>
2019-01-18 08:50:40 +00:00
Tobias Hunger
448ca92053 CMake: Add "BUILD_EXAMPLES" option to disable examples
BUILD_EXAMPLES defaults to "ON".

Change-Id: I5dfe926d8a23b610b45a5243deeb82483d998b90
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2019-01-17 16:17:42 +00:00
Tobias Hunger
6a1ee4de07 CMake: Store Qt features in CMake Cache
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>
2019-01-17 16:16:55 +00:00
Tobias Hunger
3ec578020c CMake: QtFeature optimization
Remove some unnecessary sorting, speeding up cmake by about 10s on my machine

Change-Id: Ieafbd16f6dd8cfe6d1af3c739bfe58e8bf724441
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:34:02 +00:00
Tobias Hunger
235769d56b CMake: Error out on mis-use of qt_pull_features_into_current_scope
Make it a bit harder to mis-use qt_pull_features_into_current_scope.

Change-Id: I2a6be28d7c0e6207217cb1908ec22cc757acd01a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:33:50 +00:00
Tobias Hunger
4f26758978 CMake: Introduce Qt::GlobalConfig to hold the global features
This simplifies the handling of features a bit as it removes the special
code to store two sets of features in Qt::Core.

Change-Id: I536d41cfc76a02af054e3cfbad6bda50b1e9e49a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-17 08:33:27 +00:00
Tobias Hunger
b705021b4e CMake: Check for visibility once
Change-Id: I5c729f4509eed16409df5eb048afb7f60c5ca57c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-16 11:07:23 +00:00
Liang Qi
3552323049 CMake: update README.md
Because AUTOMOC/AUTOUIC/AUTORCC got merged into master.

Change-Id: I0ddfd4443a9892fae1dca54d75b97af4c69ad7ef
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-16 09:05:11 +00:00
Tobias Hunger
ff693d664b CMake: Remove one unnecessary feature push into parent scope
During qt_feature_begin_module no features are changed, so there is
no need to push features.

Change-Id: Id7ebcfad373caa284e790b7eb0a178eaa72216e5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-01-14 12:27:44 +00:00
Mikhail Svetkin
7bc03bca71 CMake: Use WrapRt instead of rt
Change-Id: I98f50a5ee7c3f1707589214df816ed03e0cfa249
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-09 14:24:23 +00:00
Tobias Hunger
54d372ea67 pro2cmake: Clean up linter and pypi issues
Also remove one stray line of debug output

Change-Id: If3d2e0b31e5e1b1c05c321d63e8762b23f55bb66
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-07 09:37:43 +00:00
Tobias Hunger
19874e2381 pro2cmake: Be more faithful in the representation of operations
Do a better approximation of =, +=, *= and -=.

Change-Id: I94765532f278deaac330b27cd5a3f41f319c6477
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-21 10:24:12 +00:00
Tobias Hunger
f0aa8fa48e pro2cmake: Handle VPATH
Change-Id: Ia72f55489129c50ca730c42b75bbc2bda926b82f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-21 10:24:01 +00:00
Tobias Hunger
99315c2129 CMake: Build PrintSupport module and tests
Change-Id: I7ac14f5214619f547af7221d213ac7e338a05bfc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:05:14 +00:00
Tobias Hunger
e57a94cbd8 CMake: Use AUTOMOC/AUTOUIC/AUTORCC
Change-Id: I0235ca4f227623e5937348b4b010637921dbf154
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:04:59 +00:00
Tobias Hunger
07dfa3013c CMake: Get rid of useless underscores in QtFeature.cmake
Change-Id: I87eb55ed2ce01ab136dac3e2a587b43bd3f8a98e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:32 +00:00
Tobias Hunger
42d6e5c5fa CMake: Simplify
* Only import features once
* Move Core specific code into its CMakeLists.txt file
* More consistently use target names like "Core" to
  refer to "Qt modules". We tend to require either "Core"
  or "QtCore" in places, which I find confusing.

Change-Id: Id54161bc5468412750cb9eb7eeb15de3812e8a09
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:21 +00:00
Tobias Hunger
3a8d8344e5 CMake: Merge qt_internal_module_include_dir and qt_internal_module_info
... and fix the fallout of this change. It results in more targets being
passed overall (instead of a strange mix of targets and module names),
so this is a good thing(TM).

Change-Id: I1c4326b80e2c6675356587879ec8471ef7249a50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-12-14 14:00:11 +00:00
Tobias Hunger
ece38e7e18 CMake: Unify creation of target aliases
For Qt6 we want to have Qt6::foo and Qt::foo. Enable that consistently.

Change-Id: I3cf05c4171b13029bf508d307945e8be4687e86b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2018-12-14 14:00:02 +00:00
Tobias Hunger
78d34c3a30 CMake: Refactor qt module name related code
Change-Id: Ib14c030ef6d2e988aaaebca354cf1a6881e05e25
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2018-12-14 11:43:00 +00:00
Tobias Hunger
8d5c9ebf8c Prefer qt_internal_ over _qt_ for internal functions
Change-Id: Idb6f3d8f29890bb4d8f0d1d644c0d1103342946a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-12-14 08:44:02 +00:00
Tobias Hunger
c22dcf6ae1 CMake: Unify on variable names without _ in functions
Change-Id: I28883775d8f9bd718de477c03628b291972f4590
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-12-14 08:37:22 +00:00
Tobias Hunger
a2da0175cd CMake: Do less feature-pushing
Do not try to push features up into the parent scope if none were added.

This avoids a lot of iterations over all defined variables.

Change-Id: Idb9a4c86643c0ca773584a05b3a0590cfab7514d
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:59 +00:00
Tobias Hunger
74e9278553 CMake: Simplify registration of known Qt targets
Change-Id: Ibd7b5f628c0a1a3087bdfebb0c35242b42c5e938
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:42 +00:00
Tobias Hunger
24fe921161 CMake: Add simple test for moc handling and fix the implementation
Add a simple test for moc-file handling and fix the implementation
to make the test pass.

Change-Id: I34e8d65a5e01a6f557d3a3d8cb262fd147ad78e4
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-11-22 15:20:17 +00:00