Commit Graph

17 Commits

Author SHA1 Message Date
Amir Masoud Abdol
d77ce33082 Move Some of the Private CMake Helper Scripts from bin/ to libexec/
After this change, private CMake scripts are mostly live in
`libexec/`, except the `qt-cmake` which will stay in `bin/`.
This doesn't affect the Windows configuration.

- `qt-cmake` stays in `bin/`
- `qt-configure-module` moves into `libexec/`
- `qt-cmake-private` moves into `libexec/`
- `qt-cmake-private-install.cmake` moves into `libexec/`
- `qt-cmake-standalone-test` moves into `libexec/`
- `qt-internal-configure-test` moves into `libexec/`

In cases where `QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS` is set to
ON, e.g., ANDROID, WASM, both Batch and Bash files will be generated
and placed in `bin/` and `libexec/` accordingly; in both cases,
qt-cmake and qt-cmake.bat will be in `bin/` anyway.

[ChangeLog][CMake] The private Qt CMake scripts, i.e.,
qt-configure-module, qt-cmake-private, qt-cmake-private-install.cmake,
qt-cmake-standalone-test and qt-internal-configure-test were moved
into $prefix/libexec on Unix platforms.

Fixes: QTBUG-107621
Change-Id: Ic4f4ec85f64d2ede0e208bca928959e30be906a6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 18:02:59 +00:00
Alexandru Croitor
440438092b coin: Use configure and qt-configure-module in instructions
We want to use configure and qt-configure-module when building in
Coin, rather than pure cmake and qt-cmake.

There are a few benefits:
- CI tests the scripts, making sure we don't introduce regressions
- CI uses the same scripts that we mention in our documentation for
developers to use
- The platform configurations become a bit less verbose and easier to
read due to less shouty-case CMake options

To ensure a more gradual porting, Coin will only use the new
instructions if the 'UseConfigure' feature is set on a platform
configuration in qt5.git. This allows going back to the old
instructions in case if something isn't working properly.

Due the opt-in, we need to support both old and new instructions in
the implementation.

The change strives to remove as much duplicate code as possible,
by moving it into common includes.

The README.md is updated to mention the overview of how the different
environment variables are used.

There are a few important things to point out.

1) Because during the porting we have to allow mixing of the old style
and new style, platform configs have to separate CMake-style options
from configure-style options in different environment variables.
Otherwise the instructions wouldn't be able to create a valid
configure call, where all CMake-style options have to go at the end
after a double dash --.

After all platform configs are ported to the new style, it should be
possible to combine all the options in a single environment variable
if that is desired, but it will require another round of porting to
remove all the '-D' prefixes in CMake-style options, and just use
regular variable assignment which configure supports.
e.g. -DQT_BUILD_EXAMPLES=ON becomes QT_BUILD_EXAMPLES=ON, which can be
mixed in-between configure-style args.

2) Configure is more strict in that it doesn't allow passing
unknown options. Due to that, we can't pass non-qtbase configure
options via NON_QTBASE_CONFIGURE_ARGS. qt-configure-module would
error out in the repos where the configure option is unknown.
Because we don't have a Coin configure variable for each repo,
we circumvent the issue by continuing to pass CMake-style options via
NON_QTBASE_CMAKE_ARGS instead, which does not do validation checks.
In the future, we could introduce a configure flag that disables
the validation checks.

Pick-to: 6.2 6.3
Task-number: QTQAINFRA-4357
Task-number: QTQAINFRA-4815
Change-Id: I72d8ba0b3a543b42982e22ae8d6566c0e885c446
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-03-17 17:14:36 +01:00
Toni Saario
b3ec373e2f Remove useless error messaging
This part originates from when the CMake was being introduced and
now things are stable enough that the bug rarely is everywhere.

Pick-to: 6.2 6.3
Task-number: COIN-828
Change-Id: Ifb7b5ce82740f5ae49f712f9666870993ce00b15
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-17 16:14:36 +00:00
Alexandru Croitor
6e5c7b9e4f coin: Move AUTOGEN and tests options addition into a common location
As a drive-by this fixes the qtbase build to also have the
CMAKE_AUTOGEN_VERBOSE option set.

Pick-to: 6.2 6.3
Change-Id: I32324fb1e8e16299c5f34517edbc7ff335d84e14
Reviewed-by: Toni Saario <toni.saario@qt.io>
2022-01-19 01:28:02 +01:00
Toni Saario
2f3b234d6c Apply custom timeouts to cross compilations
Pick-to: 6.2
Change-Id: I93ce6b6a6011a0883820f291121d7374391494c6
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2021-08-10 12:21:58 +00:00
Alexandru Croitor
24f12d0cef CMake: Build examples with qmake against a CMake built Qt
We want to remove the Qt .pro files for projects, except examples,
because examples are still meant to build with qmake.

To not lose coverage on examples built with qmake, add instructions that
will build the qtrepo/examples folder with qmake when the CMake
configuration has -DQT_BUILD_EXAMPLES=ON.

This means that such configurations will build examples both with CMake
and qmake.

Aside from making sure that our examples will still build with qmake, it
will gives us some some coverage that a CMake-built qmake works
correctly.

Implementation-wise, add new instructions files that can call qmake and
make depending on configuration and target type.

Pick-to: 6.0
Fixes: QTBUG-85986
Change-Id: Ie8f4cbcda03c94da2aef455e32f48dad41a4bdb0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-04 15:39:32 +01:00
Joerg Bornemann
fb21a5ce1a CMake: Name QT_NO_MAKE_*/BUILD_* variables consistently
For consistency, apply the following renamings:
QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT
QT_NO_MAKE_TESTS    -> QT_BUILD_TESTS_BY_DEFAULT
QT_NO_MAKE_TOOLS    -> QT_BUILD_TOOLS_BY_DEFAULT
BUILD_EXAMPLES      -> QT_BUILD_EXAMPLES
BUILD_TESTING       -> QT_BUILD_TESTS

This should help to better convey the difference between "BUILD" and
"NO_MAKE".

To configure tests, but not to build them by default, pass the
following to CMake:
-DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF

Analoguous for examples:
-DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF

Tools can be excluded from the default build with:
-DBUILD_TOOLS_BY_DEFAULT=OFF

The variable BUILD_TESTING is still available and initialized with the
value of QT_BUILD_TESTS.

Pick-to: 6.0 6.0.0
Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 20:38:03 +01:00
Toni Saario
716e41e86f CMake: Use CMAKE_AUTOGEN_VERBOSE to see moc invocations
In qmake builds we can see the moc invocations, whereas in CMake builds
by default we don't.
Modify the Coin instructions to pass the CMAKE_AUTOGEN_VERBOSE cache
variable so that AUTOMOC prints the moc invocations.

Change-Id: I50be13224839fbbdece3c9e8a4935a72aba91a8e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-24 17:33:17 +02:00
Toni Saario
684fea1314 CMake: Add instructions to re-use host artifacts for target builds
We don't want to build the host Qt configuration every single time we
do a cross-build in Coin.
Coin learned some new qt5.git platform configuration options, which
allow specifying a dependency between a host Coin configuration and a
target one.

This means we can specify a host macOS config as a dependency when
building iOS, and the host artifacts for all dependent repos
(qtbase, qtsvg, qtdeclarative, etc) will be installed into
/home/qt/work/install (as specified by the
{{.AgentWorkingDir}}/install location).

Same for Linux + Android and Linux + qemu.

Modify the qtbase Coin instructions to use these installed host
artifacts if such a dependency is present (platformDependency is not
null). The target artifacts will be installed into a subfolder of the
host installation, called 'target', e.g. /home/qt/work/install/target.

If a dependency is not present, continue to build a host Qt before
doing a target build. This allows gradual conversion of configurations
in case if some of them don't work, or if the dependencies.yaml have
not propagated far enough for all new repos to use the new
instructions.
In this case the locations of the artifacts are different
host - /home/qt/work/install/host
target - /home/qt/work/install/target

Task-number: QTBUG-85623
Change-Id: I33539f4376034539fb7db80293dc4d39dcb9539b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-24 17:33:13 +02:00
Alexandru Croitor
70f7155fcc CMake: Propagate non-qtbase configure args to other repositories
Currently configure arguments specified in
qt5.git/coin/platform_configs are only used when configuring
qtbase itself. Sadly, Coin lacks support for specifying per-repo
configure flags.

Until Coin gets the feature, the best we can do is to pass
all the configure flags to each repo we are configuring.

Unfortunately if we pass all of qtbase's configure flags to other
repos it will break cross-compiling configurations (because the
toolchain argument would be overridden with the initial qtbase
provided toolchain instead of the Qt generated chainloading one).

We thus have to separate flags that should and shouldn't be passed
to other repos.

Introduce usage of two new environment variables called
NON_QTBASE_CONFIGURE_ARGS and NON_QTBASE_TARGET_CONFIGURE_ARGS.
Additional configure arguments can be specified in these variables,
and they will be used when configuring repositories, with the
exception of qtbase.

Ultimately, this is needed to disable detection / usage of certain
strawberry perl system libraries in qtimageformats on MinGW.
Doing that prevents crashes of the tst_qtiff test.

Minor implementation note is that the environment variables have to be
explicitly set in qt5.git platform_configs otherwise it breaks the
Windows Ninja Multi-Config configuration with the error
"The system cannot find the file specified".

Supplements 4b4f0be08debcfde62caf4066222b348ce65dea1 from qt5.git.
Amends previous revert 946fc92d20

Task-number: QTBUG-84886
Task-number: COIN-601
Change-Id: Ie4305c5d799bf4a29da5032a691e797b49c3cf33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-13 21:01:59 +02:00
Alexandru Croitor
946fc92d20 Revert "CMake: Propagate configure args to all repositories"
This reverts commit adbadc57df.

The change breaks building of repos other than qtbase when
cross-compiling to Android. Not sure yet why.

Change-Id: I6a6efef5360ed141c0c5056afb03b1a0d90439ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-08 21:14:18 +02:00
Alexandru Croitor
adbadc57df CMake: Propagate configure args to all repositories
Currently the configure arguments specified in qt5.git/coin are only
used when building qtbase itself. None of them are used when
configuring other repos like qtsvg.

While in principle passing all the configure arguments to other repos
is not a good thing, we need to do it to circumvent the lack of
support for specifying per-repo configure flags in Coin.

It's needed to disable detection / usage of certain strawberry perl
system libraries in qtimageformats on MinGW. Doing that prevents
crashes of the tst_qtiff test.

Supplements 4b4f0be08debcfde62caf4066222b348ce65dea1 from qt5.git.

Task-number: QTBUG-84886
Task-number: COIN-601
Change-Id: I59be8c62ebb10282db1b0a9da2d3e3e5595c925f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-08 11:01:38 +02:00
Alexandru Croitor
b3e01d608e CMake: Use custom install script to support Ninja Multi-Config builds
Calling cmake --install . only installs a single configuration.

To install both debug and release artifacts, the install
invocation needs to be done for each configuration.

To keep the Coin instruction code simpler, delegate the looping
over configurations to a custom CMake script, and use it in the
Coin instructions.

Replace all cmake --install calls in the instructions with calls
to either call_host_install.yaml or call_target_install.yaml.

The path to the script depends on whether we are building
qtbase or another module. In the former case the script should
be called from the build dir, otherwise from the install dir.

The other distinction is whether the host or target env prefix
needs to be added.

Task-number: QTBUG-80900
Change-Id: Ied4bf739e2b1a2307f22fc79c1cfad746c8cbc44
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:11 +02:00
Simon Hausmann
e9b8837c31 Add support for building building against yocto
Using an environment prefix wrapper shell script that sources the SDK's
env setup. The script also ensure that we don't loose cmake on the way.

Change-Id: I9d08bc58f0efaf688512ab26a7ddb800309a5015
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-29 22:26:25 +02:00
Alexandru Croitor
a02ec931b6 CMake: Pass --verbose flag to ninja
To allow seeing the exact compiler flags when build in Coin.
We do the same for qmake builds.

Change-Id: I8c43f35b95d722d914aaeaa8860720a3a0578737
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-13 19:14:59 +01:00
Liang Qi
60feaae196 coin: remove contact person for cmake issues
Change-Id: Id274bf821f424077e7259ed42433f2ef88153c36
Reviewed-by: Toni Saario <toni.saario@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-13 20:14:12 +01:00
Liang Qi
d445112cc0 cmake: upload artifact for qtbase android build and etc
Task-number: QTBUG-78945
Change-Id: I3361e63ed4830ac0e1ebb9d4b9495df09c45f476
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-07 10:05:51 +00:00